@oneuptime/common 7.0.4220 → 7.0.4222

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 (121) hide show
  1. package/Models/AnalyticsModels/AnalyticsBaseModel/CommonModel.ts +4 -0
  2. package/Models/DatabaseModels/Index.ts +4 -0
  3. package/Models/DatabaseModels/OnCallDutyPolicyTimeLog.ts +498 -0
  4. package/Models/DatabaseModels/UserNotificationRule.ts +0 -2
  5. package/Models/DatabaseModels/WorkspaceNotificationRule.ts +2 -2
  6. package/Models/DatabaseModels/WorkspaceProjectAuthToken.ts +0 -2
  7. package/Models/DatabaseModels/WorkspaceSetting.ts +0 -2
  8. package/Models/DatabaseModels/WorkspaceUserAuthToken.ts +0 -2
  9. package/Server/Infrastructure/Postgres/SchemaMigrations/1747305098533-MigrationName.ts +69 -0
  10. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
  11. package/Server/Services/Index.ts +3 -0
  12. package/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.ts +25 -0
  13. package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +29 -0
  14. package/Server/Services/OnCallDutyPolicyScheduleService.ts +73 -0
  15. package/Server/Services/OnCallDutyPolicyTimeLogService.ts +175 -0
  16. package/Server/Services/TeamMemberService.ts +10 -0
  17. package/Server/Services/WorkspaceNotificationRuleService.ts +1 -1
  18. package/Server/Types/Database/QueryHelper.ts +15 -0
  19. package/Server/Types/Database/QueryUtil.ts +18 -0
  20. package/Server/Utils/AnalyticsDatabase/Statement.ts +5 -1
  21. package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +16 -0
  22. package/Tests/Types/JSON.test.ts +2 -0
  23. package/Types/BaseDatabase/GreaterThan.ts +11 -0
  24. package/Types/BaseDatabase/GreaterThanOrEqual.ts +11 -0
  25. package/Types/BaseDatabase/GreaterThanOrNull.ts +39 -0
  26. package/Types/BaseDatabase/LessThan.ts +11 -0
  27. package/Types/BaseDatabase/LessThanOrEqual.ts +11 -0
  28. package/Types/BaseDatabase/LessThanOrNull.ts +39 -0
  29. package/Types/Date.ts +18 -0
  30. package/Types/JSON.ts +8 -0
  31. package/Types/Permission.ts +11 -0
  32. package/Types/SerializableObjectDictionary.ts +4 -0
  33. package/Types/Time/RangeStartAndEndDateTime.ts +98 -0
  34. package/Types/Time/TimeRange.ts +15 -0
  35. package/UI/Components/BulkUpdate/BulkUpdateForm.tsx +3 -3
  36. package/UI/Components/Date/RangeStartAndEndDateEdit.tsx +64 -0
  37. package/UI/Components/Date/RangeStartAndEndDateView.tsx +86 -0
  38. package/UI/Components/Filters/FilterViewer.tsx +5 -5
  39. package/UI/Components/Table/LocalTable.tsx +74 -0
  40. package/UI/Components/Table/Table.tsx +33 -24
  41. package/UI/Components/Table/TableBody.tsx +5 -1
  42. package/build/dist/Models/AnalyticsModels/AnalyticsBaseModel/CommonModel.js.map +1 -1
  43. package/build/dist/Models/DatabaseModels/Index.js +2 -0
  44. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  45. package/build/dist/Models/DatabaseModels/OnCallDutyPolicyTimeLog.js +522 -0
  46. package/build/dist/Models/DatabaseModels/OnCallDutyPolicyTimeLog.js.map +1 -0
  47. package/build/dist/Models/DatabaseModels/UserNotificationRule.js +0 -2
  48. package/build/dist/Models/DatabaseModels/UserNotificationRule.js.map +1 -1
  49. package/build/dist/Models/DatabaseModels/WorkspaceNotificationRule.js +2 -2
  50. package/build/dist/Models/DatabaseModels/WorkspaceNotificationRule.js.map +1 -1
  51. package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js +0 -2
  52. package/build/dist/Models/DatabaseModels/WorkspaceProjectAuthToken.js.map +1 -1
  53. package/build/dist/Models/DatabaseModels/WorkspaceSetting.js +0 -2
  54. package/build/dist/Models/DatabaseModels/WorkspaceSetting.js.map +1 -1
  55. package/build/dist/Models/DatabaseModels/WorkspaceUserAuthToken.js +0 -2
  56. package/build/dist/Models/DatabaseModels/WorkspaceUserAuthToken.js.map +1 -1
  57. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1747305098533-MigrationName.js +30 -0
  58. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1747305098533-MigrationName.js.map +1 -0
  59. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
  60. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  61. package/build/dist/Server/Services/Index.js +2 -0
  62. package/build/dist/Server/Services/Index.js.map +1 -1
  63. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js +20 -0
  64. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js.map +1 -1
  65. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +24 -0
  66. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
  67. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +58 -0
  68. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
  69. package/build/dist/Server/Services/OnCallDutyPolicyTimeLogService.js +107 -0
  70. package/build/dist/Server/Services/OnCallDutyPolicyTimeLogService.js.map +1 -0
  71. package/build/dist/Server/Services/TeamMemberService.js +9 -0
  72. package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
  73. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +8 -8
  74. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
  75. package/build/dist/Server/Types/Database/QueryHelper.js +21 -7
  76. package/build/dist/Server/Types/Database/QueryHelper.js.map +1 -1
  77. package/build/dist/Server/Types/Database/QueryUtil.js +12 -0
  78. package/build/dist/Server/Types/Database/QueryUtil.js.map +1 -1
  79. package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js +5 -1
  80. package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js.map +1 -1
  81. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +14 -0
  82. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
  83. package/build/dist/Tests/Types/JSON.test.js +2 -0
  84. package/build/dist/Tests/Types/JSON.test.js.map +1 -1
  85. package/build/dist/Types/BaseDatabase/GreaterThan.js +8 -0
  86. package/build/dist/Types/BaseDatabase/GreaterThan.js.map +1 -1
  87. package/build/dist/Types/BaseDatabase/GreaterThanOrEqual.js +8 -0
  88. package/build/dist/Types/BaseDatabase/GreaterThanOrEqual.js.map +1 -1
  89. package/build/dist/Types/BaseDatabase/GreaterThanOrNull.js +29 -0
  90. package/build/dist/Types/BaseDatabase/GreaterThanOrNull.js.map +1 -0
  91. package/build/dist/Types/BaseDatabase/LessThan.js +8 -0
  92. package/build/dist/Types/BaseDatabase/LessThan.js.map +1 -1
  93. package/build/dist/Types/BaseDatabase/LessThanOrEqual.js +8 -0
  94. package/build/dist/Types/BaseDatabase/LessThanOrEqual.js.map +1 -1
  95. package/build/dist/Types/BaseDatabase/LessThanOrNull.js +29 -0
  96. package/build/dist/Types/BaseDatabase/LessThanOrNull.js.map +1 -0
  97. package/build/dist/Types/Date.js +12 -0
  98. package/build/dist/Types/Date.js.map +1 -1
  99. package/build/dist/Types/JSON.js +2 -0
  100. package/build/dist/Types/JSON.js.map +1 -1
  101. package/build/dist/Types/Permission.js +8 -0
  102. package/build/dist/Types/Permission.js.map +1 -1
  103. package/build/dist/Types/SerializableObjectDictionary.js +4 -0
  104. package/build/dist/Types/SerializableObjectDictionary.js.map +1 -1
  105. package/build/dist/Types/Time/RangeStartAndEndDateTime.js +48 -0
  106. package/build/dist/Types/Time/RangeStartAndEndDateTime.js.map +1 -0
  107. package/build/dist/Types/Time/TimeRange.js +16 -0
  108. package/build/dist/Types/Time/TimeRange.js.map +1 -0
  109. package/build/dist/UI/Components/Date/RangeStartAndEndDateEdit.js +32 -0
  110. package/build/dist/UI/Components/Date/RangeStartAndEndDateEdit.js.map +1 -0
  111. package/build/dist/UI/Components/Date/RangeStartAndEndDateView.js +43 -0
  112. package/build/dist/UI/Components/Date/RangeStartAndEndDateView.js.map +1 -0
  113. package/build/dist/UI/Components/Filters/FilterViewer.js +3 -3
  114. package/build/dist/UI/Components/Filters/FilterViewer.js.map +1 -1
  115. package/build/dist/UI/Components/Table/LocalTable.js +32 -0
  116. package/build/dist/UI/Components/Table/LocalTable.js.map +1 -0
  117. package/build/dist/UI/Components/Table/Table.js +19 -8
  118. package/build/dist/UI/Components/Table/Table.js.map +1 -1
  119. package/build/dist/UI/Components/Table/TableBody.js +3 -0
  120. package/build/dist/UI/Components/Table/TableBody.js.map +1 -1
  121. package/package.json +2 -2
