feat(frontend): Frontend-controllers voor het beheren van leerpaden & verwijderen van leerobjecten aangemaakt

This commit is contained in:
Gerald Schmittinger 2025-05-12 21:45:31 +02:00
parent 30ca3b70de
commit a6e0c4bbd6
2 changed files with 21 additions and 0 deletions

View file

@ -22,4 +22,8 @@ export class LearningObjectController extends BaseController {
async upload(learningObjectZip: File): Promise<LearningObject> {
return this.postFile<LearningObject>("/", "learningObject", learningObjectZip);
}
async deleteLearningObject(hruid: string, language: Language, version: number): Promise<LearningObject> {
return this.delete<LearningObject>(`/${hruid}`, { language, version });
}
}

View file

@ -36,4 +36,21 @@ export class LearningPathController extends BaseController {
const dtos = await this.get<LearningPathDTO[]>("/", query);
return dtos.map((dto) => LearningPath.fromDTO(dto));
}
async getAllByAdmin(admin: string): Promise<LearningPath[]> {
const dtos = await this.get<LearningPathDTO[]>("/", { admin });
return dtos.map((dto) => LearningPath.fromDTO(dto));
}
async postLearningPath(learningPath: LearningPathDTO): Promise<LearningPathDTO> {
return await this.post<LearningPathDTO>("/", learningPath);
}
async putLearningPath(learningPath: LearningPathDTO): Promise<LearningPathDTO> {
return await this.put<LearningPathDTO>(`/${learningPath.hruid}/${learningPath.language}`, learningPath);
}
async deleteLearningPath(hruid: string, language: string): Promise<LearningPathDTO> {
return await this.delete<LearningPathDTO>(`/${hruid}/${language}`);
}
}