route permissions
This commit is contained in:
parent
cc763001a5
commit
80b1b5cf62
6 changed files with 237 additions and 99 deletions
|
@ -6,6 +6,7 @@ import {
|
||||||
getAwardById,
|
getAwardById,
|
||||||
updateAward,
|
updateAward,
|
||||||
} from "../../controller/admin/awardController";
|
} from "../../controller/admin/awardController";
|
||||||
|
import PermissionHelper from "../../helpers/permissionHelper";
|
||||||
|
|
||||||
var router = express.Router({ mergeParams: true });
|
var router = express.Router({ mergeParams: true });
|
||||||
|
|
||||||
|
@ -17,16 +18,28 @@ router.get("/:id", async (req: Request, res: Response) => {
|
||||||
await getAwardById(req, res);
|
await getAwardById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post("/", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await createAward(req, res);
|
"/",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "settings", "award"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await createAward(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:id", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateAward(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "settings", "award"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateAward(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteAward(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "settings", "award"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteAward(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {
|
||||||
getCommunicationTypeById,
|
getCommunicationTypeById,
|
||||||
updateCommunicationType,
|
updateCommunicationType,
|
||||||
} from "../../controller/admin/communicationTypeController";
|
} from "../../controller/admin/communicationTypeController";
|
||||||
|
import PermissionHelper from "../../helpers/permissionHelper";
|
||||||
|
|
||||||
var router = express.Router({ mergeParams: true });
|
var router = express.Router({ mergeParams: true });
|
||||||
|
|
||||||
|
@ -22,16 +23,28 @@ router.get("/:id", async (req: Request, res: Response) => {
|
||||||
await getCommunicationTypeById(req, res);
|
await getCommunicationTypeById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post("/", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await createCommunicationType(req, res);
|
"/",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "settings", "communication"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await createCommunicationType(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:id", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateCommunicationType(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "settings", "communication"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateCommunicationType(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteCommunicationType(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "settings", "communication"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteCommunicationType(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
getExecutivePositionById,
|
getExecutivePositionById,
|
||||||
updateExecutivePosition,
|
updateExecutivePosition,
|
||||||
} from "../../controller/admin/executivePositionController";
|
} from "../../controller/admin/executivePositionController";
|
||||||
|
import PermissionHelper from "../../helpers/permissionHelper";
|
||||||
|
|
||||||
var router = express.Router({ mergeParams: true });
|
var router = express.Router({ mergeParams: true });
|
||||||
|
|
||||||
|
@ -17,16 +18,28 @@ router.get("/:id", async (req: Request, res: Response) => {
|
||||||
await getExecutivePositionById(req, res);
|
await getExecutivePositionById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post("/", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await createExecutivePosition(req, res);
|
"/",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "settings", "executive_position"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await createExecutivePosition(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:id", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateExecutivePosition(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "settings", "executive_position"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateExecutivePosition(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteExecutivePosition(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "settings", "executive_position"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteExecutivePosition(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
@ -26,6 +26,7 @@ import {
|
||||||
updateMembershipOfMember,
|
updateMembershipOfMember,
|
||||||
updateQualificationOfMember,
|
updateQualificationOfMember,
|
||||||
} from "../../controller/admin/memberController";
|
} from "../../controller/admin/memberController";
|
||||||
|
import PermissionHelper from "../../helpers/permissionHelper";
|
||||||
|
|
||||||
var router = express.Router({ mergeParams: true });
|
var router = express.Router({ mergeParams: true });
|
||||||
|
|
||||||
|
@ -57,76 +58,148 @@ router.get("/:memberId/communications", async (req: Request, res: Response) => {
|
||||||
await getCommunicationsByMember(req, res);
|
await getCommunicationsByMember(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post("/", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await createMember(req, res);
|
"/",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await createMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.post("/:memberId/membership", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await addMembershipToMember(req, res);
|
"/:memberId/membership",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await addMembershipToMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.post("/:memberId/award", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await addAwardToMember(req, res);
|
"/:memberId/award",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await addAwardToMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.post("/:memberId/qualification", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await addQualificationToMember(req, res);
|
"/:memberId/qualification",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await addQualificationToMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.post("/:memberId/position", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await addExecutivePositionToMember(req, res);
|
"/:memberId/position",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await addExecutivePositionToMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.post("/:memberId/communication", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await addCommunicationToMember(req, res);
|
"/:memberId/communication",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await addCommunicationToMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:id", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateMemberById(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateMemberById(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:memberId/membership/:recordId", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateMembershipOfMember(req, res);
|
"/:memberId/membership/:recordId",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateMembershipOfMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:memberId/award/:recordId", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateAwardOfMember(req, res);
|
"/:memberId/award/:recordId",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateAwardOfMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:memberId/qualification/:recordId", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateQualificationOfMember(req, res);
|
"/:memberId/qualification/:recordId",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateQualificationOfMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:memberId/position/:recordId", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateExecutivePositionOfMember(req, res);
|
"/:memberId/position/:recordId",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateExecutivePositionOfMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:memberId/communication/:recordId", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateCommunicationOfMember(req, res);
|
"/:memberId/communication/:recordId",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateCommunicationOfMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteMemberById(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteMemberById(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:memberId/membership/:recordId", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteMembershipOfMember(req, res);
|
"/:memberId/membership/:recordId",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteMembershipOfMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:memberId/award/:recordId", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteAwardOfMember(req, res);
|
"/:memberId/award/:recordId",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteAwardOfMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:memberId/qualification/:recordId", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteQualificationOfMember(req, res);
|
"/:memberId/qualification/:recordId",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteQualificationOfMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:memberId/position/:recordId", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteExecutivePositionOfMember(req, res);
|
"/:memberId/position/:recordId",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteExecutivePositionOfMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:memberId/communication/:recordId", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteCommunicationOfMember(req, res);
|
"/:memberId/communication/:recordId",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "club", "member"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteCommunicationOfMember(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
getMembershipStatusById,
|
getMembershipStatusById,
|
||||||
updateMembershipStatus,
|
updateMembershipStatus,
|
||||||
} from "../../controller/admin/membershipStatusController";
|
} from "../../controller/admin/membershipStatusController";
|
||||||
|
import PermissionHelper from "../../helpers/permissionHelper";
|
||||||
|
|
||||||
var router = express.Router({ mergeParams: true });
|
var router = express.Router({ mergeParams: true });
|
||||||
|
|
||||||
|
@ -17,16 +18,28 @@ router.get("/:id", async (req: Request, res: Response) => {
|
||||||
await getMembershipStatusById(req, res);
|
await getMembershipStatusById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post("/", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await createMembershipStatus(req, res);
|
"/",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "settings", "membership_status"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await createMembershipStatus(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:id", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateMembershipStatus(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "settings", "membership_status"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateMembershipStatus(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteMembershipStatus(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "settings", "membership_status"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteMembershipStatus(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
getQualificationById,
|
getQualificationById,
|
||||||
updateQualification,
|
updateQualification,
|
||||||
} from "../../controller/admin/qualificationController";
|
} from "../../controller/admin/qualificationController";
|
||||||
|
import PermissionHelper from "../../helpers/permissionHelper";
|
||||||
|
|
||||||
var router = express.Router({ mergeParams: true });
|
var router = express.Router({ mergeParams: true });
|
||||||
|
|
||||||
|
@ -17,16 +18,28 @@ router.get("/:id", async (req: Request, res: Response) => {
|
||||||
await getQualificationById(req, res);
|
await getQualificationById(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post("/", async (req: Request, res: Response) => {
|
router.post(
|
||||||
await createQualification(req, res);
|
"/",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("create", "settings", "qualification"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await createQualification(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.patch("/:id", async (req: Request, res: Response) => {
|
router.patch(
|
||||||
await updateQualification(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("update", "settings", "qualification"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await updateQualification(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete(
|
||||||
await deleteQualification(req, res);
|
"/:id",
|
||||||
});
|
PermissionHelper.passCheckMiddleware("delete", "settings", "qualification"),
|
||||||
|
async (req: Request, res: Response) => {
|
||||||
|
await deleteQualification(req, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|
Loading…
Reference in a new issue