added leaderOfTeam check

This commit is contained in:
Laurin
2022-06-04 01:06:09 +02:00
parent 87fa0f3184
commit 619b46a6aa
6 changed files with 56 additions and 38 deletions
+6 -3
View File
@@ -1,6 +1,5 @@
import express from "express";
import { requireAuthentication, requireConfiguredAuthentication } from "../Middleware/auth/auth";
import { requireTeamleaderAuthentication } from "../Middleware/auth/teamleaderAuth";
import { requireConfiguredAuthentication } from "../Middleware/auth/auth";
import { deleteTeam, getTeam, getTeams, updateTeam } from "../Controllers/team.controller";
const router = express.Router();
@@ -12,7 +11,11 @@ router.get(
getTeam
);
router.put("/", requireTeamleaderAuthentication, updateTeam);
router.put<"/:pid/", { pid: string }>(
"/:pid/",
requireConfiguredAuthentication({ optional: false, type: { admin: true, teamleader: true } }),
updateTeam
);
router.delete<"/:pid/", { pid: string }>(
"/:pid/",
requireConfiguredAuthentication({ optional: false, type: { admin: true, teamleader: true } }),