back to server actions

This commit is contained in:
2024-10-29 13:34:55 -06:00
parent 6b59960189
commit 590a245536
7 changed files with 0 additions and 149 deletions

View File

@@ -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({});
});

View File

@@ -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({});
});

View File

@@ -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);
});

View File

@@ -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);
// });