add notification routes

This commit is contained in:
2025-02-05 13:52:04 +05:30
parent 8559aab3da
commit 2d62e9712b
8 changed files with 193 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
import { FastifyInstance } from "fastify";
import { $notification } from "./notification.schema";
import {
listNotificationsHandler,
updateNotificationHandler,
} from "./notification.controller";
export async function notificationRoutes(fastify: FastifyInstance) {
fastify.get(
"/",
{
schema: {
querystring: $notification("pageQueryParams"),
},
config: { requiredClaims: ["notification:read"] },
preHandler: [fastify.authorize],
},
listNotificationsHandler
);
fastify.patch(
"/:notifId",
{
schema: {
params: { type: "object", properties: { notifId: { type: "string" } } },
body: $notification("updateNotificationInput"),
},
config: { requiredClaims: ["notification:write"] },
preHandler: [fastify.authorize],
},
updateNotificationHandler
);
}