@oneuptime/common 10.0.66 → 10.0.68

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 (132) hide show
  1. package/Models/AnalyticsModels/AuditLog.ts +370 -0
  2. package/Models/DatabaseModels/Alert.ts +2 -0
  3. package/Models/DatabaseModels/ApiKey.ts +2 -0
  4. package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.ts +3 -0
  5. package/Models/DatabaseModels/GlobalConfig.ts +56 -0
  6. package/Models/DatabaseModels/Incident.ts +2 -0
  7. package/Models/DatabaseModels/Index.ts +4 -0
  8. package/Models/DatabaseModels/Label.ts +2 -0
  9. package/Models/DatabaseModels/Monitor.ts +2 -0
  10. package/Models/DatabaseModels/OnCallDutyPolicy.ts +2 -0
  11. package/Models/DatabaseModels/Project.ts +110 -0
  12. package/Models/DatabaseModels/ScheduledMaintenance.ts +2 -0
  13. package/Models/DatabaseModels/StatusPage.ts +2 -0
  14. package/Models/DatabaseModels/Team.ts +2 -0
  15. package/Models/DatabaseModels/TelegramLog.ts +1025 -0
  16. package/Models/DatabaseModels/UserNotificationRule.ts +49 -0
  17. package/Models/DatabaseModels/UserNotificationSetting.ts +17 -0
  18. package/Models/DatabaseModels/UserOnCallLogTimeline.ts +48 -0
  19. package/Models/DatabaseModels/UserTelegram.ts +312 -0
  20. package/Server/API/UserTelegramAPI.ts +167 -0
  21. package/Server/Infrastructure/Postgres/SchemaMigrations/1776761171349-MigrationName.ts +325 -0
  22. package/Server/Infrastructure/Postgres/SchemaMigrations/1776801030808-MigrationName.ts +35 -0
  23. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
  24. package/Server/Services/AuditLogService.ts +574 -0
  25. package/Server/Services/DatabaseService.ts +71 -0
  26. package/Server/Services/Index.ts +8 -0
  27. package/Server/Services/TelegramLogService.ts +15 -0
  28. package/Server/Services/TelegramService.ts +139 -0
  29. package/Server/Services/UserNotificationRuleService.ts +350 -1
  30. package/Server/Services/UserNotificationSettingService.ts +114 -0
  31. package/Server/Services/UserTelegramService.ts +140 -0
  32. package/Server/Utils/Monitor/MonitorResource.ts +29 -15
  33. package/Server/Utils/Monitor/MonitorTemplateUtil.ts +29 -16
  34. package/Tests/Types/Date.test.ts +158 -0
  35. package/Types/AnalyticsDatabase/AnalyticsTableName.ts +1 -0
  36. package/Types/AuditLog/AuditLogAction.ts +7 -0
  37. package/Types/BaseDatabase/EnableAuditLogOn.ts +5 -0
  38. package/Types/Database/EnableAuditLog.ts +18 -0
  39. package/Types/Date.ts +12 -3
  40. package/Types/Icon/IconProp.ts +1 -0
  41. package/Types/Permission.ts +24 -0
  42. package/Types/Telegram/TelegramMessage.ts +9 -0
  43. package/Types/TelegramStatus.ts +14 -0
  44. package/UI/Components/Icon/Icon.tsx +15 -0
  45. package/build/dist/Models/AnalyticsModels/AuditLog.js +337 -0
  46. package/build/dist/Models/AnalyticsModels/AuditLog.js.map +1 -0
  47. package/build/dist/Models/DatabaseModels/Alert.js +2 -0
  48. package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
  49. package/build/dist/Models/DatabaseModels/ApiKey.js +2 -0
  50. package/build/dist/Models/DatabaseModels/ApiKey.js.map +1 -1
  51. package/build/dist/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js.map +1 -1
  52. package/build/dist/Models/DatabaseModels/GlobalConfig.js +59 -0
  53. package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
  54. package/build/dist/Models/DatabaseModels/Incident.js +2 -0
  55. package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
  56. package/build/dist/Models/DatabaseModels/Index.js +4 -0
  57. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  58. package/build/dist/Models/DatabaseModels/Label.js +2 -0
  59. package/build/dist/Models/DatabaseModels/Label.js.map +1 -1
  60. package/build/dist/Models/DatabaseModels/Monitor.js +2 -0
  61. package/build/dist/Models/DatabaseModels/Monitor.js.map +1 -1
  62. package/build/dist/Models/DatabaseModels/OnCallDutyPolicy.js +2 -0
  63. package/build/dist/Models/DatabaseModels/OnCallDutyPolicy.js.map +1 -1
  64. package/build/dist/Models/DatabaseModels/Project.js +114 -0
  65. package/build/dist/Models/DatabaseModels/Project.js.map +1 -1
  66. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +2 -0
  67. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
  68. package/build/dist/Models/DatabaseModels/StatusPage.js +2 -0
  69. package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
  70. package/build/dist/Models/DatabaseModels/Team.js +2 -0
  71. package/build/dist/Models/DatabaseModels/Team.js.map +1 -1
  72. package/build/dist/Models/DatabaseModels/TelegramLog.js +1056 -0
  73. package/build/dist/Models/DatabaseModels/TelegramLog.js.map +1 -0
  74. package/build/dist/Models/DatabaseModels/UserNotificationRule.js +49 -0
  75. package/build/dist/Models/DatabaseModels/UserNotificationRule.js.map +1 -1
  76. package/build/dist/Models/DatabaseModels/UserNotificationSetting.js +19 -0
  77. package/build/dist/Models/DatabaseModels/UserNotificationSetting.js.map +1 -1
  78. package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +48 -0
  79. package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
  80. package/build/dist/Models/DatabaseModels/UserTelegram.js +331 -0
  81. package/build/dist/Models/DatabaseModels/UserTelegram.js.map +1 -0
  82. package/build/dist/Server/API/UserTelegramAPI.js +99 -0
  83. package/build/dist/Server/API/UserTelegramAPI.js.map +1 -0
  84. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776761171349-MigrationName.js +116 -0
  85. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776761171349-MigrationName.js.map +1 -0
  86. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776801030808-MigrationName.js +18 -0
  87. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1776801030808-MigrationName.js.map +1 -0
  88. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
  89. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  90. package/build/dist/Server/Services/AuditLogService.js +402 -0
  91. package/build/dist/Server/Services/AuditLogService.js.map +1 -0
  92. package/build/dist/Server/Services/DatabaseService.js +68 -8
  93. package/build/dist/Server/Services/DatabaseService.js.map +1 -1
  94. package/build/dist/Server/Services/Index.js +8 -0
  95. package/build/dist/Server/Services/Index.js.map +1 -1
  96. package/build/dist/Server/Services/TelegramLogService.js +13 -0
  97. package/build/dist/Server/Services/TelegramLogService.js.map +1 -0
  98. package/build/dist/Server/Services/TelegramService.js +100 -0
  99. package/build/dist/Server/Services/TelegramService.js.map +1 -0
  100. package/build/dist/Server/Services/UserNotificationRuleService.js +272 -21
  101. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  102. package/build/dist/Server/Services/UserNotificationSettingService.js +94 -0
  103. package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
  104. package/build/dist/Server/Services/UserTelegramService.js +133 -0
  105. package/build/dist/Server/Services/UserTelegramService.js.map +1 -0
  106. package/build/dist/Server/Utils/Monitor/MonitorResource.js +25 -12
  107. package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
  108. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js +24 -12
  109. package/build/dist/Server/Utils/Monitor/MonitorTemplateUtil.js.map +1 -1
  110. package/build/dist/Tests/Types/Date.test.js +96 -0
  111. package/build/dist/Tests/Types/Date.test.js.map +1 -1
  112. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +1 -0
  113. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
  114. package/build/dist/Types/AuditLog/AuditLogAction.js +8 -0
  115. package/build/dist/Types/AuditLog/AuditLogAction.js.map +1 -0
  116. package/build/dist/Types/BaseDatabase/EnableAuditLogOn.js +2 -0
  117. package/build/dist/Types/BaseDatabase/EnableAuditLogOn.js.map +1 -0
  118. package/build/dist/Types/Database/EnableAuditLog.js +15 -0
  119. package/build/dist/Types/Database/EnableAuditLog.js.map +1 -0
  120. package/build/dist/Types/Date.js +9 -3
  121. package/build/dist/Types/Date.js.map +1 -1
  122. package/build/dist/Types/Icon/IconProp.js +1 -0
  123. package/build/dist/Types/Icon/IconProp.js.map +1 -1
  124. package/build/dist/Types/Permission.js +21 -0
  125. package/build/dist/Types/Permission.js.map +1 -1
  126. package/build/dist/Types/Telegram/TelegramMessage.js +2 -0
  127. package/build/dist/Types/Telegram/TelegramMessage.js.map +1 -0
  128. package/build/dist/Types/TelegramStatus.js +15 -0
  129. package/build/dist/Types/TelegramStatus.js.map +1 -0
  130. package/build/dist/UI/Components/Icon/Icon.js +5 -0
  131. package/build/dist/UI/Components/Icon/Icon.js.map +1 -1
  132. package/package.json +2 -2
