add notes routes to processed
This commit is contained in:
@@ -1,21 +1,22 @@
|
||||
import { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
|
||||
import { PageQueryParams } from "../pagination";
|
||||
import { FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
|
||||
import { PageQueryParams } from '../pagination';
|
||||
import {
|
||||
getProcessedPermit,
|
||||
getUniqueValuesProcessed,
|
||||
listProcessedPermits,
|
||||
updateProcessed,
|
||||
} from "./processed.service";
|
||||
import { $processed, UpdateProcessedInput } from "./processed.schema";
|
||||
} from './processed.service';
|
||||
import { $processed, UpdateProcessedInput } from './processed.schema';
|
||||
import { noteRoutes } from '../note/note.route';
|
||||
|
||||
export async function processedRoutes(fastify: FastifyInstance) {
|
||||
fastify.get(
|
||||
"/",
|
||||
'/',
|
||||
{
|
||||
schema: {
|
||||
querystring: $processed("pageQueryParams"),
|
||||
querystring: $processed('pageQueryParams'),
|
||||
},
|
||||
config: { requiredClaims: ["permit:read"] },
|
||||
config: { requiredClaims: ['permit:read'] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
async (req: FastifyRequest, res: FastifyReply) => {
|
||||
@@ -31,12 +32,12 @@ export async function processedRoutes(fastify: FastifyInstance) {
|
||||
);
|
||||
|
||||
fastify.get(
|
||||
"/search",
|
||||
'/search',
|
||||
{
|
||||
schema: {
|
||||
querystring: $processed("pageQueryParams"),
|
||||
querystring: $processed('pageQueryParams'),
|
||||
},
|
||||
config: { requiredClaims: ["permit:read"] },
|
||||
config: { requiredClaims: ['permit:read'] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
async (req: FastifyRequest, res: FastifyReply) => {
|
||||
@@ -52,15 +53,15 @@ export async function processedRoutes(fastify: FastifyInstance) {
|
||||
);
|
||||
|
||||
fastify.get(
|
||||
"/:permitId",
|
||||
'/:permitId',
|
||||
{
|
||||
schema: {
|
||||
params: {
|
||||
type: "object",
|
||||
properties: { permitId: { type: "string" } },
|
||||
type: 'object',
|
||||
properties: { permitId: { type: 'string' } },
|
||||
},
|
||||
},
|
||||
config: { requiredClaims: ["permit:read"] },
|
||||
config: { requiredClaims: ['permit:read'] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
async (req: FastifyRequest, res: FastifyReply) => {
|
||||
@@ -76,16 +77,16 @@ export async function processedRoutes(fastify: FastifyInstance) {
|
||||
);
|
||||
|
||||
fastify.patch(
|
||||
"/:permitId",
|
||||
'/:permitId',
|
||||
{
|
||||
schema: {
|
||||
params: {
|
||||
type: "object",
|
||||
properties: { permitId: { type: "string" } },
|
||||
type: 'object',
|
||||
properties: { permitId: { type: 'string' } },
|
||||
},
|
||||
body: $processed("updateProcessedInput"),
|
||||
body: $processed('updateProcessedInput'),
|
||||
},
|
||||
config: { requiredClaims: ["permit:write"] },
|
||||
config: { requiredClaims: ['permit:write'] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
async (req: FastifyRequest, res: FastifyReply) => {
|
||||
@@ -102,17 +103,17 @@ export async function processedRoutes(fastify: FastifyInstance) {
|
||||
);
|
||||
|
||||
fastify.get(
|
||||
"/fields/:field",
|
||||
'/fields/:field',
|
||||
{
|
||||
schema: {
|
||||
params: {
|
||||
type: "object",
|
||||
type: 'object',
|
||||
properties: {
|
||||
field: { type: "string" },
|
||||
field: { type: 'string' },
|
||||
},
|
||||
},
|
||||
},
|
||||
config: { requiredClaims: ["permit:read"] },
|
||||
config: { requiredClaims: ['permit:read'] },
|
||||
preHandler: [fastify.authorize],
|
||||
},
|
||||
async (req: FastifyRequest, res: FastifyReply) => {
|
||||
@@ -129,4 +130,10 @@ export async function processedRoutes(fastify: FastifyInstance) {
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
await noteRoutes(fastify, {
|
||||
read: 'permit:read',
|
||||
write: 'permit:write',
|
||||
delete: 'permit:delete',
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user