#3-calendar #11
2 changed files with 74 additions and 31 deletions
|
@ -11,47 +11,88 @@ import {
|
|||
deleteCalendarItem,
|
||||
deleteCalendarType,
|
||||
} from "../../controller/admin/calendarController";
|
||||
import PermissionHelper from "../../helpers/permissionHelper";
|
||||
|
||||
var router = express.Router({ mergeParams: true });
|
||||
|
||||
router.get("/items", async (req: Request, res: Response) => {
|
||||
router.get(
|
||||
"/items",
|
||||
PermissionHelper.passCheckMiddleware("read", "club", "calendar"),
|
||||
async (req: Request, res: Response) => {
|
||||
await getAllCalendarItems(req, res);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
router.get("/item/:id", async (req: Request, res: Response) => {
|
||||
router.get(
|
||||
"/item/:id",
|
||||
PermissionHelper.passCheckMiddleware("read", "club", "calendar"),
|
||||
async (req: Request, res: Response) => {
|
||||
await getCalendarItemById(req, res);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
router.get("/types", async (req: Request, res: Response) => {
|
||||
router.get(
|
||||
"/types",
|
||||
PermissionHelper.passCheckMiddleware("read", "settings", "calendar_type"),
|
||||
async (req: Request, res: Response) => {
|
||||
await getAllCalendarTypes(req, res);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
router.get("/type/:id", async (req: Request, res: Response) => {
|
||||
router.get(
|
||||
"/type/:id",
|
||||
PermissionHelper.passCheckMiddleware("read", "settings", "calendar_type"),
|
||||
async (req: Request, res: Response) => {
|
||||
await getCalendarTypeById(req, res);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
router.post("/item", async (req: Request, res: Response) => {
|
||||
router.post(
|
||||
"/item",
|
||||
PermissionHelper.passCheckMiddleware("create", "club", "calendar"),
|
||||
async (req: Request, res: Response) => {
|
||||
await createCalendarItem(req, res);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
router.post("/type", async (req: Request, res: Response) => {
|
||||
router.post(
|
||||
"/type",
|
||||
PermissionHelper.passCheckMiddleware("create", "settings", "calendar_type"),
|
||||
async (req: Request, res: Response) => {
|
||||
await createCalendarType(req, res);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
router.patch("/item/:id", async (req: Request, res: Response) => {
|
||||
router.patch(
|
||||
"/item/:id",
|
||||
PermissionHelper.passCheckMiddleware("update", "club", "calendar"),
|
||||
async (req: Request, res: Response) => {
|
||||
await updateCalendarItem(req, res);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
router.patch("/type/:id", async (req: Request, res: Response) => {
|
||||
router.patch(
|
||||
"/type/:id",
|
||||
PermissionHelper.passCheckMiddleware("update", "settings", "calendar_type"),
|
||||
async (req: Request, res: Response) => {
|
||||
await updateCalendarType(req, res);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
router.delete("/item/:id", async (req: Request, res: Response) => {
|
||||
router.delete(
|
||||
"/item/:id",
|
||||
PermissionHelper.passCheckMiddleware("delete", "club", "calendar"),
|
||||
async (req: Request, res: Response) => {
|
||||
await deleteCalendarItem(req, res);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
router.delete("/type/:id", async (req: Request, res: Response) => {
|
||||
router.delete(
|
||||
"/type/:id",
|
||||
PermissionHelper.passCheckMiddleware("delete", "settings", "calendar_type"),
|
||||
async (req: Request, res: Response) => {
|
||||
await deleteCalendarType(req, res);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
export default router;
|
||||
|
|
|
@ -10,6 +10,7 @@ export type PermissionModule =
|
|||
| "executive_position"
|
||||
| "communication"
|
||||
| "membership_status"
|
||||
| "calendar_type"
|
||||
| "user"
|
||||
| "role";
|
||||
|
||||
|
@ -45,12 +46,13 @@ export const permissionModules: Array<PermissionModule> = [
|
|||
"executive_position",
|
||||
"communication",
|
||||
"membership_status",
|
||||
"calendar_type",
|
||||
"user",
|
||||
"role",
|
||||
];
|
||||
export const permissionTypes: Array<PermissionType> = ["read", "create", "update", "delete"];
|
||||
export const sectionsAndModules: SectionsAndModulesObject = {
|
||||
club: ["member", "calendar", "newsletter", "protocoll"],
|
||||
settings: ["qualification", "award", "executive_position", "communication", "membership_status"],
|
||||
settings: ["qualification", "award", "executive_position", "communication", "membership_status", "calendar_type"],
|
||||
user: ["user", "role"],
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue