add notification routes
This commit is contained in:
33
src/notification/notification.route.ts
Normal file
33
src/notification/notification.route.ts
Normal 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
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user