add /search endpoints

This commit is contained in:
2025-04-26 09:55:47 +05:30
parent e93c2cde96
commit cf569edfe6
5 changed files with 86 additions and 2 deletions

View File

@@ -29,6 +29,27 @@ export async function processedRoutes(fastify: FastifyInstance) {
}
);
fastify.get(
"/search",
{
schema: {
querystring: $processed("pageQueryParams"),
},
config: { requiredClaims: ["permit:read"] },
preHandler: [fastify.authorize],
},
async (req: FastifyRequest, res: FastifyReply) => {
const params = req.query as PageQueryParams;
try {
const permits = await listProcessedPermits(params, req.user.tenantId);
return res.code(200).send(permits);
} catch (err) {
return err;
}
}
);
fastify.get(
"/:permitId",
{