mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-23 15:49:10 +00:00
31 lines
758 B
TypeScript
31 lines
758 B
TypeScript
import { find, update } from '../util/db';
|
|
|
|
const subscriberCollection = 'subscribers';
|
|
|
|
async function run() {
|
|
const subscribers = await find(subscriberCollection, {
|
|
notificationType: { $exists: false },
|
|
});
|
|
|
|
for (let i = 0; i < subscribers.length; i++) {
|
|
const subscriber = subscribers[i];
|
|
let notificationType = null;
|
|
if (subscriber.statusPageId) {
|
|
notificationType = {
|
|
announcement: false,
|
|
incident: false,
|
|
scheduledEvent: false,
|
|
};
|
|
}
|
|
await update(
|
|
subscriberCollection,
|
|
{ _id: subscriber._id },
|
|
{
|
|
notificationType,
|
|
}
|
|
);
|
|
}
|
|
}
|
|
|
|
export default run;
|