cleanup incidents

This commit is contained in:
Alex Holliday committed 2026-02-17 19:39:24 +00:00
1 parent 0032765bd1
commit cddf8b32e6
6 files changed
+25 -1

No files matched your search

@@ -281,5 +281,11 @@ class MongoIncidentRepository implements IIncidentsRepository {
});
return result.deletedCount || 0;
};
deleteByMonitorIdsNotIn = async (monitorIds: string[]): Promise<number> => {
const objectIds = monitorIds.map((id) => new mongoose.Types.ObjectId(id));
const result = await IncidentModel.deleteMany({ monitorId: { $nin: objectIds } });
return result.deletedCount ?? 0;
};
}
export default MongoIncidentRepository;