@oneuptime/common 7.0.3035 → 7.0.3040

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/Models/DatabaseModels/IncidentNoteTemplate.ts +8 -0
  2. package/Models/DatabaseModels/IncidentTemplate.ts +8 -0
  3. package/Models/DatabaseModels/Index.ts +6 -0
  4. package/Models/DatabaseModels/ScheduledMaintenance.ts +70 -0
  5. package/Models/DatabaseModels/ScheduledMaintenanceTemplate.ts +988 -0
  6. package/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerTeam.ts +390 -0
  7. package/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerUser.ts +389 -0
  8. package/Server/Infrastructure/Postgres/SchemaMigrations/1725880508430-MigrationName.ts +269 -0
  9. package/Server/Infrastructure/Postgres/SchemaMigrations/1725881099935-MigrationName.ts +17 -0
  10. package/Server/Infrastructure/Postgres/SchemaMigrations/1725881475134-MigrationName.ts +35 -0
  11. package/Server/Infrastructure/Postgres/SchemaMigrations/1725884177663-MigrationName.ts +29 -0
  12. package/Server/Infrastructure/Postgres/SchemaMigrations/1725898621366-MigrationName.ts +29 -0
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1725900315712-MigrationName.ts +59 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1725901024444-MigrationName.ts +23 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1725975175669-MigrationName.ts +29 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1725976810107-MigrationName.ts +17 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +18 -0
  18. package/Server/Services/IncidentService.ts +45 -0
  19. package/Server/Services/IncidentStateService.ts +47 -6
  20. package/Server/Services/Index.ts +8 -0
  21. package/Server/Services/ScheduledMaintenanceService.ts +308 -1
  22. package/Server/Services/ScheduledMaintenanceTemplateOwnerTeamService.ts +10 -0
  23. package/Server/Services/ScheduledMaintenanceTemplateOwnerUserService.ts +10 -0
  24. package/Server/Services/ScheduledMaintenanceTemplateService.ts +318 -0
  25. package/Types/Database/DatabaseProperty.ts +6 -3
  26. package/Types/Events/Recurring.ts +86 -41
  27. package/Types/Permission.ts +115 -1
  28. package/Types/SerializableObjectDictionary.ts +2 -0
  29. package/UI/Components/Detail/Detail.tsx +12 -3
  30. package/UI/Components/Detail/Field.ts +1 -1
  31. package/UI/Components/Events/RecurringArrayFieldElement.tsx +104 -0
  32. package/UI/Components/Events/RecurringArrayViewElement.tsx +37 -0
  33. package/UI/Components/Events/RecurringViewElement.tsx +2 -0
  34. package/build/dist/Models/DatabaseModels/IncidentNoteTemplate.js +8 -0
  35. package/build/dist/Models/DatabaseModels/IncidentNoteTemplate.js.map +1 -1
  36. package/build/dist/Models/DatabaseModels/IncidentTemplate.js +8 -0
  37. package/build/dist/Models/DatabaseModels/IncidentTemplate.js.map +1 -1
  38. package/build/dist/Models/DatabaseModels/Index.js +6 -0
  39. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  40. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +73 -0
  41. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
  42. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +1012 -0
  43. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplate.js.map +1 -0
  44. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerTeam.js +402 -0
  45. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerTeam.js.map +1 -0
  46. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerUser.js +401 -0
  47. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerUser.js.map +1 -0
  48. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725880508430-MigrationName.js +98 -0
  49. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725880508430-MigrationName.js.map +1 -0
  50. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725881099935-MigrationName.js +12 -0
  51. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725881099935-MigrationName.js.map +1 -0
  52. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725881475134-MigrationName.js +18 -0
  53. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725881475134-MigrationName.js.map +1 -0
  54. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725884177663-MigrationName.js +16 -0
  55. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725884177663-MigrationName.js.map +1 -0
  56. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725898621366-MigrationName.js +16 -0
  57. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725898621366-MigrationName.js.map +1 -0
  58. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725900315712-MigrationName.js +26 -0
  59. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725900315712-MigrationName.js.map +1 -0
  60. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725901024444-MigrationName.js +14 -0
  61. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725901024444-MigrationName.js.map +1 -0
  62. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725975175669-MigrationName.js +16 -0
  63. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725975175669-MigrationName.js.map +1 -0
  64. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725976810107-MigrationName.js +12 -0
  65. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725976810107-MigrationName.js.map +1 -0
  66. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +18 -0
  67. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  68. package/build/dist/Server/Services/IncidentService.js +34 -0
  69. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  70. package/build/dist/Server/Services/IncidentStateService.js +25 -2
  71. package/build/dist/Server/Services/IncidentStateService.js.map +1 -1
  72. package/build/dist/Server/Services/Index.js +7 -0
  73. package/build/dist/Server/Services/Index.js.map +1 -1
  74. package/build/dist/Server/Services/ScheduledMaintenanceService.js +209 -1
  75. package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
  76. package/build/dist/Server/Services/ScheduledMaintenanceTemplateOwnerTeamService.js +9 -0
  77. package/build/dist/Server/Services/ScheduledMaintenanceTemplateOwnerTeamService.js.map +1 -0
  78. package/build/dist/Server/Services/ScheduledMaintenanceTemplateOwnerUserService.js +9 -0
  79. package/build/dist/Server/Services/ScheduledMaintenanceTemplateOwnerUserService.js.map +1 -0
  80. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js +203 -0
  81. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js.map +1 -0
  82. package/build/dist/Types/Database/DatabaseProperty.js.map +1 -1
  83. package/build/dist/Types/Events/Recurring.js +47 -20
  84. package/build/dist/Types/Events/Recurring.js.map +1 -1
  85. package/build/dist/Types/Permission.js +97 -1
  86. package/build/dist/Types/Permission.js.map +1 -1
  87. package/build/dist/Types/SerializableObjectDictionary.js +2 -0
  88. package/build/dist/Types/SerializableObjectDictionary.js.map +1 -1
  89. package/build/dist/UI/Components/Detail/Detail.js +9 -1
  90. package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
  91. package/build/dist/UI/Components/Events/RecurringArrayFieldElement.js +49 -0
  92. package/build/dist/UI/Components/Events/RecurringArrayFieldElement.js.map +1 -0
  93. package/build/dist/UI/Components/Events/RecurringArrayViewElement.js +18 -0
  94. package/build/dist/UI/Components/Events/RecurringArrayViewElement.js.map +1 -0
  95. package/build/dist/UI/Components/Events/RecurringViewElement.js +2 -1
  96. package/build/dist/UI/Components/Events/RecurringViewElement.js.map +1 -1
  97. package/package.json +2 -2
