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 {
listOrgsHandler,
updateOrgHandler,
} from "./organization.controller";
import { hideFields } from "../auth";
export default function organizationRoutes(fastify: FastifyInstance) {
fastify.post(
@@ -14,9 +15,6 @@ export default function organizationRoutes(fastify: FastifyInstance) {
{
schema: {
body: $org("createOrgInput"),
response: {
201: $org("createOrgResponse"),
},
},
config: { requiredClaims: ["org:write"] },
preHandler: [fastify.authorize],
@@ -46,7 +44,6 @@ export default function organizationRoutes(fastify: FastifyInstance) {
{
schema: {
querystring: $org("pageQueryParams"),
response: { 200: $org("listOrgResponse") },
},
config: { requiredClaims: ["org:read"] },
preHandler: [fastify.authorize],
@@ -60,9 +57,6 @@ export default function organizationRoutes(fastify: FastifyInstance) {
schema: {
params: { type: "object", properties: { orgId: { type: "string" } } },
body: $org("updateOrgInput"),
response: {
200: $org("createOrgResponse"),
},
},
config: { requiredClaims: ["org:write"] },
preHandler: [fastify.authorize],
@@ -81,4 +75,6 @@ export default function organizationRoutes(fastify: FastifyInstance) {
},
deleteOrgHandler
);
fastify.addHook("onSend", hideFields("orgs"));
}