feat(backend): PUSH, PUT en DELETE endpoints voor leerpaden aangemaakt.

This commit is contained in:
Gerald Schmittinger 2025-05-12 16:11:08 +02:00
parent 20c04370b5
commit 30ca3b70de
8 changed files with 186 additions and 44 deletions

View file

@ -0,0 +1,12 @@
import learningPathService from "../../../services/learning-paths/learning-path-service";
import { authorize } from "../auth";
import { AuthenticatedRequest } from "../authenticated-request";
import { AuthenticationInfo } from "../authentication-info";
export const onlyAdminsForLearningPath = authorize((auth: AuthenticationInfo, req: AuthenticatedRequest) => {
const adminsForLearningPath = learningPathService.getAdmins({
hruid: req.body.hruid,
language: req.body.language
});
return adminsForLearningPath && auth.username in adminsForLearningPath;
});