feat: add noc, deed fields to permits, processed collections
This commit is contained in:
@@ -103,6 +103,8 @@ const permitSchema = new mongoose.Schema({
|
|||||||
startDate: Date,
|
startDate: Date,
|
||||||
history: Array,
|
history: Array,
|
||||||
taggedUsers: Array,
|
taggedUsers: Array,
|
||||||
|
noc: String,
|
||||||
|
deed: String,
|
||||||
}).index({ tenantId: 1, permitNumber: 1 }, { unique: true });
|
}).index({ tenantId: 1, permitNumber: 1 }, { unique: true });
|
||||||
|
|
||||||
export const permitFields = Object.keys(permitSchema.paths).filter(
|
export const permitFields = Object.keys(permitSchema.paths).filter(
|
||||||
@@ -209,6 +211,8 @@ const permitCore = {
|
|||||||
startDate: z.date().nullable().optional(),
|
startDate: z.date().nullable().optional(),
|
||||||
history: z.record(z.any()).optional(),
|
history: z.record(z.any()).optional(),
|
||||||
issued: z.boolean().optional(),
|
issued: z.boolean().optional(),
|
||||||
|
noc: z.string().optional(),
|
||||||
|
deed: z.string().optional(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const createPermitInput = z.object({
|
const createPermitInput = z.object({
|
||||||
@@ -258,6 +262,8 @@ const updatePermitInput = z.object({
|
|||||||
block: z.string().nullable().optional(),
|
block: z.string().nullable().optional(),
|
||||||
jobNumber: z.string().nullable().optional(),
|
jobNumber: z.string().nullable().optional(),
|
||||||
startDate: z.date().nullable().optional(),
|
startDate: z.date().nullable().optional(),
|
||||||
|
noc: z.string().optional(),
|
||||||
|
deed: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type CreatePermitInput = z.infer<typeof createPermitInput>;
|
export type CreatePermitInput = z.infer<typeof createPermitInput>;
|
||||||
|
|||||||
@@ -181,6 +181,8 @@ export async function listPermits(
|
|||||||
startDate: 1,
|
startDate: 1,
|
||||||
history: 1,
|
history: 1,
|
||||||
taggedUsers: 1,
|
taggedUsers: 1,
|
||||||
|
noc: 1,
|
||||||
|
deed: 1,
|
||||||
assignedTo: {
|
assignedTo: {
|
||||||
$let: {
|
$let: {
|
||||||
vars: { assigned: { $arrayElemAt: ["$assignedRec", 0] } },
|
vars: { assigned: { $arrayElemAt: ["$assignedRec", 0] } },
|
||||||
@@ -398,6 +400,8 @@ export async function searchPermit(
|
|||||||
startDate: 1,
|
startDate: 1,
|
||||||
history: 1,
|
history: 1,
|
||||||
taggedUsers: 1,
|
taggedUsers: 1,
|
||||||
|
noc: 1,
|
||||||
|
deed: 1,
|
||||||
assignedTo: {
|
assignedTo: {
|
||||||
$let: {
|
$let: {
|
||||||
vars: { assigned: { $arrayElemAt: ["$assignedRec", 0] } },
|
vars: { assigned: { $arrayElemAt: ["$assignedRec", 0] } },
|
||||||
|
|||||||
@@ -103,6 +103,8 @@ const processedSchema = new mongoose.Schema({
|
|||||||
startDate: Date,
|
startDate: Date,
|
||||||
history: Array,
|
history: Array,
|
||||||
taggedUsers: Array,
|
taggedUsers: Array,
|
||||||
|
noc: String,
|
||||||
|
deed: String,
|
||||||
}).index({ tenantId: 1, permitNumber: 1 }, { unique: true });
|
}).index({ tenantId: 1, permitNumber: 1 }, { unique: true });
|
||||||
|
|
||||||
export const processedFields = Object.keys(processedSchema.paths).filter(
|
export const processedFields = Object.keys(processedSchema.paths).filter(
|
||||||
@@ -124,6 +126,8 @@ const updateProcessedInput = z.object({
|
|||||||
jobNumber: z.string().nullable().optional(),
|
jobNumber: z.string().nullable().optional(),
|
||||||
startDate: z.date().nullable().optional(),
|
startDate: z.date().nullable().optional(),
|
||||||
assignedTo: z.string().nullable().optional(),
|
assignedTo: z.string().nullable().optional(),
|
||||||
|
noc: z.string().optional(),
|
||||||
|
deed: z.string().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type UpdateProcessedInput = z.infer<typeof updateProcessedInput>;
|
export type UpdateProcessedInput = z.infer<typeof updateProcessedInput>;
|
||||||
|
|||||||
@@ -180,6 +180,8 @@ export async function listProcessedPermits(
|
|||||||
block: 1,
|
block: 1,
|
||||||
jobNumber: 1,
|
jobNumber: 1,
|
||||||
taggedUsers: 1,
|
taggedUsers: 1,
|
||||||
|
noc: 1,
|
||||||
|
deed: 1,
|
||||||
assignedTo: {
|
assignedTo: {
|
||||||
$let: {
|
$let: {
|
||||||
vars: { assigned: { $arrayElemAt: ["$assignedRec", 0] } },
|
vars: { assigned: { $arrayElemAt: ["$assignedRec", 0] } },
|
||||||
|
|||||||
Reference in New Issue
Block a user