add updatebyids to monitor repository

This commit is contained in:
Alex Holliday committed 2026-05-21 09:59:23 -07:00
1 parent d5dac6b557
commit 8c7b691fda
2 files changed
+7

No files matched your search

@@ -31,6 +31,7 @@ export interface IMonitorsRepository {
// update
updateById(monitorId: string, teamId: string, updates: Partial<Monitor>): Promise<Monitor>;
updateByIds(monitorIds: string[], teamId: string, updates: Partial<Monitor>): Promise<number>;
updateStatusWindowAndChecks(
monitorId: string,
teamId: string,
@@ -190,6 +190,12 @@ class MongoMonitorsRepository implements IMonitorsRepository {
return this.toEntity(updatedMonitor);
};
updateByIds = async (monitorIds: string[], teamId: string, updates: Partial<Monitor>) => {
const objectIds = monitorIds.map((id) => new mongoose.Types.ObjectId(id));
const updated = await MonitorModel.updateMany({ _id: { $in: objectIds }, teamId }, { $set: updates }, { runValidators: true });
return updated.modifiedCount;
};
updateStatusWindowAndChecks = async (
monitorId: string,
teamId: string,