@@ -3,10 +3,12 @@ import AnalyticsTableColumn from "../../../Types/AnalyticsDatabase/TableColumn";
3
3
  import TableColumnType from "../../../Types/AnalyticsDatabase/TableColumnType";
4
4
  import GreaterThan from "../../../Types/BaseDatabase/GreaterThan";
5
5
  import GreaterThanOrEqual from "../../../Types/BaseDatabase/GreaterThanOrEqual";
6
+ import GreaterThanOrNull from "../../../Types/BaseDatabase/GreaterThanOrNull";
6
7
  import InBetween from "../../../Types/BaseDatabase/InBetween";
7
8
  import Includes from "../../../Types/BaseDatabase/Includes";
8
9
  import LessThan from "../../../Types/BaseDatabase/LessThan";
9
10
  import LessThanOrEqual from "../../../Types/BaseDatabase/LessThanOrEqual";
11
+ import LessThanOrNull from "../../../Types/BaseDatabase/LessThanOrNull";
10
12
  import NotEqual from "../../../Types/BaseDatabase/NotEqual";
11
13
  import Search from "../../../Types/BaseDatabase/Search";
12
14
  import { CompareType } from "../../../Types/Database/CompareBase";
@@ -31,6 +33,8 @@ export type RecordValue =
31
33
  | LessThan<CompareType>
