router registration

This commit is contained in:
Julian Krauser 2024-09-04 14:24:30 +02:00
parent ddb355836a
commit b19cd97a01
8 changed files with 43 additions and 6 deletions

View file

@ -33,3 +33,5 @@ router.patch("/:id", async (req: Request, res: Response) => {
router.delete("/:id", async (req: Request, res: Response) => {
await deleteAward(req, res);
});
export default router;

View file

@ -14,14 +14,14 @@ router.get("/", async (req: Request, res: Response) => {
await getAllCommunicationTypes(req, res);
});
router.get("/:id", async (req: Request, res: Response) => {
await getCommunicationTypeById(req, res);
});
router.get("/fields", async (req: Request, res: Response) => {
await getCommunicationTypeAvailableColumns(req, res);
});
router.get("/:id", async (req: Request, res: Response) => {
await getCommunicationTypeById(req, res);
});
router.post("/", async (req: Request, res: Response) => {
await createCommunicationType(req, res);
});
@ -33,3 +33,5 @@ router.patch("/:id", async (req: Request, res: Response) => {
router.delete("/:id", async (req: Request, res: Response) => {
await deleteCommunicationType(req, res);
});
export default router;

View file

@ -33,3 +33,5 @@ router.patch("/:id", async (req: Request, res: Response) => {
router.delete("/:id", async (req: Request, res: Response) => {
await deleteExecutivePosition(req, res);
});
export default router;

View file

@ -1,11 +1,35 @@
import express from "express";
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 user from "./user";
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("/user", PermissionHelper.passCheckMiddleware("read", "user", "user"), user);

View file

@ -33,3 +33,5 @@ router.patch("/:id", async (req: Request, res: Response) => {
router.delete("/:id", async (req: Request, res: Response) => {
await deleteMembershipStatus(req, res);
});
export default router;

View file

@ -33,3 +33,5 @@ router.patch("/:id", async (req: Request, res: Response) => {
router.delete("/:id", async (req: Request, res: Response) => {
await deleteQualification(req, res);
});
export default router;

View file

@ -28,6 +28,7 @@ export default abstract class CommunicationService {
*/
static getAvailableColumnsForCommunication(): Array<string> {
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));
}
}

View file

@ -9,6 +9,7 @@ export type PermissionModule =
| "award"
| "executive_position"
| "communication"
| "membership_status"
| "user"
| "role";
@ -43,12 +44,13 @@ export const permissionModules: Array<PermissionModule> = [
"award",
"executive_position",
"communication",
"membership_status",
"user",
"role",
];
export const permissionTypes: Array<PermissionType> = ["read", "create", "update", "delete"];
export const sectionsAndModules: SectionsAndModulesObject = {
club: ["members", "calendar", "newsletter", "protocoll"],
settings: ["qualification", "award", "executive_position", "communication"],
settings: ["qualification", "award", "executive_position", "communication", "membership_status"],
user: ["user", "role"],
};