permissions

This commit is contained in:
Julian Krauser 2024-10-21 10:25:13 +02:00
parent 624408c973
commit a112805fbb

View file

@ -19,6 +19,7 @@ import {
synchronizeProtocolPrecenseById, synchronizeProtocolPrecenseById,
synchronizeProtocolVotingsById, synchronizeProtocolVotingsById,
} from "../../controller/admin/protocolController"; } from "../../controller/admin/protocolController";
import PermissionHelper from "../../helpers/permissionHelper";
var router = express.Router({ mergeParams: true }); var router = express.Router({ mergeParams: true });
@ -54,44 +55,84 @@ router.get("/:protocolId/printout/:printoutId", async (req: Request, res: Respon
await getProtocolPrintoutByIdAndPrint(req, res); await getProtocolPrintoutByIdAndPrint(req, res);
}); });
router.post("/", async (req: Request, res: Response) => { router.post(
"/",
PermissionHelper.passCheckMiddleware("create", "club", "protocol"),
async (req: Request, res: Response) => {
await createProtocol(req, res); await createProtocol(req, res);
}); }
);
router.post("/:protocolId/agenda", async (req: Request, res: Response) => { router.post(
"/:protocolId/agenda",
PermissionHelper.passCheckMiddleware("create", "club", "protocol"),
async (req: Request, res: Response) => {
await createProtocolAgendaById(req, res); await createProtocolAgendaById(req, res);
}); }
);
router.post("/:protocolId/decision", async (req: Request, res: Response) => { router.post(
"/:protocolId/decision",
PermissionHelper.passCheckMiddleware("create", "club", "protocol"),
async (req: Request, res: Response) => {
await createProtocolDecisonsById(req, res); await createProtocolDecisonsById(req, res);
}); }
);
router.post("/:protocolId/voting", async (req: Request, res: Response) => { router.post(
"/:protocolId/voting",
PermissionHelper.passCheckMiddleware("create", "club", "protocol"),
async (req: Request, res: Response) => {
await createProtocolVotingsById(req, res); await createProtocolVotingsById(req, res);
}); }
);
router.post("/:protocolId/printout", async (req: Request, res: Response) => { router.post(
"/:protocolId/printout",
PermissionHelper.passCheckMiddleware("create", "club", "protocol"),
async (req: Request, res: Response) => {
await createProtocolPrintoutById(req, res); await createProtocolPrintoutById(req, res);
}); }
);
router.patch("/:id/synchronize", async (req: Request, res: Response) => { router.patch(
"/:id/synchronize",
PermissionHelper.passCheckMiddleware("update", "club", "protocol"),
async (req: Request, res: Response) => {
await synchronizeProtocolById(req, res); await synchronizeProtocolById(req, res);
}); }
);
router.patch("/:protocolId/synchronize/agenda", async (req: Request, res: Response) => { router.patch(
"/:protocolId/synchronize/agenda",
PermissionHelper.passCheckMiddleware("update", "club", "protocol"),
async (req: Request, res: Response) => {
await synchronizeProtocolAgendaById(req, res); await synchronizeProtocolAgendaById(req, res);
}); }
);
router.patch("/:protocolId/synchronize/decisions", async (req: Request, res: Response) => { router.patch(
"/:protocolId/synchronize/decisions",
PermissionHelper.passCheckMiddleware("update", "club", "protocol"),
async (req: Request, res: Response) => {
await synchronizeProtocolDecisonsById(req, res); await synchronizeProtocolDecisonsById(req, res);
}); }
);
router.patch("/:protocolId/synchronize/votings", async (req: Request, res: Response) => { router.patch(
"/:protocolId/synchronize/votings",
PermissionHelper.passCheckMiddleware("update", "club", "protocol"),
async (req: Request, res: Response) => {
await synchronizeProtocolVotingsById(req, res); await synchronizeProtocolVotingsById(req, res);
}); }
);
router.put("/:protocolId/synchronize/presence", async (req: Request, res: Response) => { router.put(
"/:protocolId/synchronize/presence",
PermissionHelper.passCheckMiddleware("update", "club", "protocol"),
async (req: Request, res: Response) => {
await synchronizeProtocolPrecenseById(req, res); await synchronizeProtocolPrecenseById(req, res);
}); }
);
export default router; export default router;