@oneuptime/common 7.0.4717 → 7.0.4720
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 +2 -0
- package/Models/DatabaseModels/UserNotificationRule.ts +47 -0
- package/Models/DatabaseModels/UserNotificationSetting.ts +16 -0
- package/Models/DatabaseModels/UserOnCallLogTimeline.ts +47 -0
- package/Models/DatabaseModels/UserPush.ts +302 -0
- package/Server/API/UserPushAPI.ts +302 -0
- package/Server/EnvironmentConfig.ts +10 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1752659054949-MigrationName.ts +87 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1752774923063-MigrationName.ts +27 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1753109689244-MigrationName.ts +41 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +6 -0
- package/Server/Services/MonitorService.ts +14 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +14 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.ts +15 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +14 -0
- package/Server/Services/OnCallDutyPolicyScheduleService.ts +29 -0
- package/Server/Services/ProbeService.ts +23 -0
- package/Server/Services/PushNotificationService.ts +253 -0
- package/Server/Services/UserNotificationRuleService.ts +148 -2
- package/Server/Services/UserNotificationSettingService.ts +20 -0
- package/Server/Services/UserPushService.ts +95 -0
- package/Server/Utils/PushNotificationUtil.ts +308 -0
- package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +1 -1
- package/Types/PushNotification/PushNotificationMessage.ts +18 -0
- package/Types/PushNotification/PushNotificationRequest.ts +22 -0
- package/UI/Config.ts +3 -0
- package/UI/Utils/Cookie.ts +1 -3
- package/UI/Utils/LocalStorage.ts +1 -3
- package/UI/Utils/SessionStorage.ts +1 -3
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserNotificationRule.js +48 -0
- package/build/dist/Models/DatabaseModels/UserNotificationRule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/UserNotificationSetting.js +18 -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/UserPush.js +324 -0
- package/build/dist/Models/DatabaseModels/UserPush.js.map +1 -0
- package/build/dist/Server/API/UserPushAPI.js +175 -0
- package/build/dist/Server/API/UserPushAPI.js.map +1 -0
- package/build/dist/Server/EnvironmentConfig.js +4 -0
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1752659054949-MigrationName.js +36 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1752659054949-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1752774923063-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1752774923063-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1753109689244-MigrationName.js +20 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1753109689244-MigrationName.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/MonitorService.js +12 -0
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +13 -4
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js +13 -4
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleTeamService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +12 -3
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +22 -0
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
- package/build/dist/Server/Services/ProbeService.js +12 -1
- package/build/dist/Server/Services/ProbeService.js.map +1 -1
- package/build/dist/Server/Services/PushNotificationService.js +172 -0
- package/build/dist/Server/Services/PushNotificationService.js.map +1 -0
- package/build/dist/Server/Services/UserNotificationRuleService.js +108 -3
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationSettingService.js +10 -0
- package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
- package/build/dist/Server/Services/UserPushService.js +102 -0
- package/build/dist/Server/Services/UserPushService.js.map +1 -0
- package/build/dist/Server/Utils/PushNotificationUtil.js +222 -0
- package/build/dist/Server/Utils/PushNotificationUtil.js.map +1 -0
- package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js +1 -1
- package/build/dist/Types/PushNotification/PushNotificationMessage.js +2 -0
- package/build/dist/Types/PushNotification/PushNotificationMessage.js.map +1 -0
- package/build/dist/Types/PushNotification/PushNotificationRequest.js +2 -0
- package/build/dist/Types/PushNotification/PushNotificationRequest.js.map +1 -0
- package/build/dist/UI/Config.js +2 -0
- package/build/dist/UI/Config.js.map +1 -1
- package/build/dist/UI/Utils/Cookie.js +1 -3
- package/build/dist/UI/Utils/Cookie.js.map +1 -1
- package/build/dist/UI/Utils/LocalStorage.js +1 -3
- package/build/dist/UI/Utils/LocalStorage.js.map +1 -1
- package/build/dist/UI/Utils/SessionStorage.js +1 -3
- package/build/dist/UI/Utils/SessionStorage.js.map +1 -1
- package/package.json +3 -1
|
@@ -126,6 +126,7 @@ import User from "./User";
|
|
|
126
126
|
import UserCall from "./UserCall";
|
|
127
127
|
// Notification Methods
|
|
128
128
|
import UserEmail from "./UserEmail";
|
|
129
|
+
import UserPush from "./UserPush";
|
|
129
130
|
// User Notification Rules
|
|
130
131
|
import UserNotificationRule from "./UserNotificationRule";
|
|
131
132
|
import UserNotificationSetting from "./UserNotificationSetting";
|
|
@@ -294,6 +295,7 @@ const AllModelTypes: Array<{
|
|
|
294
295
|
UserEmail,
|
|
295
296
|
UserSms,
|
|
296
297
|
UserCall,
|
|
298
|
+
UserPush,
|
|
297
299
|
|
|
298
300
|
UserNotificationRule,
|
|
299
301
|
UserOnCallLog,
|
|
@@ -4,6 +4,7 @@ import Project from "./Project";
|
|
|
4
4
|
import User from "./User";
|
|
5
5
|
import UserCall from "./UserCall";
|
|
6
6
|
import UserEmail from "./UserEmail";
|
|
7
|
+
import UserPush from "./UserPush";
|
|
7
8
|
import UserSMS from "./UserSMS";
|
|
8
9
|
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
9
10
|
import Route from "../../Types/API/Route";
|
|
@@ -290,6 +291,52 @@ class UserNotificationRule extends BaseModel {
|
|
|
290
291
|
})
|
|
291
292
|
public userCallId?: ObjectID = undefined;
|
|
292
293
|
|
|
294
|
+
@ColumnAccessControl({
|
|
295
|
+
create: [Permission.CurrentUser],
|
|
296
|
+
read: [Permission.CurrentUser],
|
|
297
|
+
update: [],
|
|
298
|
+
})
|
|
299
|
+
@TableColumn({
|
|
300
|
+
manyToOneRelationColumn: "userPushId",
|
|
301
|
+
type: TableColumnType.Entity,
|
|
302
|
+
modelType: UserPush,
|
|
303
|
+
title: "User Push",
|
|
304
|
+
description: "Relation to User Push Resource in which this object belongs",
|
|
305
|
+
})
|
|
306
|
+
@ManyToOne(
|
|
307
|
+
() => {
|
|
308
|
+
return UserPush;
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
eager: false,
|
|
312
|
+
nullable: true,
|
|
313
|
+
onDelete: "CASCADE",
|
|
314
|
+
orphanedRowAction: "nullify",
|
|
315
|
+
},
|
|
316
|
+
)
|
|
317
|
+
@JoinColumn({ name: "userPushId" })
|
|
318
|
+
public userPush?: UserPush = undefined;
|
|
319
|
+
|
|
320
|
+
@ColumnAccessControl({
|
|
321
|
+
create: [Permission.CurrentUser],
|
|
322
|
+
read: [Permission.CurrentUser],
|
|
323
|
+
update: [],
|
|
324
|
+
})
|
|
325
|
+
@Index()
|
|
326
|
+
@TableColumn({
|
|
327
|
+
type: TableColumnType.ObjectID,
|
|
328
|
+
required: false,
|
|
329
|
+
canReadOnRelationQuery: true,
|
|
330
|
+
title: "User Push ID",
|
|
331
|
+
description: "ID of User Push in which this object belongs",
|
|
332
|
+
})
|
|
333
|
+
@Column({
|
|
334
|
+
type: ColumnType.ObjectID,
|
|
335
|
+
nullable: true,
|
|
336
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
337
|
+
})
|
|
338
|
+
public userPushId?: ObjectID = undefined;
|
|
339
|
+
|
|
293
340
|
@ColumnAccessControl({
|
|
294
341
|
create: [Permission.CurrentUser],
|
|
295
342
|
read: [Permission.CurrentUser],
|
|
@@ -284,6 +284,22 @@ class UserNotificationSetting extends BaseModel {
|
|
|
284
284
|
default: false,
|
|
285
285
|
})
|
|
286
286
|
public alertByCall?: boolean = undefined;
|
|
287
|
+
|
|
288
|
+
@ColumnAccessControl({
|
|
289
|
+
create: [Permission.CurrentUser],
|
|
290
|
+
read: [Permission.CurrentUser],
|
|
291
|
+
update: [Permission.CurrentUser],
|
|
292
|
+
})
|
|
293
|
+
@TableColumn({
|
|
294
|
+
isDefaultValueColumn: true,
|
|
295
|
+
type: TableColumnType.Boolean,
|
|
296
|
+
defaultValue: false,
|
|
297
|
+
})
|
|
298
|
+
@Column({
|
|
299
|
+
type: ColumnType.Boolean,
|
|
300
|
+
default: false,
|
|
301
|
+
})
|
|
302
|
+
public alertByPush?: boolean = undefined;
|
|
287
303
|
}
|
|
288
304
|
|
|
289
305
|
export default UserNotificationSetting;
|
|
@@ -10,6 +10,7 @@ import User from "./User";
|
|
|
10
10
|
import UserCall from "./UserCall";
|
|
11
11
|
import UserEmail from "./UserEmail";
|
|
12
12
|
import UserNotificationRule from "./UserNotificationRule";
|
|
13
|
+
import UserPush from "./UserPush";
|
|
13
14
|
import UserOnCallLog from "./UserOnCallLog";
|
|
14
15
|
import UserSMS from "./UserSMS";
|
|
15
16
|
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
@@ -876,6 +877,52 @@ export default class UserOnCallLogTimeline extends BaseModel {
|
|
|
876
877
|
})
|
|
877
878
|
public userEmailId?: ObjectID = undefined;
|
|
878
879
|
|
|
880
|
+
@ColumnAccessControl({
|
|
881
|
+
create: [],
|
|
882
|
+
read: [Permission.CurrentUser],
|
|
883
|
+
update: [],
|
|
884
|
+
})
|
|
885
|
+
@TableColumn({
|
|
886
|
+
manyToOneRelationColumn: "userPushId",
|
|
887
|
+
type: TableColumnType.Entity,
|
|
888
|
+
modelType: UserPush,
|
|
889
|
+
title: "User Push",
|
|
890
|
+
description: "Relation to User Push Resource in which this object belongs",
|
|
891
|
+
})
|
|
892
|
+
@ManyToOne(
|
|
893
|
+
() => {
|
|
894
|
+
return UserPush;
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
eager: false,
|
|
898
|
+
nullable: true,
|
|
899
|
+
onDelete: "CASCADE",
|
|
900
|
+
orphanedRowAction: "nullify",
|
|
901
|
+
},
|
|
902
|
+
)
|
|
903
|
+
@JoinColumn({ name: "userPushId" })
|
|
904
|
+
public userPush?: UserPush = undefined;
|
|
905
|
+
|
|
906
|
+
@ColumnAccessControl({
|
|
907
|
+
create: [],
|
|
908
|
+
read: [Permission.CurrentUser],
|
|
909
|
+
update: [],
|
|
910
|
+
})
|
|
911
|
+
@Index()
|
|
912
|
+
@TableColumn({
|
|
913
|
+
type: TableColumnType.ObjectID,
|
|
914
|
+
required: false,
|
|
915
|
+
canReadOnRelationQuery: true,
|
|
916
|
+
title: "User Push ID",
|
|
917
|
+
description: "ID of User Push in which this object belongs",
|
|
918
|
+
})
|
|
919
|
+
@Column({
|
|
920
|
+
type: ColumnType.ObjectID,
|
|
921
|
+
nullable: true,
|
|
922
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
923
|
+
})
|
|
924
|
+
public userPushId?: ObjectID = undefined;
|
|
925
|
+
|
|
879
926
|
@ColumnAccessControl({
|
|
880
927
|
create: [],
|
|
881
928
|
read: [],
|
|
@@ -0,0 +1,302 @@
|
|
|
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-push"))
|
|
30
|
+
@Entity({
|
|
31
|
+
name: "UserPush",
|
|
32
|
+
})
|
|
33
|
+
@TableMetadata({
|
|
34
|
+
tableName: "UserPush",
|
|
35
|
+
singularName: "Device for Push Notifications",
|
|
36
|
+
pluralName: "Devices for Push Notifications",
|
|
37
|
+
icon: IconProp.Bell,
|
|
38
|
+
tableDescription: "Devices which will be used for push notifications.",
|
|
39
|
+
})
|
|
40
|
+
@CurrentUserCanAccessRecordBy("userId")
|
|
41
|
+
class UserPush extends BaseModel {
|
|
42
|
+
@ColumnAccessControl({
|
|
43
|
+
create: [Permission.CurrentUser],
|
|
44
|
+
read: [Permission.CurrentUser],
|
|
45
|
+
update: [],
|
|
46
|
+
})
|
|
47
|
+
@TableColumn({
|
|
48
|
+
manyToOneRelationColumn: "projectId",
|
|
49
|
+
type: TableColumnType.Entity,
|
|
50
|
+
modelType: Project,
|
|
51
|
+
title: "Project",
|
|
52
|
+
description: "Relation to Project Resource in which this object belongs",
|
|
53
|
+
})
|
|
54
|
+
@ManyToOne(
|
|
55
|
+
() => {
|
|
56
|
+
return Project;
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
eager: false,
|
|
60
|
+
nullable: true,
|
|
61
|
+
onDelete: "CASCADE",
|
|
62
|
+
orphanedRowAction: "nullify",
|
|
63
|
+
},
|
|
64
|
+
)
|
|
65
|
+
@JoinColumn({ name: "projectId" })
|
|
66
|
+
public project?: Project = undefined;
|
|
67
|
+
|
|
68
|
+
@ColumnAccessControl({
|
|
69
|
+
create: [Permission.CurrentUser],
|
|
70
|
+
read: [Permission.CurrentUser],
|
|
71
|
+
update: [],
|
|
72
|
+
})
|
|
73
|
+
@Index()
|
|
74
|
+
@TableColumn({
|
|
75
|
+
type: TableColumnType.ObjectID,
|
|
76
|
+
required: true,
|
|
77
|
+
canReadOnRelationQuery: true,
|
|
78
|
+
title: "Project ID",
|
|
79
|
+
description: "ID of your OneUptime Project in which this object belongs",
|
|
80
|
+
})
|
|
81
|
+
@Column({
|
|
82
|
+
type: ColumnType.ObjectID,
|
|
83
|
+
nullable: false,
|
|
84
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
85
|
+
})
|
|
86
|
+
public projectId?: ObjectID = undefined;
|
|
87
|
+
|
|
88
|
+
@ColumnAccessControl({
|
|
89
|
+
create: [Permission.CurrentUser],
|
|
90
|
+
read: [Permission.CurrentUser],
|
|
91
|
+
update: [],
|
|
92
|
+
})
|
|
93
|
+
@TableColumn({
|
|
94
|
+
title: "Device Token",
|
|
95
|
+
required: true,
|
|
96
|
+
unique: false,
|
|
97
|
+
type: TableColumnType.LongText,
|
|
98
|
+
canReadOnRelationQuery: true,
|
|
99
|
+
})
|
|
100
|
+
@Column({
|
|
101
|
+
type: ColumnType.LongText,
|
|
102
|
+
length: ColumnLength.LongText,
|
|
103
|
+
unique: false,
|
|
104
|
+
nullable: false,
|
|
105
|
+
})
|
|
106
|
+
public deviceToken?: string = undefined;
|
|
107
|
+
|
|
108
|
+
@ColumnAccessControl({
|
|
109
|
+
create: [Permission.CurrentUser],
|
|
110
|
+
read: [Permission.CurrentUser],
|
|
111
|
+
update: [],
|
|
112
|
+
})
|
|
113
|
+
@TableColumn({
|
|
114
|
+
title: "Device Type",
|
|
115
|
+
required: true,
|
|
116
|
+
unique: false,
|
|
117
|
+
type: TableColumnType.ShortText,
|
|
118
|
+
canReadOnRelationQuery: true,
|
|
119
|
+
})
|
|
120
|
+
@Column({
|
|
121
|
+
type: ColumnType.ShortText,
|
|
122
|
+
length: ColumnLength.ShortText,
|
|
123
|
+
unique: false,
|
|
124
|
+
nullable: false,
|
|
125
|
+
})
|
|
126
|
+
public deviceType?: "web" = "web" as const; // Only web support for now
|
|
127
|
+
|
|
128
|
+
@ColumnAccessControl({
|
|
129
|
+
create: [Permission.CurrentUser],
|
|
130
|
+
read: [Permission.CurrentUser],
|
|
131
|
+
update: [],
|
|
132
|
+
})
|
|
133
|
+
@TableColumn({
|
|
134
|
+
title: "Device Name",
|
|
135
|
+
required: false,
|
|
136
|
+
unique: false,
|
|
137
|
+
type: TableColumnType.ShortText,
|
|
138
|
+
canReadOnRelationQuery: true,
|
|
139
|
+
})
|
|
140
|
+
@Column({
|
|
141
|
+
type: ColumnType.ShortText,
|
|
142
|
+
length: ColumnLength.ShortText,
|
|
143
|
+
unique: false,
|
|
144
|
+
nullable: true,
|
|
145
|
+
})
|
|
146
|
+
public deviceName?: string = undefined;
|
|
147
|
+
|
|
148
|
+
@ColumnAccessControl({
|
|
149
|
+
create: [Permission.CurrentUser],
|
|
150
|
+
read: [Permission.CurrentUser],
|
|
151
|
+
update: [],
|
|
152
|
+
})
|
|
153
|
+
@TableColumn({
|
|
154
|
+
manyToOneRelationColumn: "user",
|
|
155
|
+
type: TableColumnType.Entity,
|
|
156
|
+
modelType: User,
|
|
157
|
+
title: "User",
|
|
158
|
+
description: "Relation to User who this device belongs to",
|
|
159
|
+
})
|
|
160
|
+
@ManyToOne(
|
|
161
|
+
() => {
|
|
162
|
+
return User;
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
eager: false,
|
|
166
|
+
nullable: true,
|
|
167
|
+
onDelete: "CASCADE",
|
|
168
|
+
orphanedRowAction: "nullify",
|
|
169
|
+
},
|
|
170
|
+
)
|
|
171
|
+
@JoinColumn({ name: "userId" })
|
|
172
|
+
public user?: User = undefined;
|
|
173
|
+
|
|
174
|
+
@ColumnAccessControl({
|
|
175
|
+
create: [Permission.CurrentUser],
|
|
176
|
+
read: [Permission.CurrentUser],
|
|
177
|
+
update: [],
|
|
178
|
+
})
|
|
179
|
+
@TableColumn({
|
|
180
|
+
type: TableColumnType.ObjectID,
|
|
181
|
+
title: "User ID",
|
|
182
|
+
description: "User ID who this device belongs to",
|
|
183
|
+
})
|
|
184
|
+
@Column({
|
|
185
|
+
type: ColumnType.ObjectID,
|
|
186
|
+
nullable: true,
|
|
187
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
188
|
+
})
|
|
189
|
+
@Index()
|
|
190
|
+
public userId?: ObjectID = undefined;
|
|
191
|
+
|
|
192
|
+
@ColumnAccessControl({
|
|
193
|
+
create: [Permission.CurrentUser],
|
|
194
|
+
read: [Permission.CurrentUser],
|
|
195
|
+
update: [],
|
|
196
|
+
})
|
|
197
|
+
@TableColumn({
|
|
198
|
+
manyToOneRelationColumn: "createdByUserId",
|
|
199
|
+
type: TableColumnType.Entity,
|
|
200
|
+
modelType: User,
|
|
201
|
+
title: "Created by User",
|
|
202
|
+
description:
|
|
203
|
+
"Relation to User who created this object (if this object was created by a User)",
|
|
204
|
+
})
|
|
205
|
+
@ManyToOne(
|
|
206
|
+
() => {
|
|
207
|
+
return User;
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
eager: false,
|
|
211
|
+
nullable: true,
|
|
212
|
+
onDelete: "SET NULL",
|
|
213
|
+
orphanedRowAction: "nullify",
|
|
214
|
+
},
|
|
215
|
+
)
|
|
216
|
+
@JoinColumn({ name: "createdByUserId" })
|
|
217
|
+
public createdByUser?: User = undefined;
|
|
218
|
+
|
|
219
|
+
@ColumnAccessControl({
|
|
220
|
+
create: [Permission.CurrentUser],
|
|
221
|
+
read: [Permission.CurrentUser],
|
|
222
|
+
update: [],
|
|
223
|
+
})
|
|
224
|
+
@TableColumn({
|
|
225
|
+
type: TableColumnType.ObjectID,
|
|
226
|
+
title: "Created by User ID",
|
|
227
|
+
description:
|
|
228
|
+
"User ID who created this object (if this object was created by a User)",
|
|
229
|
+
})
|
|
230
|
+
@Column({
|
|
231
|
+
type: ColumnType.ObjectID,
|
|
232
|
+
nullable: true,
|
|
233
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
234
|
+
})
|
|
235
|
+
public createdByUserId?: ObjectID = undefined;
|
|
236
|
+
|
|
237
|
+
@ColumnAccessControl({
|
|
238
|
+
create: [],
|
|
239
|
+
read: [],
|
|
240
|
+
update: [],
|
|
241
|
+
})
|
|
242
|
+
@TableColumn({
|
|
243
|
+
manyToOneRelationColumn: "deletedByUserId",
|
|
244
|
+
type: TableColumnType.Entity,
|
|
245
|
+
title: "Deleted by User",
|
|
246
|
+
modelType: User,
|
|
247
|
+
description:
|
|
248
|
+
"Relation to User who deleted this object (if this object was deleted by a User)",
|
|
249
|
+
})
|
|
250
|
+
@ManyToOne(
|
|
251
|
+
() => {
|
|
252
|
+
return User;
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
cascade: false,
|
|
256
|
+
eager: false,
|
|
257
|
+
nullable: true,
|
|
258
|
+
onDelete: "SET NULL",
|
|
259
|
+
orphanedRowAction: "nullify",
|
|
260
|
+
},
|
|
261
|
+
)
|
|
262
|
+
@JoinColumn({ name: "deletedByUserId" })
|
|
263
|
+
public deletedByUser?: User = undefined;
|
|
264
|
+
|
|
265
|
+
@ColumnAccessControl({
|
|
266
|
+
create: [],
|
|
267
|
+
read: [],
|
|
268
|
+
update: [],
|
|
269
|
+
})
|
|
270
|
+
@TableColumn({
|
|
271
|
+
type: TableColumnType.ObjectID,
|
|
272
|
+
title: "Deleted by User ID",
|
|
273
|
+
description:
|
|
274
|
+
"User ID who deleted this object (if this object was deleted by a User)",
|
|
275
|
+
})
|
|
276
|
+
@Column({
|
|
277
|
+
type: ColumnType.ObjectID,
|
|
278
|
+
nullable: true,
|
|
279
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
280
|
+
})
|
|
281
|
+
public deletedByUserId?: ObjectID = undefined;
|
|
282
|
+
|
|
283
|
+
@ColumnAccessControl({
|
|
284
|
+
create: [],
|
|
285
|
+
read: [Permission.CurrentUser],
|
|
286
|
+
update: [],
|
|
287
|
+
})
|
|
288
|
+
@TableColumn({
|
|
289
|
+
title: "Is Verified",
|
|
290
|
+
description: "Is this device verified?",
|
|
291
|
+
isDefaultValueColumn: true,
|
|
292
|
+
type: TableColumnType.Boolean,
|
|
293
|
+
defaultValue: false,
|
|
294
|
+
})
|
|
295
|
+
@Column({
|
|
296
|
+
type: ColumnType.Boolean,
|
|
297
|
+
default: false,
|
|
298
|
+
})
|
|
299
|
+
public isVerified?: boolean = undefined;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export default UserPush;
|