59 lines
1.4 KiB
TypeScript
59 lines
1.4 KiB
TypeScript
import type { Express } from "express";
|
|
import { requireAuth } from "../middleware/auth.middleware.js";
|
|
import { routeHitMiddleware } from "../middleware/routeHit.middleware.js";
|
|
import manual from "./notification.manualTrigger.js";
|
|
import getNotifications from "./notification.route.js";
|
|
import updateNote from "./notification.update.route.js";
|
|
import deleteSub from "./notificationSub.delete.route.js";
|
|
import subs from "./notificationSub.get.route.js";
|
|
import newSub from "./notificationSub.post.route.js";
|
|
import updateSub from "./notificationSub.update.route.js";
|
|
|
|
export const setupNotificationRoutes = (baseUrl: string, app: Express) => {
|
|
//stats will be like this as we dont need to change this
|
|
app.use(
|
|
`${baseUrl}/api/notification`,
|
|
requireAuth,
|
|
routeHitMiddleware,
|
|
getNotifications,
|
|
);
|
|
app.use(
|
|
`${baseUrl}/api/notification`,
|
|
requireAuth,
|
|
routeHitMiddleware,
|
|
updateNote,
|
|
);
|
|
app.use(
|
|
`${baseUrl}/api/notification/manual`,
|
|
requireAuth,
|
|
routeHitMiddleware,
|
|
manual,
|
|
);
|
|
app.use(
|
|
`${baseUrl}/api/notification/sub`,
|
|
requireAuth,
|
|
routeHitMiddleware,
|
|
subs,
|
|
);
|
|
app.use(
|
|
`${baseUrl}/api/notification/sub`,
|
|
requireAuth,
|
|
routeHitMiddleware,
|
|
newSub,
|
|
);
|
|
app.use(
|
|
`${baseUrl}/api/notification/sub`,
|
|
requireAuth,
|
|
routeHitMiddleware,
|
|
updateSub,
|
|
);
|
|
app.use(
|
|
`${baseUrl}/api/notification/sub`,
|
|
requireAuth,
|
|
routeHitMiddleware,
|
|
deleteSub,
|
|
);
|
|
|
|
// all other system should be under /api/system/*
|
|
};
|