From a6e0c4bbd67d2dc10d33560d6eb5f25a3d756c81 Mon Sep 17 00:00:00 2001 From: Gerald Schmittinger Date: Mon, 12 May 2025 21:45:31 +0200 Subject: [PATCH] feat(frontend): Frontend-controllers voor het beheren van leerpaden & verwijderen van leerobjecten aangemaakt --- frontend/src/controllers/learning-objects.ts | 4 ++++ frontend/src/controllers/learning-paths.ts | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/frontend/src/controllers/learning-objects.ts b/frontend/src/controllers/learning-objects.ts index 7239b88f..a9ecf22f 100644 --- a/frontend/src/controllers/learning-objects.ts +++ b/frontend/src/controllers/learning-objects.ts @@ -22,4 +22,8 @@ export class LearningObjectController extends BaseController { async upload(learningObjectZip: File): Promise { return this.postFile("/", "learningObject", learningObjectZip); } + + async deleteLearningObject(hruid: string, language: Language, version: number): Promise { + return this.delete(`/${hruid}`, { language, version }); + } } diff --git a/frontend/src/controllers/learning-paths.ts b/frontend/src/controllers/learning-paths.ts index bad54286..697826bc 100644 --- a/frontend/src/controllers/learning-paths.ts +++ b/frontend/src/controllers/learning-paths.ts @@ -36,4 +36,21 @@ export class LearningPathController extends BaseController { const dtos = await this.get("/", query); return dtos.map((dto) => LearningPath.fromDTO(dto)); } + + async getAllByAdmin(admin: string): Promise { + const dtos = await this.get("/", { admin }); + return dtos.map((dto) => LearningPath.fromDTO(dto)); + } + + async postLearningPath(learningPath: LearningPathDTO): Promise { + return await this.post("/", learningPath); + } + + async putLearningPath(learningPath: LearningPathDTO): Promise { + return await this.put(`/${learningPath.hruid}/${learningPath.language}`, learningPath); + } + + async deleteLearningPath(hruid: string, language: string): Promise { + return await this.delete(`/${hruid}/${language}`); + } }