added notification deletion to pasco script
This commit is contained in:
@@ -134,6 +134,16 @@ const processedModel = mongoose.model(
|
|||||||
"processed"
|
"processed"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const notifModel = mongoose.model(
|
||||||
|
"notification",
|
||||||
|
new mongoose.Schema(
|
||||||
|
{
|
||||||
|
createdAt: Date,
|
||||||
|
},
|
||||||
|
{ strict: false }
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
console.log(new Date().toISOString() + " Started Pasco Archive script...");
|
console.log(new Date().toISOString() + " Started Pasco Archive script...");
|
||||||
|
|
||||||
@@ -182,5 +192,11 @@ const processedModel = mongoose.model(
|
|||||||
|
|
||||||
console.log(`${count} permits archived`);
|
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();
|
await mongoose.connection.close();
|
||||||
})().catch((err) => console.log(err));
|
})().catch((err) => console.log(err));
|
||||||
|
|||||||
Reference in New Issue
Block a user