32
34
  | LessThanOrEqual<CompareType>
33
35
  | GreaterThanOrEqual<CompareType>
36
+ | GreaterThanOrNull<CompareType>
37
+ | LessThanOrNull<CompareType>
34
38
  | Array<number>
35
39
  | Array<string>
36
40
  | Array<ObjectID>
@@ -68,6 +68,8 @@ import OnCallDutyPolicyFeed from "./OnCallDutyPolicyFeed";
68
68
  import OnCallDutyPolicySchedule from "./OnCallDutyPolicySchedule";
69
69
  import OnCallDutyPolicyScheduleLayer from "./OnCallDutyPolicyScheduleLayer";
70
70
  import OnCallDutyPolicyScheduleLayerUser from "./OnCallDutyPolicyScheduleLayerUser";
71
+ import OnCallDutyPolicyTimeLog from "./OnCallDutyPolicyTimeLog";
72
+
71
73
  import Probe from "./Probe";
72
74
  import ProbeOwnerTeam from "./ProbeOwnerTeam";
73
75
  import ProbeOwnerUser from "./ProbeOwnerUser";
@@ -372,6 +374,8 @@ const AllModelTypes: Array<{
372
374
  MonitorFeed,
373
375
 
374
376
  MetricType,
377
+
378
+ OnCallDutyPolicyTimeLog,
375
379
  ];
376
380
 
377
381
  const modelTypeMap: { [key: string]: { new (): BaseModel } } = {};
