Files
worklenz/worklenz-backend/src/routes/apis/gannt-apis/schedule-api-router.ts
2024-05-17 11:04:00 +05:30

23 lines
1.3 KiB
TypeScript

import express, {Request, Response} from "express";
import idParamValidator from "../../../middlewares/validators/id-param-validator";
import safeControllerFunction from "../../../shared/safe-controller-function";
import ScheduleControllerV2 from "../../../controllers/schedule/schedule-controller";
const scheduleApiRouter = express.Router();
function getList(req: Request, res: Response) {
if (ScheduleControllerV2.isTasksOnlyReq(req.query))
return ScheduleControllerV2.getTasksOnly(req, res);
return ScheduleControllerV2.getList(req, res);
}
scheduleApiRouter.get("/chart-dates/:id", idParamValidator, safeControllerFunction(ScheduleControllerV2.createDateRange));
scheduleApiRouter.get("/projects/:id", idParamValidator, safeControllerFunction(ScheduleControllerV2.getProjects));
scheduleApiRouter.get("/project-member/:id", idParamValidator, safeControllerFunction(ScheduleControllerV2.getSingleProjectMember));
scheduleApiRouter.get("/refresh/project-indicator/:id", idParamValidator, safeControllerFunction(ScheduleControllerV2.getSingleProjectIndicator));
scheduleApiRouter.get("/tasks-by-member/:id", idParamValidator, safeControllerFunction(getList));
scheduleApiRouter.put("/bulk/delete-member-allocations", safeControllerFunction(ScheduleControllerV2.deleteMemberAllocations));
export default scheduleApiRouter;