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