@@ -0,0 +1,498 @@
1
+ import Project from "./Project";
2
+ import User from "./User";
3
+ import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
4
+ import Route from "../../Types/API/Route";
5
+ import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
6
+ import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
7
+ import ColumnType from "../../Types/Database/ColumnType";
8
+ import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
9
+ import EnableDocumentation from "../../Types/Database/EnableDocumentation";
10
+ import TableColumn from "../../Types/Database/TableColumn";
11
+ import TableColumnType from "../../Types/Database/TableColumnType";
12
+ import TableMetadata from "../../Types/Database/TableMetadata";
13
+ import TenantColumn from "../../Types/Database/TenantColumn";
14
+ import IconProp from "../../Types/Icon/IconProp";
15
+ import ObjectID from "../../Types/ObjectID";
16
+ import Permission from "../../Types/Permission";
17
+ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
18
+ import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
19
+ import { PlanType } from "../../Types/Billing/SubscriptionPlan";
20
+
21
+ @EnableDocumentation()
22
+ @TableBillingAccessControl({
23
+ create: PlanType.Growth,
24
+ read: PlanType.Growth,
25
+ update: PlanType.Growth,
26
+ delete: PlanType.Growth,
27
+ })
28
+ @TenantColumn("projectId")
29
+ @TableAccessControl({
30
+ create: [
31
+ Permission.ProjectOwner,
32
+ Permission.ProjectAdmin,
33
+ Permission.ProjectMember,
34
+ ],
35
+ read: [
36
+ Permission.ProjectOwner,
37
+ Permission.ProjectAdmin,
38
+ Permission.ProjectMember,
39
+ Permission.ReadOnCallDutyPolicyTimeLog,
40
+ ],
41
+ delete: [
42
+ Permission.ProjectOwner,
43
+ Permission.ProjectAdmin,
44
+ Permission.ProjectMember,
45
+ ],
46
+ update: [
47
+ Permission.ProjectOwner,
48
+ Permission.ProjectAdmin,
49
+ Permission.ProjectMember,
50
+ ],
51
+ })
52
+ @CrudApiEndpoint(new Route("/on-call-duty-policy-time-log"))
53
+ @Entity({
54
+ name: "OnCallDutyPolicyTimeLog",
55
+ })
56
+ @TableMetadata({
57
+ tableName: "OnCallDutyPolicyTimeLog",
58
+ singularName: "User Override",
59
+ pluralName: "User Overrides",
60
+ icon: IconProp.Call,
61
+ tableDescription:
62
+ "Manage on-call duty user overrides, for example if the user is on leave you can override the on-call duty policy for that user so all the alerts will be routed to the other user.",
63
+ })
64
+ export default class OnCallDutyPolicyTimeLog extends BaseModel {
65
+ @ColumnAccessControl({
66
+ create: [
67
+ Permission.ProjectOwner,
68
+ Permission.ProjectAdmin,
69
+ Permission.ProjectMember,
70
+ ],
71
+ read: [
72
+ Permission.ProjectOwner,
73
+ Permission.ProjectAdmin,
74
+ Permission.ProjectMember,
75
+ Permission.ReadOnCallDutyPolicyTimeLog,
76
+ ],
77
+ update: [],
78
+ })
79
+ @TableColumn({
80
+ manyToOneRelationColumn: "projectId",
81
+ type: TableColumnType.Entity,
82
+ modelType: Project,
83
+ title: "Project",
84
+ description: "Relation to Project Resource in which this object belongs",
85
+ })
86
+ @ManyToOne(
87
+ () => {
88
+ return Project;
89
+ },
90
+ {
91
+ eager: false,
92
+ nullable: true,
93
+ onDelete: "CASCADE",
94
+ orphanedRowAction: "nullify",
95
+ },
96
+ )
97
+ @JoinColumn({ name: "projectId" })
98
+ public project?: Project = undefined;
99
+
100
+ @ColumnAccessControl({
101
+ create: [
102
+ Permission.ProjectOwner,
103
+ Permission.ProjectAdmin,
104
+ Permission.ProjectMember,
105
+ ],
106
+ read: [
107
+ Permission.ProjectOwner,
108
+ Permission.ProjectAdmin,
109
+ Permission.ProjectMember,
110
+ Permission.ReadOnCallDutyPolicyTimeLog,
111
+ ],
112
+ update: [],
113
+ })
114
+ @Index()
115
+ @TableColumn({
116
+ type: TableColumnType.ObjectID,
117
+ required: true,
118
+ canReadOnRelationQuery: true,
119
+ title: "Project ID",
120
+ description: "ID of your OneUptime Project in which this object belongs",
121
+ })
122
+ @Column({
123
+ type: ColumnType.ObjectID,
124
+ nullable: false,
125
+ transformer: ObjectID.getDatabaseTransformer(),
126
+ })
127
+ public projectId?: ObjectID = undefined;
128
+
129
+ @ColumnAccessControl({
130
+ create: [
131
+ Permission.ProjectOwner,
132
+ Permission.ProjectAdmin,
133
+ Permission.ProjectMember,
134
+ ],
135
+ read: [
136
+ Permission.ProjectOwner,
137
+ Permission.ProjectAdmin,
138
+ Permission.ProjectMember,
139
+ Permission.ReadOnCallDutyPolicyTimeLog,
140
+ ],
141
+ update: [],
142
+ })
143
+ @Index()
144
+ @TableColumn({
145
+ type: TableColumnType.ObjectID,
146
+ required: false,
147
+ canReadOnRelationQuery: true,
148
+ title: "On-Call Policy ID",
149
+ description:
150
+ "ID of your On-Call Policy where this escalation rule belongs.",
151
+ })
152
+ @Column({
153
+ type: ColumnType.ObjectID,
154
+ nullable: true,
155
+ transformer: ObjectID.getDatabaseTransformer(),
156
+ })
157
+ public onCallDutyPolicyId?: ObjectID = undefined; // no replationship to OnCallDutyPolicy because this is a log table. We do not want logs to delete when the policy is deleted.
158
+
159
+ @ColumnAccessControl({
160
+ create: [
161
+ Permission.ProjectOwner,
162
+ Permission.ProjectAdmin,
163
+ Permission.ProjectMember,
164
+ ],
165
+ read: [
166
+ Permission.ProjectOwner,
167
+ Permission.ProjectAdmin,
168
+ Permission.ProjectMember,
169
+ Permission.ReadOnCallDutyPolicyTimeLog,
170
+ ],
171
+ update: [],
172
+ })
173
+ @Index()
174
+ @TableColumn({
175
+ type: TableColumnType.ObjectID,
176
+ required: false,
177
+ canReadOnRelationQuery: true,
178
+ title: "On-Call Policy Schedule ID",
179
+ description:
180
+ "ID of your On-Call Policy Schedule where this escalation rule belongs.",
181
+ })
182
+ @Column({
183
+ type: ColumnType.ObjectID,
184
+ nullable: true,
185
+ transformer: ObjectID.getDatabaseTransformer(),
186
+ })
187
+ public onCallDutyPolicyScheduleId?: ObjectID = undefined; // no replationship to OnCallDutyPolicy because this is a log table. We do not want logs to delete when the policy is deleted.
188
+
189
+ @ColumnAccessControl({
190
+ create: [
191
+ Permission.ProjectOwner,
192
+ Permission.ProjectAdmin,
193
+ Permission.ProjectMember,
194
+ ],
195
+ read: [
196
+ Permission.ProjectOwner,
197
+ Permission.ProjectAdmin,
198
+ Permission.ProjectMember,
199
+ Permission.ReadOnCallDutyPolicyTimeLog,
200
+ ],
201
+ update: [],
202
+ })
203
+ @Index()
204
+ @TableColumn({
205
+ type: TableColumnType.ObjectID,
206
+ required: false,
207
+ canReadOnRelationQuery: true,
208
+ title: "On-Call Policy Escalation Rule ID",
209
+ description:
210
+ "ID of your On-Call Policy Escalation Rule ID where this escalation rule belongs.",
211
+ })
212
+ @Column({
213
+ type: ColumnType.ObjectID,
214
+ nullable: true,
215
+ transformer: ObjectID.getDatabaseTransformer(),
216
+ })
217
+ public onCallDutyPolicyEscalationRuleId?: ObjectID = undefined; // no replationship to OnCallDutyPolicy because this is a log table. We do not want logs to delete when the policy is deleted.
218
+
219
+ @ColumnAccessControl({
220
+ create: [
221
+ Permission.ProjectOwner,
222
+ Permission.ProjectAdmin,
223
+ Permission.ProjectMember,
224
+ ],
225
+ read: [
226
+ Permission.ProjectOwner,
227
+ Permission.ProjectAdmin,
228
+ Permission.ProjectMember,
229
+ Permission.ReadOnCallDutyPolicyTimeLog,
230
+ ],
231
+ update: [],
232
+ })
233
+ @Index()
234
+ @TableColumn({
235
+ type: TableColumnType.ObjectID,
236
+ required: false,
237
+ canReadOnRelationQuery: true,
238
+ title: "Team ID",
239
+ description:
240
+ "ID of your On-Call Policy Team ID where this escalation rule belongs.",
241
+ })
242
+ @Column({
243
+ type: ColumnType.ObjectID,
244
+ nullable: true,
245
+ transformer: ObjectID.getDatabaseTransformer(),
246
+ })
247
+ public teamId?: ObjectID = undefined; // no replationship to OnCallDutyPolicy because this is a log table. We do not want logs to delete when the policy is deleted.
248
+
249
+ @ColumnAccessControl({
250
+ create: [
251
+ Permission.ProjectOwner,
252
+ Permission.ProjectAdmin,
253
+ Permission.ProjectMember,
254
+ ],
255
+ read: [
256
+ Permission.ProjectOwner,
257
+ Permission.ProjectAdmin,
258
+ Permission.ProjectMember,
259
+ Permission.ReadOnCallDutyPolicyTimeLog,
260
+ ],
261
+ update: [],
262
+ })
263
+ @TableColumn({
264
+ type: TableColumnType.VeryLongText,
265
+ required: false,
266
+ canReadOnRelationQuery: true,
267
+ title: "More Info",
268
+ description: "More information about this log record.",
269
+ })
270
+ @Column({
271
+ type: ColumnType.VeryLongText,
272
+ nullable: true,
273
+ })
274
+ public moreInfo?: string = undefined; // no replationship to OnCallDutyPolicy because this is a log table. We do not want logs to delete when the policy is deleted.
275
+
276
+ @ColumnAccessControl({
277
+ create: [
278
+ Permission.ProjectOwner,
279
+ Permission.ProjectAdmin,
280
+ Permission.ProjectMember,
281
+ ],
282
+ read: [
283
+ Permission.ProjectOwner,
284
+ Permission.ProjectAdmin,
285
+ Permission.ProjectMember,
286
+ Permission.ReadOnCallDutyPolicyTimeLog,
287
+ ],
288
+ update: [],
289
+ })
290
+ @TableColumn({
291
+ manyToOneRelationColumn: "createdByUserId",
292
+ type: TableColumnType.Entity,
293
+ modelType: User,
294
+ title: "Created by User",
295
+ description:
296
+ "Relation to User who created this object (if this object was created by a User)",
297
+ })
298
+ @ManyToOne(
299
+ () => {
300
+ return User;
301
+ },
302
+ {
303
+ eager: false,
304
+ nullable: true,
305
+ onDelete: "SET NULL",
306
+ orphanedRowAction: "nullify",
307
+ },
308
+ )
309
+ @JoinColumn({ name: "createdByUserId" })
310
+ public createdByUser?: User = undefined;
311
+
312
+ @ColumnAccessControl({
313
+ create: [
314
+ Permission.ProjectOwner,
315
+ Permission.ProjectAdmin,
316
+ Permission.ProjectMember,
317
+ ],
318
+ read: [
319
+ Permission.ProjectOwner,
320
+ Permission.ProjectAdmin,
321
+ Permission.ProjectMember,
322
+ Permission.ReadOnCallDutyPolicyTimeLog,
323
+ ],
324
+ update: [],
325
+ })
326
+ @TableColumn({
327
+ type: TableColumnType.ObjectID,
328
+ title: "Created by User ID",
329
+ description:
330
+ "User ID who created this object (if this object was created by a User)",
331
+ })
332
+ @Column({
333
+ type: ColumnType.ObjectID,
334
+ nullable: true,
335
+ transformer: ObjectID.getDatabaseTransformer(),
336
+ })
337
+ public createdByUserId?: ObjectID = undefined;
338
+
339
+ @ColumnAccessControl({
340
+ create: [
341
+ Permission.ProjectOwner,
342
+ Permission.ProjectAdmin,
343
+ Permission.ProjectMember,
344
+ ],
345
+ read: [
346
+ Permission.ProjectOwner,
347
+ Permission.ProjectAdmin,
348
+ Permission.ProjectMember,
349
+ Permission.ReadOnCallDutyPolicyTimeLog,
350
+ ],
351
+ update: [],
352
+ })
353
+ @TableColumn({
354
+ manyToOneRelationColumn: "userId",
355
+ type: TableColumnType.Entity,
356
+ modelType: User,
357
+ title: "Override User",
358
+ description:
359
+ "Relation to User who is being overridden by this object (if this object was created by a User)",
360
+ })
361
+ @ManyToOne(
362
+ () => {
363
+ return User;
364
+ },
365
+ {
366
+ eager: false,
367
+ nullable: true,
368
+ onDelete: "SET NULL",
369
+ orphanedRowAction: "nullify",
370
+ },
371
+ )
372
+ @JoinColumn({ name: "userId" })
373
+ public user?: User = undefined;
374
+
375
+ @ColumnAccessControl({
376
+ create: [
377
+ Permission.ProjectOwner,
378
+ Permission.ProjectAdmin,
379
+ Permission.ProjectMember,
380
+ ],
381
+ read: [
382
+ Permission.ProjectOwner,
383
+ Permission.ProjectAdmin,
384
+ Permission.ProjectMember,
385
+ Permission.ReadOnCallDutyPolicyTimeLog,
386
+ ],
387
+ update: [],
388
+ })
389
+ @TableColumn({
390
+ type: TableColumnType.ObjectID,
391
+ required: true,
392
+ title: "User ID",
393
+ description: "User ID for which this log belongs",
394
+ })
395
+ @Column({
396
+ type: ColumnType.ObjectID,
397
+ nullable: false,
398
+ transformer: ObjectID.getDatabaseTransformer(),
399
+ })
400
+ public userId?: ObjectID = undefined;
401
+
402
+ @TableColumn({
403
+ title: "Start At",
404
+ type: TableColumnType.Date,
405
+ required: true,
406
+ description: "When does this start?",
407
+ })
408
+ @ColumnAccessControl({
409
+ create: [
410
+ Permission.ProjectOwner,
411
+ Permission.ProjectAdmin,
412
+ Permission.ProjectMember,
413
+ ],
414
+ read: [
415
+ Permission.ProjectOwner,
416
+ Permission.ProjectAdmin,
417
+ Permission.ProjectMember,
418
+ Permission.ReadOnCallDutyPolicyTimeLog,
419
+ ],
420
+ update: [],
421
+ })
422
+ @Column({
423
+ nullable: false,
424
+ type: ColumnType.Date,
425
+ })
426
+ public startsAt?: Date = undefined;
427
+
428
+ @TableColumn({
429
+ title: "Ends At",
430
+ type: TableColumnType.Date,
431
+ required: false,
432
+ description: "When does this end?",
433
+ })
434
+ @ColumnAccessControl({
435
+ create: [
436
+ Permission.ProjectOwner,
437
+ Permission.ProjectAdmin,
438
+ Permission.ProjectMember,
439
+ ],
440
+ read: [
441
+ Permission.ProjectOwner,
442
+ Permission.ProjectAdmin,
443
+ Permission.ProjectMember,
444
+ Permission.ReadOnCallDutyPolicyTimeLog,
445
+ ],
446
+ update: [],
447
+ })
448
+ @Column({
449
+ nullable: true,
450
+ type: ColumnType.Date,
451
+ })
452
+ public endsAt?: Date = undefined; // this user is still on-call. Then this will be null.
453
+
454
+ @ColumnAccessControl({
455
+ create: [],
456
+ read: [],
457
+ update: [],
458
+ })
459
+ @TableColumn({
460
+ manyToOneRelationColumn: "deletedByUserId",
461
+ type: TableColumnType.Entity,
462
+ title: "Deleted by User",
463
+ description:
464
+ "Relation to User who deleted this object (if this object was deleted by a User)",
465
+ })
466
+ @ManyToOne(
467
+ () => {
468
+ return User;
469
+ },
470
+ {
471
+ cascade: false,
472
+ eager: false,
473
+ nullable: true,
474
+ onDelete: "SET NULL",
475
+ orphanedRowAction: "nullify",
476
+ },
477
+ )
478
+ @JoinColumn({ name: "deletedByUserId" })
479
+ public deletedByUser?: User = undefined;
480
+
481
+ @ColumnAccessControl({
482
+ create: [],
483
+ read: [],
484
+ update: [],
485
+ })
486
+ @TableColumn({
487
+ type: TableColumnType.ObjectID,
488
+ title: "Deleted by User ID",
489
+ description:
490
+ "User ID who deleted this object (if this object was deleted by a User)",
491
+ })
492
+ @Column({
493
+ type: ColumnType.ObjectID,
494
+ nullable: true,
495
+ transformer: ObjectID.getDatabaseTransformer(),
496
+ })
497
+ public deletedByUserId?: ObjectID = undefined;
498
+ }
@@ -7,7 +7,6 @@ import UserEmail from "./UserEmail";
7
7
  import UserSMS from "./UserSMS";
