add rts routes
This commit is contained in:
@@ -60,10 +60,15 @@ export async function updatePermitHandler(
|
||||
const { permitId } = req.params as { permitId: string };
|
||||
|
||||
try {
|
||||
const updatedOrg = await updatePermit(input, permitId, req.user.tenantId);
|
||||
if (!updatedOrg) return res.code(404).send({ error: "resource not found" });
|
||||
const updatedPermit = await updatePermit(
|
||||
input,
|
||||
permitId,
|
||||
req.user.tenantId
|
||||
);
|
||||
if (!updatedPermit)
|
||||
return res.code(404).send({ error: "resource not found" });
|
||||
|
||||
return res.code(200).send(updatedOrg);
|
||||
return res.code(200).send(updatedPermit);
|
||||
} catch (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user