Schema changes
This commit is contained in:
@@ -31,7 +31,7 @@ export const orgModel = mongoose.model(
|
||||
const orgCore = {
|
||||
_id: z.string().optional(),
|
||||
name: z.string().max(30),
|
||||
domain: z.string().max(30),
|
||||
domain: z.string().max(30).optional(),
|
||||
avatar: z.string().url().optional(),
|
||||
type: z.enum(["county", "builder"], {
|
||||
message: "Must be county or builder",
|
||||
|
||||
@@ -34,9 +34,6 @@ export async function permitRoutes(fastify: FastifyInstance) {
|
||||
permitId: { type: "string" },
|
||||
},
|
||||
},
|
||||
response: {
|
||||
200: $permit("getPermitResponse"),
|
||||
},
|
||||
},
|
||||
config: { requiredClaims: ["permit:read"] },
|
||||
preHandler: [fastify.authorize],
|
||||
|
||||
@@ -30,6 +30,19 @@ export const permitModel = mongoose.model(
|
||||
type: mongoose.Types.ObjectId,
|
||||
ref: "user",
|
||||
},
|
||||
link: String,
|
||||
address: String,
|
||||
recordType: String,
|
||||
description: String,
|
||||
applicationDetails: Object,
|
||||
applicationInfo: Object,
|
||||
applicationInfoTable: Object,
|
||||
conditions: Array,
|
||||
ownerDetails: String,
|
||||
parcelInfo: Object,
|
||||
paymentData: Object,
|
||||
professionalsList: Array,
|
||||
inspections: Object,
|
||||
createdAt: Date,
|
||||
updatedAt: Date,
|
||||
createdBy: String,
|
||||
@@ -58,18 +71,24 @@ const createPermitResponse = z.object({
|
||||
const getPermitResponse = z.object({
|
||||
pid: z.string(),
|
||||
...permitCore,
|
||||
county: z.object({
|
||||
name: z.string(),
|
||||
avatar: z.string().optional(),
|
||||
}),
|
||||
client: z.object({
|
||||
name: z.string(),
|
||||
avatar: z.string().optional(),
|
||||
}),
|
||||
assignedTo: z.object({
|
||||
name: z.string(),
|
||||
avatar: z.string().optional(),
|
||||
}),
|
||||
county: z
|
||||
.object({
|
||||
name: z.string(),
|
||||
avatar: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
client: z
|
||||
.object({
|
||||
name: z.string(),
|
||||
avatar: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
assignedTo: z
|
||||
.object({
|
||||
name: z.string(),
|
||||
avatar: z.string().optional(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
|
||||
const listPermitResponse = z.object({
|
||||
|
||||
Reference in New Issue
Block a user