mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
organizing file storage
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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({});
|
||||
});
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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({});
|
||||
});
|
||||
|
||||
@@ -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({});
|
||||
});
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user