create tags repository, update related repositories
This commit is contained in:
1 parent
a740a9e005
commit
b1871b31a5
5 files changed
+112
-1
No files matched your search
@@ -351,6 +351,10 @@ class MongoMonitorsRepository implements IMonitorsRepository {
|
||||
await MonitorModel.updateMany({ notifications: notificationId }, { $pull: { notifications: notificationId } });
|
||||
};
|
||||
|
||||
removeTagFromMonitors = async (tagId: string): Promise<void> => {
|
||||
await MonitorModel.updateMany({ tags: tagId }, { $pull: { tags: tagId } });
|
||||
};
|
||||
|
||||
updateNotifications = async (
|
||||
teamId: string,
|
||||
monitorIds: string[],
|
||||
@@ -406,7 +410,7 @@ class MongoMonitorsRepository implements IMonitorsRepository {
|
||||
};
|
||||
|
||||
const notificationIds = (doc.notifications ?? []).map((notification) => toStringId(notification));
|
||||
|
||||
const tagIds = (doc.tags ?? []).map((tag) => toStringId(tag));
|
||||
return {
|
||||
id: toStringId(doc._id),
|
||||
userId: toStringId(doc.userId),
|
||||
@@ -429,6 +433,7 @@ class MongoMonitorsRepository implements IMonitorsRepository {
|
||||
interval: doc.interval,
|
||||
uptimePercentage: doc.uptimePercentage ?? undefined,
|
||||
notifications: notificationIds,
|
||||
tags: tagIds,
|
||||
secret: doc.secret ?? undefined,
|
||||
cpuAlertThreshold: doc.cpuAlertThreshold,
|
||||
cpuAlertCounter: doc.cpuAlertCounter,
|
||||
@@ -468,6 +473,7 @@ class MongoMonitorsRepository implements IMonitorsRepository {
|
||||
};
|
||||
|
||||
const notificationIds = (doc.notifications ?? []).map((notification: unknown) => toStringId(notification));
|
||||
const tagIds = (doc.tags ?? []).map((tag: unknown) => toStringId(tag));
|
||||
|
||||
return {
|
||||
id: toStringId(doc._id),
|
||||
@@ -491,6 +497,7 @@ class MongoMonitorsRepository implements IMonitorsRepository {
|
||||
interval: doc.interval,
|
||||
uptimePercentage: doc.uptimePercentage ?? undefined,
|
||||
notifications: notificationIds,
|
||||
tags: tagIds,
|
||||
secret: doc.secret ?? undefined,
|
||||
cpuAlertThreshold: doc.cpuAlertThreshold,
|
||||
cpuAlertCounter: doc.cpuAlertCounter,
|
||||
|
||||
Reference in new issue
Block a user