mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
ignoring assignments that cannot be parsed
This commit is contained in:
@@ -11,12 +11,12 @@ export const GET = async (
|
||||
}
|
||||
) =>
|
||||
await withErrorHandling(async () => {
|
||||
const settings = await fileStorageService.assignments.getAssignment(
|
||||
const assignment = await fileStorageService.assignments.getAssignment(
|
||||
courseName,
|
||||
moduleName,
|
||||
assignmentName
|
||||
);
|
||||
return Response.json(settings);
|
||||
return Response.json(assignment);
|
||||
});
|
||||
|
||||
export const PUT = async (
|
||||
|
||||
@@ -6,10 +6,27 @@ export const GET = async (
|
||||
{
|
||||
params: { courseName, moduleName },
|
||||
}: { params: { courseName: string; moduleName: string } }
|
||||
) => await withErrorHandling(async () => {
|
||||
const settings = await fileStorageService.assignments.getAssignmentNames(
|
||||
courseName,
|
||||
moduleName
|
||||
);
|
||||
return Response.json(settings);
|
||||
})
|
||||
) =>
|
||||
await withErrorHandling(async () => {
|
||||
const names = await fileStorageService.assignments.getAssignmentNames(
|
||||
courseName,
|
||||
moduleName
|
||||
);
|
||||
const assignments = (
|
||||
await Promise.all(
|
||||
names.map(async (name) => {
|
||||
try {
|
||||
return await fileStorageService.assignments.getAssignment(
|
||||
courseName,
|
||||
moduleName,
|
||||
name
|
||||
);
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
)
|
||||
).filter((a) => a !== null);
|
||||
|
||||
return Response.json(assignments);
|
||||
});
|
||||
|
||||
@@ -2,11 +2,12 @@ import { LocalCourse } from "@/models/local/localCourse";
|
||||
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
|
||||
import { withErrorHandling } from "@/services/withErrorHandling";
|
||||
|
||||
export const GET = async () =>
|
||||
await withErrorHandling(async () => {
|
||||
const courses = await fileStorageService.getCourseNames();
|
||||
return Response.json(courses);
|
||||
});
|
||||
// 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 () => {
|
||||
|
||||
Reference in New Issue
Block a user