added notification deletion to pasco script

This commit is contained in:
2025-04-09 12:54:33 +05:30
parent efe0bb03fc
commit 8843e1691d

View File

@@ -134,6 +134,16 @@ const processedModel = mongoose.model(
"processed"
);
const notifModel = mongoose.model(
"notification",
new mongoose.Schema(
{
createdAt: Date,
},
{ strict: false }
)
);
(async () => {
console.log(new Date().toISOString() + " Started Pasco Archive script...");
@@ -182,5 +192,11 @@ const processedModel = mongoose.model(
console.log(`${count} permits archived`);
const deletedRecords = await notifModel.deleteMany({
$and: [{ "county.pid": "bibmdcutwwb7e3d" }, { status: "Permit Issued" }],
});
console.log(`${deletedRecords.deletedCount} notifications deleted`);
await mongoose.connection.close();
})().catch((err) => console.log(err));