remove incidents on delete

This commit is contained in:
Alex Holliday committed 2026-02-17 18:30:22 +00:00
1 parent af8083bdaa
commit 97750da889
5 files changed
+49 -1

No files matched your search

@@ -23,5 +23,6 @@ export interface IIncidentsRepository {
// update
updateById(incidentId: string, teamId: string, updateData: Partial<Incident>): Promise<Incident>;
// delete
deleteByMonitorId(monitorId: string, teamId: string): Promise<number>;
// other
}
@@ -273,5 +273,13 @@ class MongoIncidentRepository implements IIncidentsRepository {
})),
};
};
deleteByMonitorId = async (monitorId: string, teamId: string) => {
const result = await IncidentModel.deleteMany({
monitorId: new mongoose.Types.ObjectId(monitorId),
teamId: new mongoose.Types.ObjectId(teamId),
});
return result.deletedCount || 0;
};
}
export default MongoIncidentRepository;