@@ -0,0 +1,35 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725881475134 implements MigrationInterface {
4
+ public name = "MigrationName1725881475134";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "templateName" character varying(100) NOT NULL`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "templateDescription" character varying(500) NOT NULL`,
12
+ );
13
+ await queryRunner.query(
14
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
15
+ );
16
+ await queryRunner.query(
17
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
18
+ );
19
+ }
20
+
21
+ public async down(queryRunner: QueryRunner): Promise<void> {
22
+ await queryRunner.query(
23
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
27
+ );
28
+ await queryRunner.query(
29
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "templateDescription"`,
30
+ );
31
+ await queryRunner.query(
32
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "templateName"`,
33
+ );
34
+ }
35
+ }
@@ -0,0 +1,29 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725884177663 implements MigrationInterface {
4
+ public name = "MigrationName1725884177663";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP CONSTRAINT "FK_aea47be8b8af9673e9639e7dae3"`,
9
+ );
10
+ await queryRunner.query(
11
+ `DROP INDEX "public"."IDX_aea47be8b8af9673e9639e7dae"`,
12
+ );
13
+ await queryRunner.query(
14
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "currentScheduledMaintenanceStateId"`,
15
+ );
16
+ }
17
+
18
+ public async down(queryRunner: QueryRunner): Promise<void> {
19
+ await queryRunner.query(
20
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "currentScheduledMaintenanceStateId" uuid NOT NULL`,
21
+ );
22
+ await queryRunner.query(
23
+ `CREATE INDEX "IDX_aea47be8b8af9673e9639e7dae" ON "ScheduledMaintenanceTemplate" ("currentScheduledMaintenanceStateId") `,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD CONSTRAINT "FK_aea47be8b8af9673e9639e7dae3" FOREIGN KEY ("currentScheduledMaintenanceStateId") REFERENCES "ScheduledMaintenanceState"("_id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
27
+ );
28
+ }
29
+ }
@@ -0,0 +1,29 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725898621366 implements MigrationInterface {
4
+ public name = "MigrationName1725898621366";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "isRecurringEvent" boolean NOT NULL DEFAULT false`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ALTER COLUMN "startsAt" DROP NOT NULL`,
12
+ );
13
+ await queryRunner.query(
14
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ALTER COLUMN "endsAt" DROP NOT NULL`,
15
+ );
16
+ }
17
+
18
+ public async down(queryRunner: QueryRunner): Promise<void> {
19
+ await queryRunner.query(
20
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ALTER COLUMN "endsAt" SET NOT NULL`,
21
+ );
22
+ await queryRunner.query(
23
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ALTER COLUMN "startsAt" SET NOT NULL`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "isRecurringEvent"`,
27
+ );
28
+ }
29
+ }
@@ -0,0 +1,59 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725900315712 implements MigrationInterface {
4
+ public name = "MigrationName1725900315712";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "startsAt"`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "endsAt"`,
12
+ );
13
+ await queryRunner.query(
14
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "firstEventScheduledAt" TIMESTAMP WITH TIME ZONE`,
15
+ );
16
+ await queryRunner.query(
17
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "firstEventStartsAt" TIMESTAMP WITH TIME ZONE`,
18
+ );
19
+ await queryRunner.query(
20
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "firstEventEndsAt" TIMESTAMP WITH TIME ZONE`,
21
+ );
22
+ await queryRunner.query(
23
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "scheduleNextEventAt" boolean NOT NULL DEFAULT false`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
27
+ );
28
+ await queryRunner.query(
29
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
30
+ );
31
+ }
32
+
33
+ public async down(queryRunner: QueryRunner): Promise<void> {
34
+ await queryRunner.query(
35
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
36
+ );
37
+ await queryRunner.query(
38
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
39
+ );
40
+ await queryRunner.query(
41
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "scheduleNextEventAt"`,
42
+ );
43
+ await queryRunner.query(
44
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "firstEventEndsAt"`,
45
+ );
46
+ await queryRunner.query(
47
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "firstEventStartsAt"`,
48
+ );
49
+ await queryRunner.query(
50
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "firstEventScheduledAt"`,
51
+ );
52
+ await queryRunner.query(
53
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "endsAt" TIMESTAMP WITH TIME ZONE`,
54
+ );
55
+ await queryRunner.query(
56
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "startsAt" TIMESTAMP WITH TIME ZONE`,
57
+ );
58
+ }
59
+ }
@@ -0,0 +1,23 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725901024444 implements MigrationInterface {
4
+ public name = "MigrationName1725901024444";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "scheduleNextEventAt"`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "scheduleNextEventAt" TIMESTAMP WITH TIME ZONE`,
12
+ );
13
+ }
14
+
15
+ public async down(queryRunner: QueryRunner): Promise<void> {
16
+ await queryRunner.query(
17
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "scheduleNextEventAt"`,
18
+ );
19
+ await queryRunner.query(
20
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "scheduleNextEventAt" boolean NOT NULL`,
21
+ );
22
+ }
23
+ }
@@ -0,0 +1,29 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725975175669 implements MigrationInterface {
4
+ public name = "MigrationName1725975175669";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "ScheduledMaintenance" ADD "sendSubscriberNotificationsOnBeforeTheEvent" jsonb`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "ScheduledMaintenance" ADD "nextSubscriberNotificationBeforeTheEventAt" TIMESTAMP WITH TIME ZONE`,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_37b2094ce25cc62b4766a7d3b1" ON "ScheduledMaintenance" ("nextSubscriberNotificationBeforeTheEventAt") `,
15
+ );
16
+ }
17
+
18
+ public async down(queryRunner: QueryRunner): Promise<void> {
19
+ await queryRunner.query(
20
+ `DROP INDEX "public"."IDX_37b2094ce25cc62b4766a7d3b1"`,
21
+ );
22
+ await queryRunner.query(
23
+ `ALTER TABLE "ScheduledMaintenance" DROP COLUMN "nextSubscriberNotificationBeforeTheEventAt"`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "ScheduledMaintenance" DROP COLUMN "sendSubscriberNotificationsOnBeforeTheEvent"`,
27
+ );
28
+ }
29
+ }
@@ -0,0 +1,17 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1725976810107 implements MigrationInterface {
4
+ public name = "MigrationName1725976810107";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "ScheduledMaintenanceTemplate" ADD "sendSubscriberNotificationsOnBeforeTheEvent" jsonb`,
9
+ );
10
+ }
11
+
12
+ public async down(queryRunner: QueryRunner): Promise<void> {
13
+ await queryRunner.query(
14
+ `ALTER TABLE "ScheduledMaintenanceTemplate" DROP COLUMN "sendSubscriberNotificationsOnBeforeTheEvent"`,
15
+ );
16
+ }
17
+ }
@@ -51,6 +51,15 @@ import { MigrationName1725379949648 } from "./1725379949648-MigrationName";
51
51
  import { MigrationName1725551629492 } from "./1725551629492-MigrationName";