8
8
  import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
9
9
  import Route from "../../Types/API/Route";
10
- import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
11
10
  import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
12
11
  import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
13
12
  import ColumnLength from "../../Types/Database/ColumnLength";
@@ -25,7 +24,6 @@ import Permission from "../../Types/Permission";
25
24
  import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
26
25
 
27
26
  @TenantColumn("projectId")
28
- @AllowAccessIfSubscriptionIsUnpaid()
29
27
  @TableAccessControl({
30
28
  create: [Permission.CurrentUser],
31
29
  read: [Permission.CurrentUser],
@@ -2,7 +2,6 @@ import Project from "./Project";
2
2
  import User from "./User";
3
3
  import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
4
4
  import Route from "../../Types/API/Route";
5
- import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
6
5
  import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
7
6
  import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
8
7
  import ColumnLength from "../../Types/Database/ColumnLength";
@@ -21,9 +20,10 @@ import NotificationRuleEventType from "../../Types/Workspace/NotificationRules/E
21
20
  import Permission from "../../Types/Permission";
22
21
  import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
23
22
  import { PlanType } from "../../Types/Billing/SubscriptionPlan";
23
+ import EnableDocumentation from "../../Types/Database/EnableDocumentation";
24
24
 
25
+ @EnableDocumentation()
25
26
  @TenantColumn("projectId")
26
- @AllowAccessIfSubscriptionIsUnpaid()
27
27
  @TableAccessControl({
28
28
  create: [
29
29
  Permission.ProjectAdmin,
@@ -2,7 +2,6 @@ import Project from "./Project";
2
2
  import User from "./User";
3
3
  import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
4
4
  import Route from "../../Types/API/Route";
5
- import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
6
5
  import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
7
6
  import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
8
7
  import ColumnLength from "../../Types/Database/ColumnLength";
@@ -29,7 +28,6 @@ export interface SlackMiscData extends MiscData {
29
28
  }
30
29
 
31
30
  @TenantColumn("projectId")
32
- @AllowAccessIfSubscriptionIsUnpaid()
33
31
  @TableAccessControl({
34
32
  create: [
35
33
  Permission.ProjectOwner,
@@ -2,7 +2,6 @@ import Project from "./Project";
2
2
  import User from "./User";
3
3
  import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
4
4
  import Route from "../../Types/API/Route";
5
- import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
6
5
  import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
7
6
  import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
8
7
  import ColumnLength from "../../Types/Database/ColumnLength";
@@ -28,7 +27,6 @@ export interface SlackSettings extends Settings {
28
27
  }
29
28
 
30
29
  @TenantColumn("projectId")
31
- @AllowAccessIfSubscriptionIsUnpaid()
32
30
  @TableAccessControl({
33
31
  create: [],
34
32
  read: [],
@@ -2,7 +2,6 @@ import Project from "./Project";
2
2
  import User from "./User";
3
3
  import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
4
4
  import Route from "../../Types/API/Route";
5
- import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
6
5
  import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
7
6
  import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
8
7
  import ColumnLength from "../../Types/Database/ColumnLength";
@@ -28,7 +27,6 @@ export interface SlackMiscData extends MiscData {
28
27
  }
29
28
 
30
29
  @TenantColumn("projectId")
31
- @AllowAccessIfSubscriptionIsUnpaid()
32
30
  @TableAccessControl({
33
31
  create: [Permission.CurrentUser],
34
32
  read: [Permission.CurrentUser],
@@ -0,0 +1,69 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1747305098533 implements MigrationInterface {
4
+ public name = "MigrationName1747305098533";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "OnCallDutyPolicyTimeLog" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "onCallDutyPolicyId" uuid, "onCallDutyPolicyScheduleId" uuid, "onCallDutyPolicyEscalationRuleId" uuid, "teamId" uuid, "moreInfo" text, "createdByUserId" uuid, "userId" uuid NOT NULL, "startsAt" TIMESTAMP WITH TIME ZONE NOT NULL, "endsAt" TIMESTAMP WITH TIME ZONE, "deletedByUserId" uuid, CONSTRAINT "PK_11ce033bf855cf2dd0b86daa681" PRIMARY KEY ("_id"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE INDEX "IDX_7eed77389b6085ae0065ab3705" ON "OnCallDutyPolicyTimeLog" ("projectId") `,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_523a7b776b41de5bb5405d6431" ON "OnCallDutyPolicyTimeLog" ("onCallDutyPolicyId") `,
15
+ );
16
+ await queryRunner.query(
17
+ `CREATE INDEX "IDX_86e4f4be85b87ff796fe84b90a" ON "OnCallDutyPolicyTimeLog" ("onCallDutyPolicyScheduleId") `,
18
+ );
19
+ await queryRunner.query(
20
+ `CREATE INDEX "IDX_0843b3b966754970c779f61b0a" ON "OnCallDutyPolicyTimeLog" ("onCallDutyPolicyEscalationRuleId") `,
21
+ );
22
+ await queryRunner.query(
23
+ `CREATE INDEX "IDX_47ff7c8bdaf4e733077b3ceca7" ON "OnCallDutyPolicyTimeLog" ("teamId") `,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "OnCallDutyPolicyTimeLog" ADD CONSTRAINT "FK_7eed77389b6085ae0065ab37059" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
27
+ );
28
+ await queryRunner.query(
29
+ `ALTER TABLE "OnCallDutyPolicyTimeLog" ADD CONSTRAINT "FK_99c1e72b99f1fbedeb650357026" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
30
+ );
31
+ await queryRunner.query(
32
+ `ALTER TABLE "OnCallDutyPolicyTimeLog" ADD CONSTRAINT "FK_43da7ffeee531e9452d36a89ba5" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
33
+ );
34
+ await queryRunner.query(
35
+ `ALTER TABLE "OnCallDutyPolicyTimeLog" ADD CONSTRAINT "FK_b6476633034478def5e6f435cc7" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
36
+ );
37
+ }
38
+
39
+ public async down(queryRunner: QueryRunner): Promise<void> {
40
+ await queryRunner.query(
41
+ `ALTER TABLE "OnCallDutyPolicyTimeLog" DROP CONSTRAINT "FK_b6476633034478def5e6f435cc7"`,
42
+ );
43
+ await queryRunner.query(
44
+ `ALTER TABLE "OnCallDutyPolicyTimeLog" DROP CONSTRAINT "FK_43da7ffeee531e9452d36a89ba5"`,
45
+ );
46
+ await queryRunner.query(
47
+ `ALTER TABLE "OnCallDutyPolicyTimeLog" DROP CONSTRAINT "FK_99c1e72b99f1fbedeb650357026"`,
48
+ );
49
+ await queryRunner.query(
50
+ `ALTER TABLE "OnCallDutyPolicyTimeLog" DROP CONSTRAINT "FK_7eed77389b6085ae0065ab37059"`,
51
+ );
52
+ await queryRunner.query(
53
+ `DROP INDEX "public"."IDX_47ff7c8bdaf4e733077b3ceca7"`,
54
+ );
55
+ await queryRunner.query(
56
+ `DROP INDEX "public"."IDX_0843b3b966754970c779f61b0a"`,
57
+ );
58
+ await queryRunner.query(
59
+ `DROP INDEX "public"."IDX_86e4f4be85b87ff796fe84b90a"`,
60
+ );
61
+ await queryRunner.query(
62
+ `DROP INDEX "public"."IDX_523a7b776b41de5bb5405d6431"`,
63
+ );
64
+ await queryRunner.query(
65
+ `DROP INDEX "public"."IDX_7eed77389b6085ae0065ab3705"`,
66
+ );
67
+ await queryRunner.query(`DROP TABLE "OnCallDutyPolicyTimeLog"`);
68
+ }
69
+ }