add rts routes

This commit is contained in:
2025-01-21 11:54:09 +05:30
parent 7e3218f84e
commit a54541518c
15 changed files with 653 additions and 28 deletions

View File

@@ -7,6 +7,7 @@ import {
updatePermitHandler,
} from "./permit.controller";
import { $permit } from "./permit.schema";
import { hideFields } from "../auth";
export async function permitRoutes(fastify: FastifyInstance) {
fastify.post(
@@ -14,9 +15,6 @@ export async function permitRoutes(fastify: FastifyInstance) {
{
schema: {
body: $permit("createPermitInput"),
response: {
201: $permit("createPermitResponse"),
},
},
config: { requiredClaims: ["permit:write"] },
preHandler: [fastify.authorize],
@@ -46,9 +44,6 @@ export async function permitRoutes(fastify: FastifyInstance) {
{
schema: {
querystring: $permit("pageQueryParams"),
response: {
200: $permit("listPermitResponse"),
},
},
config: { requiredClaims: ["permit:read"] },
@@ -66,9 +61,6 @@ export async function permitRoutes(fastify: FastifyInstance) {
properties: { permitId: { type: "string" } },
},
body: $permit("updatePermitInput"),
response: {
200: $permit("getPermitResponse"),
},
},
},
updatePermitHandler
@@ -88,4 +80,6 @@ export async function permitRoutes(fastify: FastifyInstance) {
},
deletePermitHandler
);
fastify.addHook("onSend", hideFields("permits"));
}