starting to resurect tests

This commit is contained in:
2024-09-13 09:11:30 -06:00
parent 32b59b3975
commit 6b60e8eda6
19 changed files with 550 additions and 638 deletions

View File

@@ -1,8 +1,19 @@
import { LocalCourse } from "@/models/local/localCourse";
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
import { withErrorHandling } from "@/services/withErrorHandling";
export const GET = async () =>
await withErrorHandling(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.updateCourseSettings(
newCourse.settings.name,
newCourse.settings
);
return Response.json({});
});

View File

@@ -0,0 +1,9 @@
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
import { withErrorHandling } from "@/services/withErrorHandling";
export const GET = async () =>
await withErrorHandling(async () => {
const settings = await fileStorageService.getAllCoursesSettings();
return Response.json(settings);
});