Schema changes

This commit is contained in:
2024-12-23 18:21:24 +05:30
parent 6c1399ddd4
commit ca8659fdef
3 changed files with 32 additions and 16 deletions

View File

@@ -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",

View File

@@ -34,9 +34,6 @@ export async function permitRoutes(fastify: FastifyInstance) {
permitId: { type: "string" },
},
},
response: {
200: $permit("getPermitResponse"),
},
},
config: { requiredClaims: ["permit:read"] },
preHandler: [fastify.authorize],

View File

@@ -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({
county: z
.object({
name: z.string(),
avatar: z.string().optional(),
}),
client: z.object({
})
.optional(),
client: z
.object({
name: z.string(),
avatar: z.string().optional(),
}),
assignedTo: z.object({
})
.optional(),
assignedTo: z
.object({
name: z.string(),
avatar: z.string().optional(),
}),
})
.optional(),
});
const listPermitResponse = z.object({