router registration
This commit is contained in:
parent
ddb355836a
commit
b19cd97a01
8 changed files with 43 additions and 6 deletions
|
@ -33,3 +33,5 @@ router.patch("/:id", async (req: Request, res: Response) => {
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete("/:id", async (req: Request, res: Response) => {
|
||||||
await deleteAward(req, res);
|
await deleteAward(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
|
|
|
@ -14,14 +14,14 @@ router.get("/", async (req: Request, res: Response) => {
|
||||||
await getAllCommunicationTypes(req, res);
|
await getAllCommunicationTypes(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
router.get("/:id", async (req: Request, res: Response) => {
|
|
||||||
await getCommunicationTypeById(req, res);
|
|
||||||
});
|
|
||||||
|
|
||||||
router.get("/fields", async (req: Request, res: Response) => {
|
router.get("/fields", async (req: Request, res: Response) => {
|
||||||
await getCommunicationTypeAvailableColumns(req, res);
|
await getCommunicationTypeAvailableColumns(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.get("/:id", async (req: Request, res: Response) => {
|
||||||
|
await getCommunicationTypeById(req, res);
|
||||||
|
});
|
||||||
|
|
||||||
router.post("/", async (req: Request, res: Response) => {
|
router.post("/", async (req: Request, res: Response) => {
|
||||||
await createCommunicationType(req, res);
|
await createCommunicationType(req, res);
|
||||||
});
|
});
|
||||||
|
@ -33,3 +33,5 @@ router.patch("/:id", async (req: Request, res: Response) => {
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete("/:id", async (req: Request, res: Response) => {
|
||||||
await deleteCommunicationType(req, res);
|
await deleteCommunicationType(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
|
|
|
@ -33,3 +33,5 @@ router.patch("/:id", async (req: Request, res: Response) => {
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete("/:id", async (req: Request, res: Response) => {
|
||||||
await deleteExecutivePosition(req, res);
|
await deleteExecutivePosition(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
|
|
|
@ -1,11 +1,35 @@
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import PermissionHelper from "../../helpers/permissionHelper";
|
import PermissionHelper from "../../helpers/permissionHelper";
|
||||||
|
|
||||||
|
import award from "./award";
|
||||||
|
import communicationType from "./communicationType";
|
||||||
|
import executivePosition from "./executivePosition";
|
||||||
|
import membershipStatus from "./membershipStatus";
|
||||||
|
import qualification from "./qualification";
|
||||||
|
|
||||||
import role from "./role";
|
import role from "./role";
|
||||||
import user from "./user";
|
import user from "./user";
|
||||||
|
|
||||||
var router = express.Router({ mergeParams: true });
|
var router = express.Router({ mergeParams: true });
|
||||||
|
|
||||||
|
router.use("/award", PermissionHelper.passCheckMiddleware("read", "settings", "award"), award);
|
||||||
|
router.use(
|
||||||
|
"/communicationtype",
|
||||||
|
PermissionHelper.passCheckMiddleware("read", "settings", "communication"),
|
||||||
|
communicationType
|
||||||
|
);
|
||||||
|
router.use(
|
||||||
|
"/executiveposition",
|
||||||
|
PermissionHelper.passCheckMiddleware("read", "settings", "executive_position"),
|
||||||
|
executivePosition
|
||||||
|
);
|
||||||
|
router.use(
|
||||||
|
"/membershipstatus",
|
||||||
|
PermissionHelper.passCheckMiddleware("read", "settings", "membership_status"),
|
||||||
|
membershipStatus
|
||||||
|
);
|
||||||
|
router.use("/qualification", PermissionHelper.passCheckMiddleware("read", "settings", "qualification"), qualification);
|
||||||
|
|
||||||
router.use("/role", PermissionHelper.passCheckMiddleware("read", "user", "role"), role);
|
router.use("/role", PermissionHelper.passCheckMiddleware("read", "user", "role"), role);
|
||||||
router.use("/user", PermissionHelper.passCheckMiddleware("read", "user", "user"), user);
|
router.use("/user", PermissionHelper.passCheckMiddleware("read", "user", "user"), user);
|
||||||
|
|
||||||
|
|
|
@ -33,3 +33,5 @@ router.patch("/:id", async (req: Request, res: Response) => {
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete("/:id", async (req: Request, res: Response) => {
|
||||||
await deleteMembershipStatus(req, res);
|
await deleteMembershipStatus(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
|
|
|
@ -33,3 +33,5 @@ router.patch("/:id", async (req: Request, res: Response) => {
|
||||||
router.delete("/:id", async (req: Request, res: Response) => {
|
router.delete("/:id", async (req: Request, res: Response) => {
|
||||||
await deleteQualification(req, res);
|
await deleteQualification(req, res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
|
|
|
@ -28,6 +28,7 @@ export default abstract class CommunicationService {
|
||||||
*/
|
*/
|
||||||
static getAvailableColumnsForCommunication(): Array<string> {
|
static getAvailableColumnsForCommunication(): Array<string> {
|
||||||
let metadata = dataSource.getMetadata(communication);
|
let metadata = dataSource.getMetadata(communication);
|
||||||
return metadata.columns.map((c) => c.propertyName);
|
let columns = metadata.columns.map((c) => c.propertyName);
|
||||||
|
return columns.filter((c) => !["id", "preffered", "type"].includes(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ export type PermissionModule =
|
||||||
| "award"
|
| "award"
|
||||||
| "executive_position"
|
| "executive_position"
|
||||||
| "communication"
|
| "communication"
|
||||||
|
| "membership_status"
|
||||||
| "user"
|
| "user"
|
||||||
| "role";
|
| "role";
|
||||||
|
|
||||||
|
@ -43,12 +44,13 @@ export const permissionModules: Array<PermissionModule> = [
|
||||||
"award",
|
"award",
|
||||||
"executive_position",
|
"executive_position",
|
||||||
"communication",
|
"communication",
|
||||||
|
"membership_status",
|
||||||
"user",
|
"user",
|
||||||
"role",
|
"role",
|
||||||
];
|
];
|
||||||
export const permissionTypes: Array<PermissionType> = ["read", "create", "update", "delete"];
|
export const permissionTypes: Array<PermissionType> = ["read", "create", "update", "delete"];
|
||||||
export const sectionsAndModules: SectionsAndModulesObject = {
|
export const sectionsAndModules: SectionsAndModulesObject = {
|
||||||
club: ["members", "calendar", "newsletter", "protocoll"],
|
club: ["members", "calendar", "newsletter", "protocoll"],
|
||||||
settings: ["qualification", "award", "executive_position", "communication"],
|
settings: ["qualification", "award", "executive_position", "communication", "membership_status"],
|
||||||
user: ["user", "role"],
|
user: ["user", "role"],
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue