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