mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: improve code readability by updating comments and formatting in migration and services
This commit is contained in:
@@ -8,8 +8,10 @@ export class RenameNotificationRuleTypes1769517677937
|
||||
|
||||
@CaptureSpan()
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
// 1. Update rules with "When on-call policy is executed" and incidentSeverityId (not null)
|
||||
// to "When incident on-call policy is executed"
|
||||
/*
|
||||
* 1. Update rules with "When on-call policy is executed" and incidentSeverityId (not null)
|
||||
* to "When incident on-call policy is executed"
|
||||
*/
|
||||
await queryRunner.query(
|
||||
`UPDATE "UserNotificationRule"
|
||||
SET "ruleType" = 'When incident on-call policy is executed'
|
||||
@@ -17,8 +19,10 @@ export class RenameNotificationRuleTypes1769517677937
|
||||
AND "incidentSeverityId" IS NOT NULL`,
|
||||
);
|
||||
|
||||
// 2. Update rules with "When on-call policy is executed" and alertSeverityId (not null)
|
||||
// to "When alert on-call policy is executed"
|
||||
/*
|
||||
* 2. Update rules with "When on-call policy is executed" and alertSeverityId (not null)
|
||||
* to "When alert on-call policy is executed"
|
||||
*/
|
||||
await queryRunner.query(
|
||||
`UPDATE "UserNotificationRule"
|
||||
SET "ruleType" = 'When alert on-call policy is executed'
|
||||
@@ -26,8 +30,10 @@ export class RenameNotificationRuleTypes1769517677937
|
||||
AND "alertSeverityId" IS NOT NULL`,
|
||||
);
|
||||
|
||||
// 3. Update rules with "When episode on-call policy is executed"
|
||||
// to "When alert episode on-call policy is executed"
|
||||
/*
|
||||
* 3. Update rules with "When episode on-call policy is executed"
|
||||
* to "When alert episode on-call policy is executed"
|
||||
*/
|
||||
await queryRunner.query(
|
||||
`UPDATE "UserNotificationRule"
|
||||
SET "ruleType" = 'When alert episode on-call policy is executed'
|
||||
|
||||
@@ -2032,7 +2032,8 @@ export class Service extends DatabaseService<Model> {
|
||||
notificationRule.userEmailId = userEmail.id!;
|
||||
notificationRule.incidentSeverityId = incidentSeverity.id!;
|
||||
notificationRule.notifyAfterMinutes = 0;
|
||||
notificationRule.ruleType = NotificationRuleType.ON_CALL_EXECUTED_INCIDENT;
|
||||
notificationRule.ruleType =
|
||||
NotificationRuleType.ON_CALL_EXECUTED_INCIDENT;
|
||||
|
||||
await this.create({
|
||||
data: notificationRule,
|
||||
|
||||
@@ -328,9 +328,7 @@ export class Service extends DatabaseService<Model> {
|
||||
return NotificationRuleType.ON_CALL_EXECUTED_INCIDENT;
|
||||
}
|
||||
|
||||
if (
|
||||
userNotificationEventType === UserNotificationEventType.AlertCreated
|
||||
) {
|
||||
if (userNotificationEventType === UserNotificationEventType.AlertCreated) {
|
||||
return NotificationRuleType.ON_CALL_EXECUTED_ALERT;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,9 +49,9 @@ test.describe("Home: Sitemap", () => {
|
||||
expect(sitemapLocs.length).toBeGreaterThan(0);
|
||||
|
||||
// Verify sitemap-pages.xml is in the index
|
||||
const pagesEntry: string | undefined = sitemapLocs.find(
|
||||
(loc: string) => loc.includes("sitemap-pages.xml"),
|
||||
);
|
||||
const pagesEntry: string | undefined = sitemapLocs.find((loc: string) => {
|
||||
return loc.includes("sitemap-pages.xml");
|
||||
});
|
||||
expect(pagesEntry, "sitemap-pages.xml should be in index").toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -77,9 +77,9 @@ test.describe("Home: Sitemap", () => {
|
||||
const first: string | undefined = locs[0];
|
||||
expect(first, "First <loc> should exist").toBeTruthy();
|
||||
// Homepage URL either ends with / or has no path after domain
|
||||
const homepageRegex: RegExp = /^https?:\/\/[^/]+$/;
|
||||
const isHomepage: boolean =
|
||||
first!.endsWith("/") ||
|
||||
/^https?:\/\/[^\/]+$/.test(first!);
|
||||
first!.endsWith("/") || homepageRegex.test(first!);
|
||||
expect(isHomepage, "First <loc> should be homepage").toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user