Merge pull request #1681 from OneUptime/oneuptime-copilot-oneuptime-copilot-improve-comments-MtpRJ

Improved comments on /App/FeatureSet/Workers/DataMigrations/AddMonitoringDatesToMonitors.ts
This commit is contained in:
Simon Larsen 2024-09-08 19:03:20 +01:00 committed by GitHub
commit 97c2e65b15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,8 +11,7 @@ export default class AddMonitoringDatesToMonitor extends DataMigrationBase {
}
public override async migrate(): Promise<void> {
// get all the users with email isVerified true.
// Find all monitor probes where nextPingAt is null
let probeMonitors: Array<MonitorProbe> = await MonitorProbeService.findBy({
query: {
nextPingAt: QueryHelper.isNull(),
@ -27,6 +26,7 @@ export default class AddMonitoringDatesToMonitor extends DataMigrationBase {
},
});
// Update each monitor probe to set nextPingAt to the current date
for (const probeMonitor of probeMonitors) {
await MonitorProbeService.updateOneById({
id: probeMonitor.id!,
@ -39,6 +39,7 @@ export default class AddMonitoringDatesToMonitor extends DataMigrationBase {
});
}
// Find all monitor probes where lastPingAt is null
probeMonitors = await MonitorProbeService.findBy({
query: {
lastPingAt: QueryHelper.isNull(),
@ -53,6 +54,7 @@ export default class AddMonitoringDatesToMonitor extends DataMigrationBase {
},
});
// Update each monitor probe to set lastPingAt to the current date
for (const probeMonitor of probeMonitors) {
await MonitorProbeService.updateOneById({
id: probeMonitor.id!,