138 lines
3.8 KiB
TypeScript
138 lines
3.8 KiB
TypeScript
import express, { Request, Response } from "express";
|
|
import {
|
|
createProtocol,
|
|
createProtocolAgendaById,
|
|
createProtocolDecisonsById,
|
|
createProtocolPrintoutById,
|
|
createProtocolVotingsById,
|
|
getAllProtocols,
|
|
getProtocolAgendaById,
|
|
getProtocolById,
|
|
getProtocolDecisonsById,
|
|
getProtocolPrecenseById,
|
|
getProtocolPrintoutByIdAndPrint,
|
|
getProtocolPrintoutsById,
|
|
getProtocolVotingsById,
|
|
synchronizeProtocolAgendaById,
|
|
synchronizeProtocolById,
|
|
synchronizeProtocolDecisonsById,
|
|
synchronizeProtocolPrecenseById,
|
|
synchronizeProtocolVotingsById,
|
|
} from "../../../controller/admin/club/protocolController";
|
|
import PermissionHelper from "../../../helpers/permissionHelper";
|
|
|
|
var router = express.Router({ mergeParams: true });
|
|
|
|
router.get("/", async (req: Request, res: Response) => {
|
|
await getAllProtocols(req, res);
|
|
});
|
|
|
|
router.get("/:id", async (req: Request, res: Response) => {
|
|
await getProtocolById(req, res);
|
|
});
|
|
|
|
router.get("/:protocolId/agenda", async (req: Request, res: Response) => {
|
|
await getProtocolAgendaById(req, res);
|
|
});
|
|
|
|
router.get("/:protocolId/decisions", async (req: Request, res: Response) => {
|
|
await getProtocolDecisonsById(req, res);
|
|
});
|
|
|
|
router.get("/:protocolId/presence", async (req: Request, res: Response) => {
|
|
await getProtocolPrecenseById(req, res);
|
|
});
|
|
|
|
router.get("/:protocolId/votings", async (req: Request, res: Response) => {
|
|
await getProtocolVotingsById(req, res);
|
|
});
|
|
|
|
router.get("/:protocolId/printouts", async (req: Request, res: Response) => {
|
|
await getProtocolPrintoutsById(req, res);
|
|
});
|
|
|
|
router.get("/:protocolId/printout/:printoutId", async (req: Request, res: Response) => {
|
|
await getProtocolPrintoutByIdAndPrint(req, res);
|
|
});
|
|
|
|
router.post(
|
|
"/",
|
|
PermissionHelper.passCheckMiddleware("create", "club", "protocol"),
|
|
async (req: Request, res: Response) => {
|
|
await createProtocol(req, res);
|
|
}
|
|
);
|
|
|
|
router.post(
|
|
"/:protocolId/agenda",
|
|
PermissionHelper.passCheckMiddleware("create", "club", "protocol"),
|
|
async (req: Request, res: Response) => {
|
|
await createProtocolAgendaById(req, res);
|
|
}
|
|
);
|
|
|
|
router.post(
|
|
"/:protocolId/decision",
|
|
PermissionHelper.passCheckMiddleware("create", "club", "protocol"),
|
|
async (req: Request, res: Response) => {
|
|
await createProtocolDecisonsById(req, res);
|
|
}
|
|
);
|
|
|
|
router.post(
|
|
"/:protocolId/voting",
|
|
PermissionHelper.passCheckMiddleware("create", "club", "protocol"),
|
|
async (req: Request, res: Response) => {
|
|
await createProtocolVotingsById(req, res);
|
|
}
|
|
);
|
|
|
|
router.post(
|
|
"/:protocolId/printout",
|
|
PermissionHelper.passCheckMiddleware("create", "club", "protocol"),
|
|
async (req: Request, res: Response) => {
|
|
await createProtocolPrintoutById(req, res);
|
|
}
|
|
);
|
|
|
|
router.patch(
|
|
"/:id/synchronize",
|
|
PermissionHelper.passCheckMiddleware("update", "club", "protocol"),
|
|
async (req: Request, res: Response) => {
|
|
await synchronizeProtocolById(req, res);
|
|
}
|
|
);
|
|
|
|
router.patch(
|
|
"/:protocolId/synchronize/agenda",
|
|
PermissionHelper.passCheckMiddleware("update", "club", "protocol"),
|
|
async (req: Request, res: Response) => {
|
|
await synchronizeProtocolAgendaById(req, res);
|
|
}
|
|
);
|
|
|
|
router.patch(
|
|
"/:protocolId/synchronize/decisions",
|
|
PermissionHelper.passCheckMiddleware("update", "club", "protocol"),
|
|
async (req: Request, res: Response) => {
|
|
await synchronizeProtocolDecisonsById(req, res);
|
|
}
|
|
);
|
|
|
|
router.patch(
|
|
"/:protocolId/synchronize/votings",
|
|
PermissionHelper.passCheckMiddleware("update", "club", "protocol"),
|
|
async (req: Request, res: Response) => {
|
|
await synchronizeProtocolVotingsById(req, res);
|
|
}
|
|
);
|
|
|
|
router.put(
|
|
"/:protocolId/synchronize/presence",
|
|
PermissionHelper.passCheckMiddleware("update", "club", "protocol"),
|
|
async (req: Request, res: Response) => {
|
|
await synchronizeProtocolPrecenseById(req, res);
|
|
}
|
|
);
|
|
|
|
export default router;
|