feat: add address field to metaFields in alerts

This commit is contained in:
2025-12-15 14:19:25 +05:30
parent 7dc3386847
commit 9e7cbfd3d8
5 changed files with 7 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ export const alertsModel = mongoose.model(
client: { type: String, ref: "organization" }, client: { type: String, ref: "organization" },
county: { type: String, ref: "organization" }, county: { type: String, ref: "organization" },
permitType: String, permitType: String,
address: String,
}, },
recipientType: { recipientType: {
type: String, type: String,
@@ -41,6 +42,7 @@ const alertResponse = z.object({
client: z.any().optional(), client: z.any().optional(),
county: z.any().optional(), county: z.any().optional(),
permitType: z.string().optional(), permitType: z.string().optional(),
address: z.string().optional(),
}) })
.optional(), .optional(),
recipientType: z.enum(["user", "team"]), recipientType: z.enum(["user", "team"]),

View File

@@ -15,6 +15,7 @@ export async function createAlert(
client?: String; client?: String;
county?: String; county?: String;
permitType?: String; permitType?: String;
address?: String;
} }
) { ) {
const newAlert = await alertsModel.create({ const newAlert = await alertsModel.create({

View File

@@ -179,6 +179,7 @@ export async function updatePayment(
{ {
client: updatedPayment.client.toString(), client: updatedPayment.client.toString(),
county: updatedPayment.county.id.toString(), county: updatedPayment.county.id.toString(),
address: updatedPayment.address.full_address,
} }
); );
} }

View File

@@ -322,6 +322,7 @@ export async function updatePermit(
{ {
client: updatePermitResult.client.toString(), client: updatePermitResult.client.toString(),
county: updatePermitResult.county.id.toString(), county: updatePermitResult.county.id.toString(),
address: updatePermitResult.address,
} }
); );
} }
@@ -365,6 +366,7 @@ export async function updatePermit(
{ {
client: updatePermitResult.client.toString(), client: updatePermitResult.client.toString(),
county: updatePermitResult.county.id.toString(), county: updatePermitResult.county.id.toString(),
address: updatePermitResult.address.full_address,
} }
); );
} }

View File

@@ -117,6 +117,7 @@ export async function updateProcessed(
{ {
client: updateProcessedResult.client.toString(), client: updateProcessedResult.client.toString(),
county: updateProcessedResult.county.id.toString(), county: updateProcessedResult.county.id.toString(),
address: updateProcessedResult.address.full_address,
} }
); );
} }