-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add severity fields to AlertLog, IncidentLog, and ScheduledMain…
…tenanceLog models
- Loading branch information
Showing
8 changed files
with
217 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Common/Server/Infrastructure/Postgres/SchemaMigrations/1736703138918-MigrationName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class MigrationName1736703138918 implements MigrationInterface { | ||
public name = 'MigrationName1736703138918' | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "IncidentLog" ADD "incidentLogSeverity" character varying NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "AlertLog" ADD "alertLogSeverity" character varying NOT NULL`); | ||
await queryRunner.query(`ALTER TABLE "ScheduledMaintenanceLog" ADD "scheduledMaintenanceLogSeverity" character varying NOT NULL`); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`ALTER TABLE "ScheduledMaintenanceLog" DROP COLUMN "scheduledMaintenanceLogSeverity"`); | ||
await queryRunner.query(`ALTER TABLE "AlertLog" DROP COLUMN "alertLogSeverity"`); | ||
await queryRunner.query(`ALTER TABLE "IncidentLog" DROP COLUMN "incidentLogSeverity"`); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,45 @@ | ||
import LogSeverity from "../../Types/Log/LogSeverity"; | ||
import ObjectID from "../../Types/ObjectID"; | ||
import DatabaseService from "./DatabaseService"; | ||
import Model from "Common/Models/DatabaseModels/AlertLog"; | ||
import Model, { AlertLogEvent } from "Common/Models/DatabaseModels/AlertLog"; | ||
|
||
export class Service extends DatabaseService<Model> { | ||
public constructor() { | ||
super(Model); | ||
} | ||
|
||
public async createAlertLog(data: { | ||
alertId: ObjectID, | ||
logInMarkdown: string, | ||
alertLogEvent: AlertLogEvent, | ||
projectId: ObjectID, | ||
moreInformationInMarkdown?: string | undefined, | ||
logSeverity?: LogSeverity | undefined, | ||
}): Promise<Model> { | ||
const alertLog: Model = new Model(); | ||
|
||
if(!data.logSeverity) { | ||
data.logSeverity = LogSeverity.Unspecified; | ||
} | ||
|
||
alertLog.alertLogSeverity = data.logSeverity; | ||
|
||
alertLog.alertId = data.alertId; | ||
alertLog.logInMarkdown = data.logInMarkdown; | ||
alertLog.alertLogEvent = data.alertLogEvent; | ||
alertLog.projectId = data.projectId; | ||
|
||
if(data.moreInformationInMarkdown) { | ||
alertLog.moreInformationInMarkdown = data.moreInformationInMarkdown; | ||
} | ||
|
||
return await this.create({ | ||
data: alertLog, | ||
props: { | ||
isRoot: true, | ||
} | ||
}) | ||
} | ||
} | ||
|
||
export default new Service(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,43 @@ | ||
import LogSeverity from "../../Types/Log/LogSeverity"; | ||
import ObjectID from "../../Types/ObjectID"; | ||
import DatabaseService from "./DatabaseService"; | ||
import Model from "Common/Models/DatabaseModels/IncidentLog"; | ||
import Model, { IncidentLogEvent } from "Common/Models/DatabaseModels/IncidentLog"; | ||
|
||
export class Service extends DatabaseService<Model> { | ||
public constructor() { | ||
super(Model); | ||
} | ||
|
||
public async createIncidentLog(data: { | ||
incidentId: ObjectID, | ||
logInMarkdown: string, | ||
incidentLogEvent: IncidentLogEvent, | ||
projectId: ObjectID, | ||
moreInformationInMarkdown?: string | undefined, | ||
logSeverity?: LogSeverity | undefined, | ||
}): Promise<Model> { | ||
const incidentLog: Model = new Model(); | ||
|
||
if(!data.logSeverity) { | ||
data.logSeverity = LogSeverity.Unspecified; | ||
} | ||
incidentLog.incidentLogSeverity = data.logSeverity; | ||
incidentLog.incidentId = data.incidentId; | ||
incidentLog.logInMarkdown = data.logInMarkdown; | ||
incidentLog.incidentLogEvent = data.incidentLogEvent; | ||
incidentLog.projectId = data.projectId; | ||
|
||
if(data.moreInformationInMarkdown) { | ||
incidentLog.moreInformationInMarkdown = data.moreInformationInMarkdown; | ||
} | ||
|
||
return await this.create({ | ||
data: incidentLog, | ||
props: { | ||
isRoot: true, | ||
} | ||
}) | ||
} | ||
} | ||
|
||
export default new Service(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,47 @@ | ||
import LogSeverity from "../../Types/Log/LogSeverity"; | ||
import ObjectID from "../../Types/ObjectID"; | ||
import DatabaseService from "./DatabaseService"; | ||
import Model from "Common/Models/DatabaseModels/ScheduledMaintenanceLog"; | ||
import Model, { ScheduledMaintenanceLogEvent } from "Common/Models/DatabaseModels/ScheduledMaintenanceLog"; | ||
|
||
export class Service extends DatabaseService<Model> { | ||
public constructor() { | ||
super(Model); | ||
} | ||
|
||
public async createScheduledMaintenanceLog(data: { | ||
scheduledMaintenanceId: ObjectID, | ||
logInMarkdown: string, | ||
scheduledMaintenanceLogEvent: ScheduledMaintenanceLogEvent, | ||
projectId: ObjectID, | ||
moreInformationInMarkdown?: string | undefined, | ||
logSeverity?: LogSeverity | undefined, | ||
}): Promise<Model> { | ||
|
||
|
||
if(!data.logSeverity) { | ||
data.logSeverity = LogSeverity.Unspecified; | ||
} | ||
|
||
const scheduledMaintenanceLog: Model = new Model(); | ||
|
||
scheduledMaintenanceLog.scheduledMaintenanceLogSeverity = data.logSeverity; | ||
scheduledMaintenanceLog.scheduledMaintenanceId = data.scheduledMaintenanceId; | ||
scheduledMaintenanceLog.logInMarkdown = data.logInMarkdown; | ||
scheduledMaintenanceLog.scheduledMaintenanceLogEvent = data.scheduledMaintenanceLogEvent; | ||
scheduledMaintenanceLog.projectId = data.projectId; | ||
|
||
|
||
if (data.moreInformationInMarkdown) { | ||
scheduledMaintenanceLog.moreInformationInMarkdown = data.moreInformationInMarkdown; | ||
} | ||
|
||
return await this.create({ | ||
data: scheduledMaintenanceLog, | ||
props: { | ||
isRoot: true, | ||
} | ||
}) | ||
} | ||
} | ||
|
||
export default new Service(); |