diff --git a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/assignments/[assignmentName]/route.ts b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/assignments/[assignmentName]/route.ts index f5ba2ba..7c76946 100644 --- a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/assignments/[assignmentName]/route.ts +++ b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/assignments/[assignmentName]/route.ts @@ -10,7 +10,7 @@ export const GET = async ( } ) => await withErrorHandling(async () => { - const settings = await fileStorageService.getAssignment( + const settings = await fileStorageService.assignments.getAssignment( courseName, moduleName, assignmentName @@ -28,7 +28,7 @@ export const PUT = async ( ) => await withErrorHandling(async () => { const assignment = await request.json(); - await fileStorageService.updateAssignment( + await fileStorageService.assignments.updateAssignment( courseName, moduleName, assignmentName, diff --git a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/assignments/route.ts b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/assignments/route.ts index 9e64e13..16b435e 100644 --- a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/assignments/route.ts +++ b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/assignments/route.ts @@ -7,7 +7,7 @@ export const GET = async ( params: { courseName, moduleName }, }: { params: { courseName: string; moduleName: string } } ) => await withErrorHandling(async () => { - const settings = await fileStorageService.getAssignmentNames( + const settings = await fileStorageService.assignments.getAssignmentNames( courseName, moduleName ); diff --git a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/pages/[pageName]/route.ts b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/pages/[pageName]/route.ts index d8a0b10..094e28c 100644 --- a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/pages/[pageName]/route.ts +++ b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/pages/[pageName]/route.ts @@ -8,7 +8,7 @@ export const GET = async ( }: { params: { courseName: string; moduleName: string; pageName: string } } ) => await withErrorHandling(async () => { - const settings = await fileStorageService.getPage( + const settings = await fileStorageService.pages.getPage( courseName, moduleName, pageName @@ -24,6 +24,6 @@ export const PUT = async ( ) => await withErrorHandling(async () => { const page = await request.json(); - await fileStorageService.updatePage(courseName, moduleName, pageName, page); + await fileStorageService.pages.updatePage(courseName, moduleName, pageName, page); return Response.json({}); }); diff --git a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/pages/route.ts b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/pages/route.ts index 38e22f8..f41fa24 100644 --- a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/pages/route.ts +++ b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/pages/route.ts @@ -8,7 +8,7 @@ export const GET = async ( }: { params: { courseName: string; moduleName: string } } ) => await withErrorHandling(async () => { - const settings = await fileStorageService.getPageNames( + const settings = await fileStorageService.pages.getPageNames( courseName, moduleName ); diff --git a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/quizzes/[quizName]/route.ts b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/quizzes/[quizName]/route.ts index 834ec1f..f7afbfc 100644 --- a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/quizzes/[quizName]/route.ts +++ b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/quizzes/[quizName]/route.ts @@ -7,7 +7,7 @@ export const GET = async ( params: { courseName, moduleName, quizName }, }: { params: { courseName: string; moduleName: string; quizName: string } } ) => await withErrorHandling(async () => { - const quiz = await fileStorageService.getQuiz( + const quiz = await fileStorageService.quizzes.getQuiz( courseName, moduleName, quizName @@ -22,7 +22,7 @@ export const PUT = async ( }: { params: { courseName: string; moduleName: string; quizName: string } } ) => await withErrorHandling(async () => { const quiz = await request.json() - await fileStorageService.updateQuiz( + await fileStorageService.quizzes.updateQuiz( courseName, moduleName, quizName, diff --git a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/quizzes/route.ts b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/quizzes/route.ts index b105a50..6e0d39e 100644 --- a/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/quizzes/route.ts +++ b/nextjs/src/app/api/courses/[courseName]/modules/[moduleName]/quizzes/route.ts @@ -8,7 +8,7 @@ export const GET = async ( }: { params: { courseName: string; moduleName: string } } ) => await withErrorHandling(async () => { - const settings = await fileStorageService.getQuizNames( + const settings = await fileStorageService.quizzes.getQuizNames( courseName, moduleName ); diff --git a/nextjs/src/app/api/courses/[courseName]/modules/route.ts b/nextjs/src/app/api/courses/[courseName]/modules/route.ts index b155d31..af884ed 100644 --- a/nextjs/src/app/api/courses/[courseName]/modules/route.ts +++ b/nextjs/src/app/api/courses/[courseName]/modules/route.ts @@ -6,6 +6,16 @@ export const GET = async ( { params: { courseName } }: { params: { courseName: string } } ) => await withErrorHandling(async () => { - const settings = await fileStorageService.getModuleNames(courseName); + const settings = await fileStorageService.modules.getModuleNames(courseName); return Response.json(settings); }); + +export const POST = async ( + request: Request, + { params: { courseName } }: { params: { courseName: string } } +) => + await withErrorHandling(async () => { + const { moduleName } = await request.json(); + await fileStorageService.modules.createModule(courseName, moduleName); + return Response.json({}); + }); diff --git a/nextjs/src/app/api/courses/[courseName]/settings/route.ts b/nextjs/src/app/api/courses/[courseName]/settings/route.ts index f581164..4ed7fb9 100644 --- a/nextjs/src/app/api/courses/[courseName]/settings/route.ts +++ b/nextjs/src/app/api/courses/[courseName]/settings/route.ts @@ -9,7 +9,7 @@ export const GET = async ( if (courseName.includes(".js.map")) { return Response.json({}); } - const settings = await fileStorageService.getCourseSettings(courseName); + const settings = await fileStorageService.settings.getCourseSettings(courseName); return Response.json(settings); }); @@ -20,7 +20,7 @@ export const PUT = async ( await withErrorHandling(async () => { const settings = await request.json(); - await fileStorageService.updateCourseSettings(courseName, settings); + await fileStorageService.settings.updateCourseSettings(courseName, settings); return Response.json({}); }); diff --git a/nextjs/src/app/api/courses/route.ts b/nextjs/src/app/api/courses/route.ts index adb13e2..f4fb91d 100644 --- a/nextjs/src/app/api/courses/route.ts +++ b/nextjs/src/app/api/courses/route.ts @@ -11,7 +11,7 @@ export const GET = async () => export const POST = async (request: Request) => await withErrorHandling(async () => { const newCourse: LocalCourse = await request.json(); - await fileStorageService.updateCourseSettings( + await fileStorageService.settings.updateCourseSettings( newCourse.settings.name, newCourse.settings ); diff --git a/nextjs/src/app/api/courses/settings/route.ts b/nextjs/src/app/api/courses/settings/route.ts index 9894e39..163a614 100644 --- a/nextjs/src/app/api/courses/settings/route.ts +++ b/nextjs/src/app/api/courses/settings/route.ts @@ -3,7 +3,7 @@ import { withErrorHandling } from "@/services/withErrorHandling"; export const GET = async () => await withErrorHandling(async () => { - const settings = await fileStorageService.getAllCoursesSettings(); + const settings = await fileStorageService.settings.getAllCoursesSettings(); return Response.json(settings); }); diff --git a/nextjs/src/app/course/[courseName]/CourseSettingsLink.tsx b/nextjs/src/app/course/[courseName]/CourseSettingsLink.tsx index d486668..5075e28 100644 --- a/nextjs/src/app/course/[courseName]/CourseSettingsLink.tsx +++ b/nextjs/src/app/course/[courseName]/CourseSettingsLink.tsx @@ -12,7 +12,7 @@ export default function CourseSettingsLink() {