52
52
  import { MigrationName1725556630384 } from "./1725556630384-MigrationName";
53
53
  import { MigrationName1725618842598 } from "./1725618842598-MigrationName";
54
+ import { MigrationName1725880508430 } from "./1725880508430-MigrationName";
55
+ import { MigrationName1725881099935 } from "./1725881099935-MigrationName";
56
+ import { MigrationName1725881475134 } from "./1725881475134-MigrationName";
57
+ import { MigrationName1725884177663 } from "./1725884177663-MigrationName";
58
+ import { MigrationName1725898621366 } from "./1725898621366-MigrationName";
59
+ import { MigrationName1725900315712 } from "./1725900315712-MigrationName";
60
+ import { MigrationName1725901024444 } from "./1725901024444-MigrationName";
61
+ import { MigrationName1725975175669 } from "./1725975175669-MigrationName";
62
+ import { MigrationName1725976810107 } from "./1725976810107-MigrationName";
54
63
 
55
64
  export default [
56
65
  InitialMigration,
@@ -106,4 +115,13 @@ export default [
106
115
  MigrationName1725551629492,
107
116
  MigrationName1725556630384,
108
117
  MigrationName1725618842598,
118
+ MigrationName1725880508430,
119
+ MigrationName1725881099935,
120
+ MigrationName1725881475134,
121
+ MigrationName1725884177663,
122
+ MigrationName1725898621366,
123
+ MigrationName1725900315712,
124
+ MigrationName1725901024444,
125
+ MigrationName1725975175669,
126
+ MigrationName1725976810107,
109
127
  ];
@@ -40,6 +40,51 @@ export class Service extends DatabaseService<Model> {
40
40
  this.hardDeleteItemsOlderThanInDays("createdAt", 120);
41
41
  }
42
42
 
43
+ public async isIncidentAcknowledged(data: {
44
+ incidentId: ObjectID;
45
+ }): Promise<boolean> {
46
+ const incident: Model | null = await this.findOneBy({
47
+ query: {
48
+ _id: data.incidentId,
49
+ },
50
+ select: {
51
+ projectId: true,
52
+ currentIncidentState: {
53
+ order: true,
54
+ },
55
+ },
56
+ props: {
57
+ isRoot: true,
58
+ },
59
+ });
60
+
61
+ if (!incident) {
62
+ throw new BadDataException("Incident not found");
63
+ }
64
+
65
+ if (!incident.projectId) {
66
+ throw new BadDataException("Incient Project ID not found");
67
+ }
68
+
69
+ const ackIncidentState: IncidentState =
70
+ await IncidentStateService.getAcknowledgedIncidentState({
71
+ projectId: incident.projectId,
72
+ props: {
73
+ isRoot: true,
74
+ },
75
+ });
76
+
77
+ const currentIncidentStateOrder: number =
78
+ incident.currentIncidentState!.order!;
79
+ const ackIncidentStateOrder: number = ackIncidentState.order!;
80
+
81
+ if (currentIncidentStateOrder >= ackIncidentStateOrder) {
82
+ return true;
83
+ }
84
+
85
+ return false;
86
+ }
87
+
43
88
  public async acknowledgeIncident(
44
89
  incidentId: ObjectID,
45
90
  acknowledgedByUserId: ObjectID,
@@ -152,13 +152,13 @@ export class Service extends DatabaseService<IncidentState> {
152
152
  }
153
153
  }
154
154
 
155
- public async getUnresolvedIncidentStates(
156
- projectId: ObjectID,
157
- props: DatabaseCommonInteractionProps,
158
- ): Promise<IncidentState[]> {
155
+ public async getAllIncidentStates(data: {
156
+ projectId: ObjectID;
157
+ props: DatabaseCommonInteractionProps;
158
+ }): Promise<Array<IncidentState>> {
159
159
  const incidentStates: Array<IncidentState> = await this.findBy({
160
160
  query: {
161
- projectId: projectId,
161
+ projectId: data.projectId,
162
162
  },
163
163
  skip: 0,
164
164
  limit: LIMIT_MAX,
@@ -168,10 +168,26 @@ export class Service extends DatabaseService<IncidentState> {
168
168
  select: {
169
169
  _id: true,
170
170
  isResolvedState: true,
171
+ isAcknowledgedState: true,
172
+ isCreatedState: true,
173
+ order: true,
171
174
  },
172
- props: props,
175
+ props: data.props,
173
176
  });
174
177
 
178
+ return incidentStates;
179
+ }
180
+
181
+ public async getUnresolvedIncidentStates(
182
+ projectId: ObjectID,
183
+ props: DatabaseCommonInteractionProps,
184
+ ): Promise<IncidentState[]> {
185
+ const incidentStates: Array<IncidentState> =
186
+ await this.getAllIncidentStates({
187
+ projectId: projectId,
188
+ props: props,
189
+ });
190
+
175
191
  const unresolvedIncidentStates: Array<IncidentState> = [];
176
192
 
177
193
  for (const state of incidentStates) {
@@ -184,5 +200,30 @@ export class Service extends DatabaseService<IncidentState> {
184
200
 
185
201
  return unresolvedIncidentStates;
186
202
  }
203
+
204
+ public async getAcknowledgedIncidentState(data: {
205
+ projectId: ObjectID;
206
+ props: DatabaseCommonInteractionProps;
207
+ }): Promise<IncidentState> {
208
+ const incidentStates: Array<IncidentState> =
209
+ await this.getAllIncidentStates({
210
+ projectId: data.projectId,
211
+ props: data.props,
212
+ });
213
+
214
+ const ackIncidentState: IncidentState | undefined = incidentStates.find(
215
+ (incidentState: IncidentState) => {
216
+ return incidentState?.isAcknowledgedState;
217
+ },
218
+ );
219
+
220
+ if (!ackIncidentState) {
221
+ throw new BadDataException(
222
+ "Acknowledged Incident State not found for this project",
223
+ );
224
+ }
225
+
226
+ return ackIncidentState;
227
+ }
187
228
  }
188
229
  export default new Service();
@@ -133,6 +133,9 @@ import TelemetryAttributeService from "./TelemetryAttributeService";
133
133
  import TelemetryExceptionService from "./TelemetryExceptionService";
134
134
  import ExceptionInstanceService from "./ExceptionInstanceService";
135
135
  import CopilotActionTypePriorityService from "./CopilotActionTypePriorityService";
136
+ import ScheduledMaintenanceTemplateService from "./ScheduledMaintenanceTemplateService";
137
+ import ScheduledMaintenanceTemplateOwnerTeamService from "./ScheduledMaintenanceTemplateOwnerTeamService";
138
+ import ScheduledMaintenanceTemplateOwnerUserService from "./ScheduledMaintenanceTemplateOwnerUserService";
136
139
 
137
140
  const services: Array<BaseService> = [
138
141
  AcmeCertificateService,
@@ -277,6 +280,11 @@ const services: Array<BaseService> = [
277
280
  CopilotActionTypePriorityService,
278
281
 
279
282
  TelemetryExceptionService,
283
+
284
+ // scheduled maintenance templates
285
+ ScheduledMaintenanceTemplateService,
286
+ ScheduledMaintenanceTemplateOwnerTeamService,
287
+ ScheduledMaintenanceTemplateOwnerUserService,
280
288
  ];
281
289
 
282
290
  export const AnalyticsServices: Array<