@@ -0,0 +1,1025 @@
1
+ import Project from "./Project";
2
+ import Incident from "./Incident";
3
+ import Alert from "./Alert";
4
+ import Monitor from "./Monitor";
5
+ import ScheduledMaintenance from "./ScheduledMaintenance";
6
+ import StatusPage from "./StatusPage";
7
+ import StatusPageAnnouncement from "./StatusPageAnnouncement";
8
+ import User from "./User";
9
+ import OnCallDutyPolicy from "./OnCallDutyPolicy";
10
+ import OnCallDutyPolicyEscalationRule from "./OnCallDutyPolicyEscalationRule";
11
+ import OnCallDutyPolicySchedule from "./OnCallDutyPolicySchedule";
12
+ import Team from "./Team";
13
+ import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
14
+ import Route from "../../Types/API/Route";
15
+ import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
16
+ import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
17
+ import ColumnLength from "../../Types/Database/ColumnLength";
18
+ import ColumnType from "../../Types/Database/ColumnType";
19
+ import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
20
+ import EnableDocumentation from "../../Types/Database/EnableDocumentation";
21
+ import EnableWorkflow from "../../Types/Database/EnableWorkflow";
22
+ import TableColumn from "../../Types/Database/TableColumn";
23
+ import TableColumnType from "../../Types/Database/TableColumnType";
24
+ import TableMetadata from "../../Types/Database/TableMetadata";
25
+ import TenantColumn from "../../Types/Database/TenantColumn";
26
+ import IconProp from "../../Types/Icon/IconProp";
27
+ import ObjectID from "../../Types/ObjectID";
28
+ import Permission from "../../Types/Permission";
29
+ import TelegramStatus from "../../Types/TelegramStatus";
30
+ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
31
+
32
+ @EnableDocumentation()
33
+ @TenantColumn("projectId")
34
+ @TableAccessControl({
35
+ create: [],
36
+ read: [
37
+ Permission.ProjectOwner,
38
+ Permission.ProjectAdmin,
39
+ Permission.ProjectMember,
40
+ Permission.Viewer,
41
+ Permission.ReadTelegramLog,
42
+ Permission.ReadAllProjectResources,
43
+ ],
44
+ delete: [],
45
+ update: [],
46
+ })
47
+ @CrudApiEndpoint(new Route("/telegram-log"))
48
+ @Entity({
49
+ name: "TelegramLog",
50
+ })
51
+ @EnableWorkflow({
52
+ create: true,
53
+ delete: false,
54
+ update: false,
55
+ })
56
+ @TableMetadata({
57
+ tableName: "TelegramLog",
58
+ singularName: "Telegram Log",
59
+ pluralName: "Telegram Logs",
60
+ icon: IconProp.Telegram,
61
+ tableDescription:
62
+ "Logs of all the Telegram messages sent out to all users and subscribers for this project.",
63
+ })
64
+ export default class TelegramLog extends BaseModel {
65
+ @ColumnAccessControl({
66
+ create: [],
67
+ read: [
68
+ Permission.ProjectOwner,
69
+ Permission.ProjectAdmin,
70
+ Permission.ProjectMember,
71
+ Permission.Viewer,
72
+ Permission.ReadTelegramLog,
73
+ Permission.ReadAllProjectResources,
74
+ ],
75
+ update: [],
76
+ })
77
+ @TableColumn({
78
+ manyToOneRelationColumn: "projectId",
79
+ type: TableColumnType.Entity,
80
+ modelType: Project,
81
+ title: "Project",
82
+ description: "Relation to Project Resource in which this object belongs",
83
+ })
84
+ @ManyToOne(
85
+ () => {
86
+ return Project;
87
+ },
88
+ {
89
+ eager: false,
90
+ nullable: true,
91
+ onDelete: "CASCADE",
92
+ orphanedRowAction: "nullify",
93
+ },
94
+ )
95
+ @JoinColumn({ name: "projectId" })
96
+ public project?: Project = undefined;
97
+
98
+ @ColumnAccessControl({
99
+ create: [],
100
+ read: [
101
+ Permission.ProjectOwner,
102
+ Permission.ProjectAdmin,
103
+ Permission.ProjectMember,
104
+ Permission.Viewer,
105
+ Permission.ReadTelegramLog,
106
+ Permission.ReadAllProjectResources,
107
+ ],
108
+ update: [],
109
+ })
110
+ @Index()
111
+ @TableColumn({
112
+ type: TableColumnType.ObjectID,
113
+ required: true,
114
+ canReadOnRelationQuery: true,
115
+ title: "Project ID",
116
+ description: "ID of your OneUptime Project in which this object belongs",
117
+ })
118
+ @Column({
119
+ type: ColumnType.ObjectID,
120
+ nullable: false,
121
+ transformer: ObjectID.getDatabaseTransformer(),
122
+ })
123
+ public projectId?: ObjectID = undefined;
124
+
125
+ @ColumnAccessControl({
126
+ create: [],
127
+ read: [
128
+ Permission.ProjectOwner,
129
+ Permission.ProjectAdmin,
130
+ Permission.ProjectMember,
131
+ Permission.Viewer,
132
+ Permission.ReadTelegramLog,
133
+ Permission.ReadAllProjectResources,
134
+ ],
135
+ update: [],
136
+ })
137
+ @Index()
138
+ @TableColumn({
139
+ required: true,
140
+ type: TableColumnType.ShortText,
141
+ title: "To Chat ID",
142
+ description: "Telegram Chat ID the message was sent to",
143
+ canReadOnRelationQuery: false,
144
+ })
145
+ @Column({
146
+ nullable: false,
147
+ type: ColumnType.ShortText,
148
+ length: ColumnLength.ShortText,
149
+ })
150
+ public toChatId?: string = undefined;
151
+
152
+ @ColumnAccessControl({
153
+ create: [],
154
+ read: [
155
+ Permission.ProjectOwner,
156
+ Permission.ProjectAdmin,
157
+ Permission.ProjectMember,
158
+ Permission.Viewer,
159
+ Permission.ReadTelegramLog,
160
+ Permission.ReadAllProjectResources,
161
+ ],
162
+ update: [],
163
+ })
164
+ @TableColumn({
165
+ required: false,
166
+ type: TableColumnType.ShortText,
167
+ title: "From Bot Username",
168
+ description: "OneUptime Telegram bot username the message was sent from",
169
+ canReadOnRelationQuery: false,
170
+ })
171
+ @Column({
172
+ nullable: true,
173
+ type: ColumnType.ShortText,
174
+ length: ColumnLength.ShortText,
175
+ })
176
+ public fromBotUsername?: string = undefined;
177
+
178
+ @ColumnAccessControl({
179
+ create: [],
180
+ read: [
181
+ Permission.ProjectOwner,
182
+ Permission.ProjectAdmin,
183
+ Permission.ProjectMember,
184
+ Permission.Viewer,
185
+ Permission.ReadTelegramLog,
186
+ Permission.ReadAllProjectResources,
187
+ ],
188
+ update: [],
189
+ })
190
+ @TableColumn({
191
+ required: false,
192
+ type: TableColumnType.VeryLongText,
193
+ title: "Message Text",
194
+ description: "Text content of the Telegram message",
195
+ canReadOnRelationQuery: false,
196
+ })
197
+ @Column({
198
+ nullable: true,
199
+ type: ColumnType.VeryLongText,
200
+ })
201
+ public messageText?: string = undefined;
202
+
203
+ @ColumnAccessControl({
204
+ create: [],
205
+ read: [
206
+ Permission.ProjectOwner,
207
+ Permission.ProjectAdmin,
208
+ Permission.ProjectMember,
209
+ Permission.Viewer,
210
+ Permission.ReadTelegramLog,
211
+ Permission.ReadAllProjectResources,
212
+ ],
213
+ update: [],
214
+ })
215
+ @TableColumn({
216
+ required: false,
217
+ type: TableColumnType.LongText,
218
+ title: "Status Message",
219
+ description: "Status Message (if any)",
220
+ canReadOnRelationQuery: false,
221
+ })
222
+ @Column({
223
+ nullable: true,
224
+ type: ColumnType.LongText,
225
+ length: ColumnLength.LongText,
226
+ })
227
+ public statusMessage?: string = undefined;
228
+
229
+ @ColumnAccessControl({
230
+ create: [],
231
+ read: [
232
+ Permission.ProjectOwner,
233
+ Permission.ProjectAdmin,
234
+ Permission.ProjectMember,
235
+ Permission.Viewer,
236
+ Permission.ReadTelegramLog,
237
+ Permission.ReadAllProjectResources,
238
+ ],
239
+ update: [],
240
+ })
241
+ @Index()
242
+ @TableColumn({
243
+ required: false,
244
+ type: TableColumnType.ShortText,
245
+ title: "Telegram Message ID",
246
+ description: "Message ID returned by Telegram Bot API",
247
+ canReadOnRelationQuery: false,
248
+ })
249
+ @Column({
250
+ nullable: true,
251
+ type: ColumnType.ShortText,
252
+ length: ColumnLength.ShortText,
253
+ })
254
+ public telegramMessageId?: string = undefined;
255
+
256
+ @ColumnAccessControl({
257
+ create: [],
258
+ read: [
259
+ Permission.ProjectOwner,
260
+ Permission.ProjectAdmin,
261
+ Permission.ProjectMember,
262
+ Permission.Viewer,
263
+ Permission.ReadTelegramLog,
264
+ Permission.ReadAllProjectResources,
265
+ ],
266
+ update: [],
267
+ })
268
+ @TableColumn({
269
+ required: true,
270
+ type: TableColumnType.ShortText,
271
+ title: "Status of the Telegram Message",
272
+ description: "Status of the Telegram message sent",
273
+ canReadOnRelationQuery: false,
274
+ })
275
+ @Column({
276
+ nullable: false,
277
+ type: ColumnType.ShortText,
278
+ length: ColumnLength.ShortText,
279
+ })
280
+ public status?: TelegramStatus = undefined;
281
+
282
+ @ColumnAccessControl({
283
+ create: [],
284
+ read: [
285
+ Permission.ProjectOwner,
286
+ Permission.ProjectAdmin,
287
+ Permission.ProjectMember,
288
+ Permission.Viewer,
289
+ Permission.ReadTelegramLog,
290
+ Permission.ReadAllProjectResources,
291
+ ],
292
+ update: [],
293
+ })
294
+ @Index()
295
+ @TableColumn({
296
+ required: true,
297
+ type: TableColumnType.Number,
298
+ title: "Telegram Cost",
299
+ description: "Telegram Message Cost in USD Cents",
300
+ canReadOnRelationQuery: false,
301
+ isDefaultValueColumn: true,
302
+ defaultValue: 0,
303
+ })
304
+ @Column({
305
+ nullable: false,
306
+ default: 0,
307
+ type: ColumnType.Number,
308
+ })
309
+ public telegramCostInUSDCents?: number = undefined;
310
+
311
+ @ColumnAccessControl({
312
+ create: [],
313
+ read: [
314
+ Permission.ProjectOwner,
315
+ Permission.ProjectAdmin,
316
+ Permission.ProjectMember,
317
+ Permission.Viewer,
318
+ Permission.ReadTelegramLog,
319
+ Permission.ReadAllProjectResources,
320
+ ],
321
+ update: [],
322
+ })
323
+ @TableColumn({
324
+ manyToOneRelationColumn: "incidentId",
325
+ type: TableColumnType.Entity,
326
+ modelType: Incident,
327
+ title: "Incident",
328
+ description: "Incident associated with this message (if any)",
329
+ })
330
+ @ManyToOne(
331
+ () => {
332
+ return Incident;
333
+ },
334
+ {
335
+ eager: false,
336
+ nullable: true,
337
+ onDelete: "CASCADE",
338
+ orphanedRowAction: "nullify",
339
+ },
340
+ )
341
+ @JoinColumn({ name: "incidentId" })
342
+ public incident?: Incident = undefined;
343
+
344
+ @ColumnAccessControl({
345
+ create: [],
346
+ read: [
347
+ Permission.ProjectOwner,
348
+ Permission.ProjectAdmin,
349
+ Permission.ProjectMember,
350
+ Permission.Viewer,
351
+ Permission.ReadTelegramLog,
352
+ Permission.ReadAllProjectResources,
353
+ ],
354
+ update: [],
355
+ })
356
+ @Index()
357
+ @TableColumn({
358
+ type: TableColumnType.ObjectID,
359
+ required: false,
360
+ canReadOnRelationQuery: true,
361
+ title: "Incident ID",
362
+ description: "ID of Incident associated with this message (if any)",
363
+ })
364
+ @Column({
365
+ type: ColumnType.ObjectID,
366
+ nullable: true,
367
+ transformer: ObjectID.getDatabaseTransformer(),
368
+ })
369
+ public incidentId?: ObjectID = undefined;
370
+
371
+ @ColumnAccessControl({
372
+ create: [],
373
+ read: [
374
+ Permission.ProjectOwner,
375
+ Permission.ProjectAdmin,
376
+ Permission.ProjectMember,
377
+ Permission.Viewer,
378
+ Permission.ReadTelegramLog,
379
+ Permission.ReadAllProjectResources,
380
+ ],
381
+ update: [],
382
+ })
383
+ @TableColumn({
384
+ manyToOneRelationColumn: "userId",
385
+ type: TableColumnType.Entity,
386
+ modelType: User,
387
+ title: "User",
388
+ description: "User who initiated this message (if any)",
389
+ })
390
+ @ManyToOne(
391
+ () => {
392
+ return User;
393
+ },
394
+ {
395
+ eager: false,
396
+ nullable: true,
397
+ onDelete: "CASCADE",
398
+ orphanedRowAction: "nullify",
399
+ },
400
+ )
401
+ @JoinColumn({ name: "userId" })
402
+ public user?: User = undefined;
403
+
404
+ @ColumnAccessControl({
405
+ create: [],
406
+ read: [
407
+ Permission.ProjectOwner,
408
+ Permission.ProjectAdmin,
409
+ Permission.ProjectMember,
410
+ Permission.Viewer,
411
+ Permission.ReadTelegramLog,
412
+ Permission.ReadAllProjectResources,
413
+ ],
414
+ update: [],
415
+ })
416
+ @Index()
417
+ @TableColumn({
418
+ type: TableColumnType.ObjectID,
419
+ required: false,
420
+ canReadOnRelationQuery: true,
421
+ title: "User ID",
422
+ description: "ID of User who initiated this message (if any)",
423
+ })
424
+ @Column({
425
+ type: ColumnType.ObjectID,
426
+ nullable: true,
427
+ transformer: ObjectID.getDatabaseTransformer(),
428
+ })
429
+ public userId?: ObjectID = undefined;
430
+
431
+ @ColumnAccessControl({
432
+ create: [],
433
+ read: [
434
+ Permission.ProjectOwner,
435
+ Permission.ProjectAdmin,
436
+ Permission.ProjectMember,
437
+ Permission.Viewer,
438
+ Permission.ReadTelegramLog,
439
+ Permission.ReadAllProjectResources,
440
+ ],
441
+ update: [],
442
+ })
443
+ @TableColumn({
444
+ manyToOneRelationColumn: "alertId",
445
+ type: TableColumnType.Entity,
446
+ modelType: Alert,
447
+ title: "Alert",
448
+ description: "Alert associated with this message (if any)",
449
+ })
450
+ @ManyToOne(
451
+ () => {
452
+ return Alert;
453
+ },
454
+ {
455
+ eager: false,
456
+ nullable: true,
457
+ onDelete: "CASCADE",
458
+ orphanedRowAction: "nullify",
459
+ },
460
+ )
461
+ @JoinColumn({ name: "alertId" })
462
+ public alert?: Alert = undefined;
463
+
464
+ @ColumnAccessControl({
465
+ create: [],
466
+ read: [
467
+ Permission.ProjectOwner,
468
+ Permission.ProjectAdmin,
469
+ Permission.ProjectMember,
470
+ Permission.Viewer,
471
+ Permission.ReadTelegramLog,
472
+ Permission.ReadAllProjectResources,
473
+ ],
474
+ update: [],
475
+ })
476
+ @Index()
477
+ @TableColumn({
478
+ type: TableColumnType.ObjectID,
479
+ required: false,
480
+ canReadOnRelationQuery: true,
481
+ title: "Alert ID",
482
+ description: "ID of Alert associated with this message (if any)",
483
+ })
484
+ @Column({
485
+ type: ColumnType.ObjectID,
486
+ nullable: true,
487
+ transformer: ObjectID.getDatabaseTransformer(),
488
+ })
489
+ public alertId?: ObjectID = undefined;
490
+
491
+ @ColumnAccessControl({
492
+ create: [],
493
+ read: [
494
+ Permission.ProjectOwner,
495
+ Permission.ProjectAdmin,
496
+ Permission.ProjectMember,
497
+ Permission.Viewer,
498
+ Permission.ReadTelegramLog,
499
+ Permission.ReadAllProjectResources,
500
+ ],
501
+ update: [],
502
+ })
503
+ @TableColumn({
504
+ manyToOneRelationColumn: "monitorId",
505
+ type: TableColumnType.Entity,
506
+ modelType: Monitor,
507
+ title: "Monitor",
508
+ description: "Monitor associated with this message (if any)",
509
+ })
510
+ @ManyToOne(
511
+ () => {
512
+ return Monitor;
513
+ },
514
+ {
515
+ eager: false,
516
+ nullable: true,
517
+ onDelete: "CASCADE",
518
+ orphanedRowAction: "nullify",
519
+ },
520
+ )
521
+ @JoinColumn({ name: "monitorId" })
522
+ public monitor?: Monitor = undefined;
523
+
524
+ @ColumnAccessControl({
525
+ create: [],
526
+ read: [
527
+ Permission.ProjectOwner,
528
+ Permission.ProjectAdmin,
529
+ Permission.ProjectMember,
530
+ Permission.Viewer,
531
+ Permission.ReadTelegramLog,
532
+ Permission.ReadAllProjectResources,
533
+ ],
534
+ update: [],
535
+ })
536
+ @Index()
537
+ @TableColumn({
538
+ type: TableColumnType.ObjectID,
539
+ required: false,
540
+ canReadOnRelationQuery: true,
541
+ title: "Monitor ID",
542
+ description: "ID of Monitor associated with this message (if any)",
543
+ })
544
+ @Column({
545
+ type: ColumnType.ObjectID,
546
+ nullable: true,
547
+ transformer: ObjectID.getDatabaseTransformer(),
548
+ })
549
+ public monitorId?: ObjectID = undefined;
550
+
551
+ @ColumnAccessControl({
552
+ create: [],
553
+ read: [
554
+ Permission.ProjectOwner,
555
+ Permission.ProjectAdmin,
556
+ Permission.ProjectMember,
557
+ Permission.Viewer,
558
+ Permission.ReadTelegramLog,
559
+ Permission.ReadAllProjectResources,
560
+ ],
561
+ update: [],
562
+ })
563
+ @TableColumn({
564
+ manyToOneRelationColumn: "scheduledMaintenanceId",
565
+ type: TableColumnType.Entity,
566
+ modelType: ScheduledMaintenance,
567
+ title: "Scheduled Maintenance",
568
+ description: "Scheduled Maintenance associated with this message (if any)",
569
+ })
570
+ @ManyToOne(
571
+ () => {
572
+ return ScheduledMaintenance;
573
+ },
574
+ {
575
+ eager: false,
576
+ nullable: true,
577
+ onDelete: "CASCADE",
578
+ orphanedRowAction: "nullify",
579
+ },
580
+ )
581
+ @JoinColumn({ name: "scheduledMaintenanceId" })
582
+ public scheduledMaintenance?: ScheduledMaintenance = undefined;
583
+
584
+ @ColumnAccessControl({
585
+ create: [],
586
+ read: [
587
+ Permission.ProjectOwner,
588
+ Permission.ProjectAdmin,
589
+ Permission.ProjectMember,
590
+ Permission.Viewer,
591
+ Permission.ReadTelegramLog,
592
+ Permission.ReadAllProjectResources,
593
+ ],
594
+ update: [],
595
+ })
596
+ @Index()
597
+ @TableColumn({
598
+ type: TableColumnType.ObjectID,
599
+ required: false,
600
+ canReadOnRelationQuery: true,
601
+ title: "Scheduled Maintenance ID",
602
+ description:
603
+ "ID of Scheduled Maintenance associated with this message (if any)",
604
+ })
605
+ @Column({
606
+ type: ColumnType.ObjectID,
607
+ nullable: true,
608
+ transformer: ObjectID.getDatabaseTransformer(),
609
+ })
610
+ public scheduledMaintenanceId?: ObjectID = undefined;
611
+
612
+ @ColumnAccessControl({
613
+ create: [],
614
+ read: [
615
+ Permission.ProjectOwner,
616
+ Permission.ProjectAdmin,
617
+ Permission.ProjectMember,
618
+ Permission.Viewer,
619
+ Permission.ReadTelegramLog,
620
+ Permission.ReadAllProjectResources,
621
+ ],
622
+ update: [],
623
+ })
624
+ @TableColumn({
625
+ manyToOneRelationColumn: "statusPageId",
626
+ type: TableColumnType.Entity,
627
+ modelType: StatusPage,
628
+ title: "Status Page",
629
+ description: "Status Page associated with this message (if any)",
630
+ })
631
+ @ManyToOne(
632
+ () => {
633
+ return StatusPage;
634
+ },
635
+ {
636
+ eager: false,
637
+ nullable: true,
638
+ onDelete: "CASCADE",
639
+ orphanedRowAction: "nullify",
640
+ },
641
+ )
642
+ @JoinColumn({ name: "statusPageId" })
643
+ public statusPage?: StatusPage = undefined;
644
+
645
+ @ColumnAccessControl({
646
+ create: [],
647
+ read: [
648
+ Permission.ProjectOwner,
649
+ Permission.ProjectAdmin,
650
+ Permission.ProjectMember,
651
+ Permission.Viewer,
652
+ Permission.ReadTelegramLog,
653
+ Permission.ReadAllProjectResources,
654
+ ],
655
+ update: [],
656
+ })
657
+ @Index()
658
+ @TableColumn({
659
+ type: TableColumnType.ObjectID,
660
+ required: false,
661
+ canReadOnRelationQuery: true,
662
+ title: "Status Page ID",
663
+ description: "ID of Status Page associated with this message (if any)",
664
+ })
665
+ @Column({
666
+ type: ColumnType.ObjectID,
667
+ nullable: true,
668
+ transformer: ObjectID.getDatabaseTransformer(),
669
+ })
670
+ public statusPageId?: ObjectID = undefined;
671
+
672
+ @ColumnAccessControl({
673
+ create: [],
674
+ read: [
675
+ Permission.ProjectOwner,
676
+ Permission.ProjectAdmin,
677
+ Permission.ProjectMember,
678
+ Permission.Viewer,
679
+ Permission.ReadTelegramLog,
680
+ Permission.ReadAllProjectResources,
681
+ ],
682
+ update: [],
683
+ })
684
+ @TableColumn({
685
+ manyToOneRelationColumn: "statusPageAnnouncementId",
686
+ type: TableColumnType.Entity,
687
+ modelType: StatusPageAnnouncement,
688
+ title: "Status Page Announcement",
689
+ description:
690
+ "Status Page Announcement associated with this message (if any)",
691
+ })
692
+ @ManyToOne(
693
+ () => {
694
+ return StatusPageAnnouncement;
695
+ },
696
+ {
697
+ eager: false,
698
+ nullable: true,
699
+ onDelete: "CASCADE",
700
+ orphanedRowAction: "nullify",
701
+ },
702
+ )
703
+ @JoinColumn({ name: "statusPageAnnouncementId" })
704
+ public statusPageAnnouncement?: StatusPageAnnouncement = undefined;
705
+
706
+ @ColumnAccessControl({
707
+ create: [],
708
+ read: [
709
+ Permission.ProjectOwner,
710
+ Permission.ProjectAdmin,
711
+ Permission.ProjectMember,
712
+ Permission.Viewer,
713
+ Permission.ReadTelegramLog,
714
+ Permission.ReadAllProjectResources,
715
+ ],
716
+ update: [],
717
+ })
718
+ @Index()
719
+ @TableColumn({
720
+ type: TableColumnType.ObjectID,
721
+ required: false,
722
+ canReadOnRelationQuery: true,
723
+ title: "Status Page Announcement ID",
724
+ description:
725
+ "ID of Status Page Announcement associated with this message (if any)",
726
+ })
727
+ @Column({
728
+ type: ColumnType.ObjectID,
729
+ nullable: true,
730
+ transformer: ObjectID.getDatabaseTransformer(),
731
+ })
732
+ public statusPageAnnouncementId?: ObjectID = undefined;
733
+
734
+ @ColumnAccessControl({
735
+ create: [],
736
+ read: [
737
+ Permission.ProjectOwner,
738
+ Permission.ProjectAdmin,
739
+ Permission.ProjectMember,
740
+ Permission.Viewer,
741
+ Permission.ReadTelegramLog,
742
+ Permission.ReadAllProjectResources,
743
+ ],
744
+ update: [],
745
+ })
746
+ @TableColumn({
747
+ manyToOneRelationColumn: "teamId",
748
+ type: TableColumnType.Entity,
749
+ modelType: Team,
750
+ title: "Team",
751
+ description: "Team associated with this message (if any)",
752
+ })
753
+ @ManyToOne(
754
+ () => {
755
+ return Team;
756
+ },
757
+ {
758
+ eager: false,
759
+ nullable: true,
760
+ onDelete: "CASCADE",
761
+ orphanedRowAction: "nullify",
762
+ },
763
+ )
764
+ @JoinColumn({ name: "teamId" })
765
+ public team?: Team = undefined;
766
+
767
+ @ColumnAccessControl({
768
+ create: [],
769
+ read: [
770
+ Permission.ProjectOwner,
771
+ Permission.ProjectAdmin,
772
+ Permission.ProjectMember,
773
+ Permission.Viewer,
774
+ Permission.ReadTelegramLog,
775
+ Permission.ReadAllProjectResources,
776
+ ],
777
+ update: [],
778
+ })
779
+ @Index()
780
+ @TableColumn({
781
+ type: TableColumnType.ObjectID,
782
+ required: false,
783
+ canReadOnRelationQuery: true,
784
+ title: "Team ID",
785
+ description: "ID of Team associated with this message (if any)",
786
+ })
787
+ @Column({
788
+ type: ColumnType.ObjectID,
789
+ nullable: true,
790
+ transformer: ObjectID.getDatabaseTransformer(),
791
+ })
792
+ public teamId?: ObjectID = undefined;
793
+
794
+ @ColumnAccessControl({
795
+ create: [],
796
+ read: [
797
+ Permission.ProjectOwner,
798
+ Permission.ProjectAdmin,
799
+ Permission.ProjectMember,
800
+ Permission.Viewer,
801
+ Permission.ReadTelegramLog,
802
+ Permission.ReadAllProjectResources,
803
+ ],
804
+ update: [],
805
+ })
806
+ @TableColumn({
807
+ manyToOneRelationColumn: "onCallDutyPolicyId",
808
+ type: TableColumnType.Entity,
809
+ modelType: OnCallDutyPolicy,
810
+ title: "On-Call Duty Policy",
811
+ description: "On-Call Duty Policy associated with this message (if any)",
812
+ })
813
+ @ManyToOne(
814
+ () => {
815
+ return OnCallDutyPolicy;
816
+ },
817
+ {
818
+ eager: false,
819
+ nullable: true,
820
+ onDelete: "CASCADE",
821
+ orphanedRowAction: "nullify",
822
+ },
823
+ )
824
+ @JoinColumn({ name: "onCallDutyPolicyId" })
825
+ public onCallDutyPolicy?: OnCallDutyPolicy = undefined;
826
+
827
+ @ColumnAccessControl({
828
+ create: [],
829
+ read: [
830
+ Permission.ProjectOwner,
831
+ Permission.ProjectAdmin,
832
+ Permission.ProjectMember,
833
+ Permission.Viewer,
834
+ Permission.ReadTelegramLog,
835
+ Permission.ReadAllProjectResources,
836
+ ],
837
+ update: [],
838
+ })
839
+ @Index()
840
+ @TableColumn({
841
+ type: TableColumnType.ObjectID,
842
+ required: false,
843
+ canReadOnRelationQuery: true,
844
+ title: "On-Call Duty Policy ID",
845
+ description:
846
+ "ID of On-Call Duty Policy associated with this message (if any)",
847
+ })
848
+ @Column({
849
+ type: ColumnType.ObjectID,
850
+ nullable: true,
851
+ transformer: ObjectID.getDatabaseTransformer(),
852
+ })
853
+ public onCallDutyPolicyId?: ObjectID = undefined;
854
+
855
+ @ColumnAccessControl({
856
+ create: [],
857
+ read: [
858
+ Permission.ProjectOwner,
859
+ Permission.ProjectAdmin,
860
+ Permission.ProjectMember,
861
+ Permission.Viewer,
862
+ Permission.ReadTelegramLog,
863
+ Permission.ReadAllProjectResources,
864
+ ],
865
+ update: [],
866
+ })
867
+ @TableColumn({
868
+ manyToOneRelationColumn: "onCallDutyPolicyEscalationRuleId",
869
+ type: TableColumnType.Entity,
870
+ modelType: OnCallDutyPolicyEscalationRule,
871
+ title: "On-Call Duty Policy Escalation Rule",
872
+ description:
873
+ "On-Call Duty Policy Escalation Rule associated with this message (if any)",
874
+ })
875
+ @ManyToOne(
876
+ () => {
877
+ return OnCallDutyPolicyEscalationRule;
878
+ },
879
+ {
880
+ eager: false,
881
+ nullable: true,
882
+ onDelete: "CASCADE",
883
+ orphanedRowAction: "nullify",
884
+ },
885
+ )
886
+ @JoinColumn({ name: "onCallDutyPolicyEscalationRuleId" })
887
+ public onCallDutyPolicyEscalationRule?: OnCallDutyPolicyEscalationRule =
888
+ undefined;
889
+
890
+ @ColumnAccessControl({
891
+ create: [],
892
+ read: [
893
+ Permission.ProjectOwner,
894
+ Permission.ProjectAdmin,
895
+ Permission.ProjectMember,
896
+ Permission.Viewer,
897
+ Permission.ReadTelegramLog,
898
+ Permission.ReadAllProjectResources,
899
+ ],
900
+ update: [],
901
+ })
902
+ @Index()
903
+ @TableColumn({
904
+ type: TableColumnType.ObjectID,
905
+ required: false,
906
+ canReadOnRelationQuery: true,
907
+ title: "On-Call Duty Policy Escalation Rule ID",
908
+ description:
909
+ "ID of On-Call Duty Policy Escalation Rule associated with this message (if any)",
910
+ })
911
+ @Column({
912
+ type: ColumnType.ObjectID,
913
+ nullable: true,
914
+ transformer: ObjectID.getDatabaseTransformer(),
915
+ })
916
+ public onCallDutyPolicyEscalationRuleId?: ObjectID = undefined;
917
+
918
+ @ColumnAccessControl({
919
+ create: [],
920
+ read: [
921
+ Permission.ProjectOwner,
922
+ Permission.ProjectAdmin,
923
+ Permission.ProjectMember,
924
+ Permission.Viewer,
925
+ Permission.ReadTelegramLog,
926
+ Permission.ReadAllProjectResources,
927
+ ],
928
+ update: [],
929
+ })
930
+ @TableColumn({
931
+ manyToOneRelationColumn: "onCallDutyPolicyScheduleId",
932
+ type: TableColumnType.Entity,
933
+ modelType: OnCallDutyPolicySchedule,
934
+ title: "On-Call Duty Policy Schedule",
935
+ description:
936
+ "On-Call Duty Policy Schedule associated with this message (if any)",
937
+ })
938
+ @ManyToOne(
939
+ () => {
940
+ return OnCallDutyPolicySchedule;
941
+ },
942
+ {
943
+ eager: false,
944
+ nullable: true,
945
+ onDelete: "CASCADE",
946
+ orphanedRowAction: "nullify",
947
+ },
948
+ )
949
+ @JoinColumn({ name: "onCallDutyPolicyScheduleId" })
950
+ public onCallDutyPolicySchedule?: OnCallDutyPolicySchedule = undefined;
951
+
952
+ @ColumnAccessControl({
953
+ create: [],
954
+ read: [
955
+ Permission.ProjectOwner,
956
+ Permission.ProjectAdmin,
957
+ Permission.ProjectMember,
958
+ Permission.Viewer,
959
+ Permission.ReadTelegramLog,
960
+ Permission.ReadAllProjectResources,
961
+ ],
962
+ update: [],
963
+ })
964
+ @Index()
965
+ @TableColumn({
966
+ type: TableColumnType.ObjectID,
967
+ required: false,
968
+ canReadOnRelationQuery: true,
969
+ title: "On-Call Duty Policy Schedule ID",
970
+ description:
971
+ "ID of On-Call Duty Policy Schedule associated with this message (if any)",
972
+ })
973
+ @Column({
974
+ type: ColumnType.ObjectID,
975
+ nullable: true,
976
+ transformer: ObjectID.getDatabaseTransformer(),
977
+ })
978
+ public onCallDutyPolicyScheduleId?: ObjectID = undefined;
979
+
980
+ @ColumnAccessControl({
981
+ create: [],
982
+ read: [],
983
+ update: [],
984
+ })
985
+ @TableColumn({
986
+ manyToOneRelationColumn: "deletedByUserId",
987
+ type: TableColumnType.Entity,
988
+ title: "Deleted by User",
989
+ modelType: User,
990
+ description:
991
+ "Relation to User who deleted this object (if this object was deleted by a User)",
992
+ })
993
+ @ManyToOne(
994
+ () => {
995
+ return User;
996
+ },
997
+ {
998
+ cascade: false,
999
+ eager: false,
1000
+ nullable: true,
1001
+ onDelete: "SET NULL",
1002
+ orphanedRowAction: "nullify",
1003
+ },
1004
+ )
1005
+ @JoinColumn({ name: "deletedByUserId" })
1006
+ public deletedByUser?: User = undefined;
1007
+
1008
+ @ColumnAccessControl({
1009
+ create: [],
1010
+ read: [],
1011
+ update: [],
1012
+ })
1013
+ @TableColumn({
1014
+ type: TableColumnType.ObjectID,
1015
+ title: "Deleted by User ID",
1016
+ description:
1017
+ "User ID who deleted this object (if this object was deleted by a User)",
1018
+ })
1019
+ @Column({
1020
+ type: ColumnType.ObjectID,
1021
+ nullable: true,
1022
+ transformer: ObjectID.getDatabaseTransformer(),
1023
+ })
1024
+ public deletedByUserId?: ObjectID = undefined;
1025
+ }