mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 15:48:32 -06:00
back to server actions
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
|
||||
import { withErrorHandling } from "@/services/withErrorHandling";
|
||||
|
||||
export const GET = async (
|
||||
_request: Request,
|
||||
{ params: { courseName } }: { params: { courseName: string } }
|
||||
) =>
|
||||
await withErrorHandling(async () => {
|
||||
if (courseName.includes(".js.map")) {
|
||||
return Response.json({});
|
||||
}
|
||||
const settings = await fileStorageService.settings.getCourseSettings(courseName);
|
||||
return Response.json(settings);
|
||||
});
|
||||
|
||||
export const PUT = async (
|
||||
request: Request,
|
||||
{ params: { courseName } }: { params: { courseName: string } }
|
||||
) =>
|
||||
await withErrorHandling(async () => {
|
||||
const settings = await request.json();
|
||||
|
||||
await fileStorageService.settings.updateCourseSettings(courseName, settings);
|
||||
|
||||
return Response.json({});
|
||||
});
|
||||
@@ -1,20 +0,0 @@
|
||||
import { LocalCourse } from "@/models/local/localCourse";
|
||||
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
|
||||
import { withErrorHandling } from "@/services/withErrorHandling";
|
||||
|
||||
// replace with get all settings
|
||||
// export const GET = async () =>
|
||||
// await withErrorHandling(async () => {
|
||||
// const courses = await fileStorageService.getCourseNames();
|
||||
// return Response.json(courses);
|
||||
// });
|
||||
|
||||
export const POST = async (request: Request) =>
|
||||
await withErrorHandling(async () => {
|
||||
const newCourse: LocalCourse = await request.json();
|
||||
await fileStorageService.settings.updateCourseSettings(
|
||||
newCourse.settings.name,
|
||||
newCourse.settings
|
||||
);
|
||||
return Response.json({});
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
|
||||
import { withErrorHandling } from "@/services/withErrorHandling";
|
||||
|
||||
export const GET = async () =>
|
||||
await withErrorHandling(async () => {
|
||||
const settings = await fileStorageService.settings.getAllCoursesSettings();
|
||||
|
||||
return Response.json(settings);
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
|
||||
import { withErrorHandling } from "@/services/withErrorHandling";
|
||||
|
||||
// export const GET = async () =>
|
||||
// await withErrorHandling(async () => {
|
||||
// const directories = await fileStorageService.getEmptyDirectories();
|
||||
// return Response.json(directories);
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user