UNPKG

@opengis/fastify-table

Version:

core-plugins

24 lines (23 loc) 1.3 kB
import readNotifications from "./controllers/readNotifications.js"; // mark as read import userNotifications from "./controllers/userNotifications.js"; // check all, backend pagination import addUserNotification from "./controllers/addUserNotification.js"; // add user notification import editUserNotification from "./controllers/editUserNotification.js"; // edit unread user notification import deleteUserNotification from "./controllers/deleteUserNotification.js"; // delete user notification const params = { config: { policy: "L1" } }; export default function route(app) { if (!app.hasRoute({ method: "GET", url: "/notification" })) { app.get("/notification", params, userNotifications); } if (!app.hasRoute({ method: "POST", url: "/notification" })) { app.post("/notification", params, addUserNotification); } if (!app.hasRoute({ method: "PUT", url: "/notification/:id" })) { app.put("/notification/:id", params, editUserNotification); } if (!app.hasRoute({ method: "DELETE", url: "/notification/:id" })) { app.delete("/notification/:id", params, deleteUserNotification); } if (!app.hasRoute({ method: "GET", url: "/notification-read/:id?" })) { app.get("/notification-read/:id?", params, readNotifications); } }