add archive script, proccessed routes
This commit is contained in:
27
src/processed/processed.route.ts
Normal file
27
src/processed/processed.route.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
||||
import { PageQueryParams } from "../pagination";
|
||||
import { listProcessedPermits } from "./processed.service";
|
||||
import { $processed } from "./processed.schema";
|
||||
|
||||
export async function processedRoutes(fastify: FastifyInstance) {
|
||||
fastify.get(
|
||||
"/",
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user