@oneuptime/common 10.2.2 → 10.2.4
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.
- package/Models/DatabaseModels/Index.ts +6 -0
- package/Models/DatabaseModels/StatusPage.ts +43 -0
- package/Models/DatabaseModels/StatusPageOidc.ts +689 -0
- package/Models/DatabaseModels/UserNotificationRule.ts +49 -0
- package/Models/DatabaseModels/UserNotificationSetting.ts +17 -0
- package/Models/DatabaseModels/UserOnCallLogTimeline.ts +48 -0
- package/Models/DatabaseModels/UserWebhook.ts +290 -0
- package/Models/DatabaseModels/WebhookLog.ts +992 -0
- package/Server/API/StatusPageAPI.ts +78 -3
- package/Server/API/UserWebhookAPI.ts +159 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1778506655291-AddProjectOIDC.ts +1 -1
- package/Server/Infrastructure/Postgres/SchemaMigrations/1778514515756-MigrationName.ts +259 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1778521361934-MigrationName.ts +17 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1778522070962-AddStatusPageOIDC.ts +63 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/ScheduledMaintenanceService.ts +34 -0
- package/Server/Services/StatusPageOidcService.ts +10 -0
- package/Server/Services/StatusPageSubscriberService.ts +101 -0
- package/Server/Services/UserNotificationRuleService.ts +213 -1
- package/Server/Services/UserNotificationSettingService.ts +95 -0
- package/Server/Services/UserWebhookService.ts +208 -0
- package/Server/Services/WebhookLogService.ts +15 -0
- package/Server/Services/WebhookService.ts +126 -0
- package/Server/Utils/StatusPageSubscriberWebhook.ts +39 -0
- package/Types/Permission.ts +58 -0
- package/Types/Webhook/WebhookMessage.ts +8 -0
- package/Types/WebhookStatus.ts +6 -0
- package/build/dist/Models/DatabaseModels/Index.js +6 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPage.js +45 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageOidc.js +718 -0
- package/build/dist/Models/DatabaseModels/StatusPageOidc.js.map +1 -0
- package/build/dist/Models/DatabaseModels/UserNotificationRule.js +49 -0
- package/build/dist/Models/DatabaseModels/UserNotificationRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserNotificationSetting.js +19 -0
- package/build/dist/Models/DatabaseModels/UserNotificationSetting.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js +48 -0
- package/build/dist/Models/DatabaseModels/UserOnCallLogTimeline.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserWebhook.js +307 -0
- package/build/dist/Models/DatabaseModels/UserWebhook.js.map +1 -0
- package/build/dist/Models/DatabaseModels/WebhookLog.js +1021 -0
- package/build/dist/Models/DatabaseModels/WebhookLog.js.map +1 -0
- package/build/dist/Server/API/StatusPageAPI.js +80 -35
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/API/UserWebhookAPI.js +99 -0
- package/build/dist/Server/API/UserWebhookAPI.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778506655291-AddProjectOIDC.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778514515756-MigrationName.js +94 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778514515756-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778521361934-MigrationName.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778521361934-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778522070962-AddStatusPageOIDC.js +28 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778522070962-AddStatusPageOIDC.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +6 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/Index.js +2 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +31 -2
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageOidcService.js +9 -0
- package/build/dist/Server/Services/StatusPageOidcService.js.map +1 -0
- package/build/dist/Server/Services/StatusPageSubscriberService.js +99 -4
- package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +178 -21
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js +84 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserWebhookService.js +190 -0
- package/build/dist/Server/Services/UserWebhookService.js.map +1 -0
- package/build/dist/Server/Services/WebhookLogService.js +13 -0
- package/build/dist/Server/Services/WebhookLogService.js.map +1 -0
- package/build/dist/Server/Services/WebhookService.js +92 -0
- package/build/dist/Server/Services/WebhookService.js.map +1 -0
- package/build/dist/Server/Utils/StatusPageSubscriberWebhook.js +19 -0
- package/build/dist/Server/Utils/StatusPageSubscriberWebhook.js.map +1 -0
- package/build/dist/Types/Permission.js +50 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/Types/Webhook/WebhookMessage.js +2 -0
- package/build/dist/Types/Webhook/WebhookMessage.js.map +1 -0
- package/build/dist/Types/WebhookStatus.js +7 -0
- package/build/dist/Types/WebhookStatus.js.map +1 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import UserEmail from "./UserEmail";
|
|
|
7
7
|
import UserPush from "./UserPush";
|
|
8
8
|
import UserSMS from "./UserSMS";
|
|
9
9
|
import UserTelegram from "./UserTelegram";
|
|
10
|
+
import UserWebhook from "./UserWebhook";
|
|
10
11
|
import UserWhatsApp from "./UserWhatsApp";
|
|
11
12
|
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
12
13
|
import Route from "../../Types/API/Route";
|
|
@@ -489,6 +490,54 @@ class UserNotificationRule extends BaseModel {
|
|
|
489
490
|
})
|
|
490
491
|
public userTelegramId?: ObjectID = undefined;
|
|
491
492
|
|
|
493
|
+
@ColumnAccessControl({
|
|
494
|
+
create: [Permission.CurrentUser],
|
|
495
|
+
read: [Permission.CurrentUser],
|
|
496
|
+
update: [],
|
|
497
|
+
})
|
|
498
|
+
@TableColumn({
|
|
499
|
+
manyToOneRelationColumn: "userWebhookId",
|
|
500
|
+
type: TableColumnType.Entity,
|
|
501
|
+
modelType: UserWebhook,
|
|
502
|
+
title: "User Webhook",
|
|
503
|
+
description:
|
|
504
|
+
"Relation to User Webhook Resource in which this object belongs",
|
|
505
|
+
})
|
|
506
|
+
@ManyToOne(
|
|
507
|
+
() => {
|
|
508
|
+
return UserWebhook;
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
eager: false,
|
|
512
|
+
nullable: true,
|
|
513
|
+
onDelete: "CASCADE",
|
|
514
|
+
orphanedRowAction: "nullify",
|
|
515
|
+
},
|
|
516
|
+
)
|
|
517
|
+
@JoinColumn({ name: "userWebhookId" })
|
|
518
|
+
public userWebhook?: UserWebhook = undefined;
|
|
519
|
+
|
|
520
|
+
@ColumnAccessControl({
|
|
521
|
+
create: [Permission.CurrentUser],
|
|
522
|
+
read: [Permission.CurrentUser],
|
|
523
|
+
update: [],
|
|
524
|
+
})
|
|
525
|
+
@Index()
|
|
526
|
+
@TableColumn({
|
|
527
|
+
type: TableColumnType.ObjectID,
|
|
528
|
+
required: false,
|
|
529
|
+
canReadOnRelationQuery: true,
|
|
530
|
+
title: "User Webhook ID",
|
|
531
|
+
description: "ID of User Webhook in which this object belongs",
|
|
532
|
+
example: "9e8d7c6b-5a4f-3e2d-1c0b-9a8f7e6d5c4b",
|
|
533
|
+
})
|
|
534
|
+
@Column({
|
|
535
|
+
type: ColumnType.ObjectID,
|
|
536
|
+
nullable: true,
|
|
537
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
538
|
+
})
|
|
539
|
+
public userWebhookId?: ObjectID = undefined;
|
|
540
|
+
|
|
492
541
|
@ColumnAccessControl({
|
|
493
542
|
create: [Permission.CurrentUser],
|
|
494
543
|
read: [Permission.CurrentUser],
|
|
@@ -347,6 +347,23 @@ class UserNotificationSetting extends BaseModel {
|
|
|
347
347
|
default: false,
|
|
348
348
|
})
|
|
349
349
|
public alertByPush?: boolean = undefined;
|
|
350
|
+
|
|
351
|
+
@ColumnAccessControl({
|
|
352
|
+
create: [Permission.CurrentUser],
|
|
353
|
+
read: [Permission.CurrentUser],
|
|
354
|
+
update: [Permission.CurrentUser],
|
|
355
|
+
})
|
|
356
|
+
@TableColumn({
|
|
357
|
+
isDefaultValueColumn: true,
|
|
358
|
+
type: TableColumnType.Boolean,
|
|
359
|
+
defaultValue: false,
|
|
360
|
+
example: false,
|
|
361
|
+
})
|
|
362
|
+
@Column({
|
|
363
|
+
type: ColumnType.Boolean,
|
|
364
|
+
default: false,
|
|
365
|
+
})
|
|
366
|
+
public alertByWebhook?: boolean = undefined;
|
|
350
367
|
}
|
|
351
368
|
|
|
352
369
|
export default UserNotificationSetting;
|
|
@@ -16,6 +16,7 @@ import UserPush from "./UserPush";
|
|
|
16
16
|
import UserOnCallLog from "./UserOnCallLog";
|
|
17
17
|
import UserSMS from "./UserSMS";
|
|
18
18
|
import UserTelegram from "./UserTelegram";
|
|
19
|
+
import UserWebhook from "./UserWebhook";
|
|
19
20
|
import UserWhatsApp from "./UserWhatsApp";
|
|
20
21
|
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
21
22
|
import Route from "../../Types/API/Route";
|
|
@@ -1028,6 +1029,53 @@ export default class UserOnCallLogTimeline extends BaseModel {
|
|
|
1028
1029
|
})
|
|
1029
1030
|
public userTelegramId?: ObjectID = undefined;
|
|
1030
1031
|
|
|
1032
|
+
@ColumnAccessControl({
|
|
1033
|
+
create: [],
|
|
1034
|
+
read: [Permission.CurrentUser],
|
|
1035
|
+
update: [],
|
|
1036
|
+
})
|
|
1037
|
+
@TableColumn({
|
|
1038
|
+
manyToOneRelationColumn: "userWebhookId",
|
|
1039
|
+
type: TableColumnType.Entity,
|
|
1040
|
+
modelType: UserWebhook,
|
|
1041
|
+
title: "User Webhook",
|
|
1042
|
+
description:
|
|
1043
|
+
"Relation to User Webhook Resource in which this object belongs",
|
|
1044
|
+
})
|
|
1045
|
+
@ManyToOne(
|
|
1046
|
+
() => {
|
|
1047
|
+
return UserWebhook;
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
eager: false,
|
|
1051
|
+
nullable: true,
|
|
1052
|
+
onDelete: "CASCADE",
|
|
1053
|
+
orphanedRowAction: "nullify",
|
|
1054
|
+
},
|
|
1055
|
+
)
|
|
1056
|
+
@JoinColumn({ name: "userWebhookId" })
|
|
1057
|
+
public userWebhook?: UserWebhook = undefined;
|
|
1058
|
+
|
|
1059
|
+
@ColumnAccessControl({
|
|
1060
|
+
create: [],
|
|
1061
|
+
read: [Permission.CurrentUser],
|
|
1062
|
+
update: [],
|
|
1063
|
+
})
|
|
1064
|
+
@Index()
|
|
1065
|
+
@TableColumn({
|
|
1066
|
+
type: TableColumnType.ObjectID,
|
|
1067
|
+
required: false,
|
|
1068
|
+
canReadOnRelationQuery: true,
|
|
1069
|
+
title: "User Webhook ID",
|
|
1070
|
+
description: "ID of User Webhook in which this object belongs",
|
|
1071
|
+
})
|
|
1072
|
+
@Column({
|
|
1073
|
+
type: ColumnType.ObjectID,
|
|
1074
|
+
nullable: true,
|
|
1075
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
1076
|
+
})
|
|
1077
|
+
public userWebhookId?: ObjectID = undefined;
|
|
1078
|
+
|
|
1031
1079
|
@ColumnAccessControl({
|
|
1032
1080
|
create: [],
|
|
1033
1081
|
read: [Permission.CurrentUser],
|
|
@@ -0,0 +1,290 @@
|
|
|
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 AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
|
|
6
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
7
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
8
|
+
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
9
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
10
|
+
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
11
|
+
import CurrentUserCanAccessRecordBy from "../../Types/Database/CurrentUserCanAccessRecordBy";
|
|
12
|
+
import TableColumn from "../../Types/Database/TableColumn";
|
|
13
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
14
|
+
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
15
|
+
import TenantColumn from "../../Types/Database/TenantColumn";
|
|
16
|
+
import IconProp from "../../Types/Icon/IconProp";
|
|
17
|
+
import ObjectID from "../../Types/ObjectID";
|
|
18
|
+
import Permission from "../../Types/Permission";
|
|
19
|
+
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
20
|
+
|
|
21
|
+
@TenantColumn("projectId")
|
|
22
|
+
@AllowAccessIfSubscriptionIsUnpaid()
|
|
23
|
+
@TableAccessControl({
|
|
24
|
+
create: [Permission.CurrentUser],
|
|
25
|
+
read: [Permission.CurrentUser],
|
|
26
|
+
delete: [Permission.CurrentUser],
|
|
27
|
+
update: [Permission.CurrentUser],
|
|
28
|
+
})
|
|
29
|
+
@CrudApiEndpoint(new Route("/user-webhook"))
|
|
30
|
+
@Entity({
|
|
31
|
+
name: "UserWebhook",
|
|
32
|
+
})
|
|
33
|
+
@TableMetadata({
|
|
34
|
+
tableName: "UserWebhook",
|
|
35
|
+
singularName: "Webhook",
|
|
36
|
+
pluralName: "Webhooks",
|
|
37
|
+
icon: IconProp.Webhook,
|
|
38
|
+
tableDescription:
|
|
39
|
+
"Webhook URLs used for outbound HTTP notifications to your own services.",
|
|
40
|
+
})
|
|
41
|
+
@CurrentUserCanAccessRecordBy("userId")
|
|
42
|
+
class UserWebhook extends BaseModel {
|
|
43
|
+
@ColumnAccessControl({
|
|
44
|
+
create: [Permission.CurrentUser],
|
|
45
|
+
read: [Permission.CurrentUser],
|
|
46
|
+
update: [],
|
|
47
|
+
})
|
|
48
|
+
@TableColumn({
|
|
49
|
+
manyToOneRelationColumn: "projectId",
|
|
50
|
+
type: TableColumnType.Entity,
|
|
51
|
+
modelType: Project,
|
|
52
|
+
title: "Project",
|
|
53
|
+
description: "Relation to Project Resource in which this object belongs",
|
|
54
|
+
})
|
|
55
|
+
@ManyToOne(
|
|
56
|
+
() => {
|
|
57
|
+
return Project;
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
eager: false,
|
|
61
|
+
nullable: true,
|
|
62
|
+
onDelete: "CASCADE",
|
|
63
|
+
orphanedRowAction: "nullify",
|
|
64
|
+
},
|
|
65
|
+
)
|
|
66
|
+
@JoinColumn({ name: "projectId" })
|
|
67
|
+
public project?: Project = undefined;
|
|
68
|
+
|
|
69
|
+
@ColumnAccessControl({
|
|
70
|
+
create: [Permission.CurrentUser],
|
|
71
|
+
read: [Permission.CurrentUser],
|
|
72
|
+
update: [],
|
|
73
|
+
})
|
|
74
|
+
@Index()
|
|
75
|
+
@TableColumn({
|
|
76
|
+
type: TableColumnType.ObjectID,
|
|
77
|
+
required: true,
|
|
78
|
+
canReadOnRelationQuery: true,
|
|
79
|
+
title: "Project ID",
|
|
80
|
+
description: "ID of your OneUptime Project in which this object belongs",
|
|
81
|
+
})
|
|
82
|
+
@Column({
|
|
83
|
+
type: ColumnType.ObjectID,
|
|
84
|
+
nullable: false,
|
|
85
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
86
|
+
})
|
|
87
|
+
public projectId?: ObjectID = undefined;
|
|
88
|
+
|
|
89
|
+
@ColumnAccessControl({
|
|
90
|
+
create: [Permission.CurrentUser],
|
|
91
|
+
read: [Permission.CurrentUser],
|
|
92
|
+
update: [Permission.CurrentUser],
|
|
93
|
+
})
|
|
94
|
+
@TableColumn({
|
|
95
|
+
title: "Name",
|
|
96
|
+
required: true,
|
|
97
|
+
unique: false,
|
|
98
|
+
type: TableColumnType.ShortText,
|
|
99
|
+
canReadOnRelationQuery: true,
|
|
100
|
+
description: "Label for this webhook (e.g. 'My Slack', 'Internal alerts').",
|
|
101
|
+
})
|
|
102
|
+
@Column({
|
|
103
|
+
type: ColumnType.ShortText,
|
|
104
|
+
length: ColumnLength.ShortText,
|
|
105
|
+
unique: false,
|
|
106
|
+
nullable: false,
|
|
107
|
+
})
|
|
108
|
+
public name?: string = undefined;
|
|
109
|
+
|
|
110
|
+
@ColumnAccessControl({
|
|
111
|
+
create: [Permission.CurrentUser],
|
|
112
|
+
read: [Permission.CurrentUser],
|
|
113
|
+
update: [Permission.CurrentUser],
|
|
114
|
+
})
|
|
115
|
+
@TableColumn({
|
|
116
|
+
title: "Webhook URL",
|
|
117
|
+
required: true,
|
|
118
|
+
unique: false,
|
|
119
|
+
type: TableColumnType.LongText,
|
|
120
|
+
canReadOnRelationQuery: true,
|
|
121
|
+
description:
|
|
122
|
+
"HTTPS endpoint that will receive POST requests with notification payloads.",
|
|
123
|
+
})
|
|
124
|
+
@Column({
|
|
125
|
+
type: ColumnType.LongText,
|
|
126
|
+
length: ColumnLength.LongText,
|
|
127
|
+
unique: false,
|
|
128
|
+
nullable: false,
|
|
129
|
+
})
|
|
130
|
+
public webhookUrl?: string = undefined;
|
|
131
|
+
|
|
132
|
+
@ColumnAccessControl({
|
|
133
|
+
create: [Permission.CurrentUser],
|
|
134
|
+
read: [Permission.CurrentUser],
|
|
135
|
+
update: [Permission.CurrentUser],
|
|
136
|
+
})
|
|
137
|
+
@TableColumn({
|
|
138
|
+
title: "Signing Secret",
|
|
139
|
+
required: false,
|
|
140
|
+
unique: false,
|
|
141
|
+
type: TableColumnType.ShortText,
|
|
142
|
+
canReadOnRelationQuery: false,
|
|
143
|
+
description:
|
|
144
|
+
"Optional shared secret used to compute an HMAC-SHA256 signature for each request (sent in X-OneUptime-Signature).",
|
|
145
|
+
})
|
|
146
|
+
@Column({
|
|
147
|
+
type: ColumnType.ShortText,
|
|
148
|
+
length: ColumnLength.ShortText,
|
|
149
|
+
unique: false,
|
|
150
|
+
nullable: true,
|
|
151
|
+
})
|
|
152
|
+
public secret?: string = undefined;
|
|
153
|
+
|
|
154
|
+
@ColumnAccessControl({
|
|
155
|
+
create: [Permission.CurrentUser],
|
|
156
|
+
read: [Permission.CurrentUser],
|
|
157
|
+
update: [],
|
|
158
|
+
})
|
|
159
|
+
@TableColumn({
|
|
160
|
+
manyToOneRelationColumn: "user",
|
|
161
|
+
type: TableColumnType.Entity,
|
|
162
|
+
modelType: User,
|
|
163
|
+
title: "User",
|
|
164
|
+
description: "Relation to User who this Webhook belongs to",
|
|
165
|
+
})
|
|
166
|
+
@ManyToOne(
|
|
167
|
+
() => {
|
|
168
|
+
return User;
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
eager: false,
|
|
172
|
+
nullable: true,
|
|
173
|
+
onDelete: "CASCADE",
|
|
174
|
+
orphanedRowAction: "nullify",
|
|
175
|
+
},
|
|
176
|
+
)
|
|
177
|
+
@JoinColumn({ name: "userId" })
|
|
178
|
+
public user?: User = undefined;
|
|
179
|
+
|
|
180
|
+
@ColumnAccessControl({
|
|
181
|
+
create: [Permission.CurrentUser],
|
|
182
|
+
read: [Permission.CurrentUser],
|
|
183
|
+
update: [],
|
|
184
|
+
})
|
|
185
|
+
@TableColumn({
|
|
186
|
+
type: TableColumnType.ObjectID,
|
|
187
|
+
title: "User ID",
|
|
188
|
+
description: "User ID who this Webhook belongs to",
|
|
189
|
+
})
|
|
190
|
+
@Column({
|
|
191
|
+
type: ColumnType.ObjectID,
|
|
192
|
+
nullable: true,
|
|
193
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
194
|
+
})
|
|
195
|
+
@Index()
|
|
196
|
+
public userId?: ObjectID = undefined;
|
|
197
|
+
|
|
198
|
+
@ColumnAccessControl({
|
|
199
|
+
create: [Permission.CurrentUser],
|
|
200
|
+
read: [Permission.CurrentUser],
|
|
201
|
+
update: [],
|
|
202
|
+
})
|
|
203
|
+
@TableColumn({
|
|
204
|
+
manyToOneRelationColumn: "createdByUserId",
|
|
205
|
+
type: TableColumnType.Entity,
|
|
206
|
+
modelType: User,
|
|
207
|
+
title: "Created by User",
|
|
208
|
+
description:
|
|
209
|
+
"Relation to User who created this object (if this object was created by a User)",
|
|
210
|
+
})
|
|
211
|
+
@ManyToOne(
|
|
212
|
+
() => {
|
|
213
|
+
return User;
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
eager: false,
|
|
217
|
+
nullable: true,
|
|
218
|
+
onDelete: "SET NULL",
|
|
219
|
+
orphanedRowAction: "nullify",
|
|
220
|
+
},
|
|
221
|
+
)
|
|
222
|
+
@JoinColumn({ name: "createdByUserId" })
|
|
223
|
+
public createdByUser?: User = undefined;
|
|
224
|
+
|
|
225
|
+
@ColumnAccessControl({
|
|
226
|
+
create: [Permission.CurrentUser],
|
|
227
|
+
read: [Permission.CurrentUser],
|
|
228
|
+
update: [],
|
|
229
|
+
})
|
|
230
|
+
@TableColumn({
|
|
231
|
+
type: TableColumnType.ObjectID,
|
|
232
|
+
title: "Created by User ID",
|
|
233
|
+
description:
|
|
234
|
+
"User ID who created this object (if this object was created by a User)",
|
|
235
|
+
})
|
|
236
|
+
@Column({
|
|
237
|
+
type: ColumnType.ObjectID,
|
|
238
|
+
nullable: true,
|
|
239
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
240
|
+
})
|
|
241
|
+
public createdByUserId?: ObjectID = undefined;
|
|
242
|
+
|
|
243
|
+
@ColumnAccessControl({
|
|
244
|
+
create: [],
|
|
245
|
+
read: [],
|
|
246
|
+
update: [],
|
|
247
|
+
})
|
|
248
|
+
@TableColumn({
|
|
249
|
+
manyToOneRelationColumn: "deletedByUserId",
|
|
250
|
+
type: TableColumnType.Entity,
|
|
251
|
+
title: "Deleted by User",
|
|
252
|
+
modelType: User,
|
|
253
|
+
description:
|
|
254
|
+
"Relation to User who deleted this object (if this object was deleted by a User)",
|
|
255
|
+
})
|
|
256
|
+
@ManyToOne(
|
|
257
|
+
() => {
|
|
258
|
+
return User;
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
cascade: false,
|
|
262
|
+
eager: false,
|
|
263
|
+
nullable: true,
|
|
264
|
+
onDelete: "SET NULL",
|
|
265
|
+
orphanedRowAction: "nullify",
|
|
266
|
+
},
|
|
267
|
+
)
|
|
268
|
+
@JoinColumn({ name: "deletedByUserId" })
|
|
269
|
+
public deletedByUser?: User = undefined;
|
|
270
|
+
|
|
271
|
+
@ColumnAccessControl({
|
|
272
|
+
create: [],
|
|
273
|
+
read: [],
|
|
274
|
+
update: [],
|
|
275
|
+
})
|
|
276
|
+
@TableColumn({
|
|
277
|
+
type: TableColumnType.ObjectID,
|
|
278
|
+
title: "Deleted by User ID",
|
|
279
|
+
description:
|
|
280
|
+
"User ID who deleted this object (if this object was deleted by a User)",
|
|
281
|
+
})
|
|
282
|
+
@Column({
|
|
283
|
+
type: ColumnType.ObjectID,
|
|
284
|
+
nullable: true,
|
|
285
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
286
|
+
})
|
|
287
|
+
public deletedByUserId?: ObjectID = undefined;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export default UserWebhook;
|