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 ); }