@tomei/sso 0.1.1 → 0.1.2
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/README.md +15 -3
- package/create-sso-user.sql +7 -3
- package/package.json +1 -1
- package/prisma/migrations/0_init/migration.sql +513 -521
- package/prisma/migrations/20230528161352_create_user_user_group_and_add_new_column/migration.sql +35 -0
- package/prisma/migrations/migration_lock.toml +2 -2
- package/prisma/schema.prisma +506 -436
package/prisma/schema.prisma
CHANGED
@@ -1,436 +1,506 @@
|
|
1
|
-
generator client {
|
2
|
-
provider = "prisma-client-js"
|
3
|
-
}
|
4
|
-
|
5
|
-
datasource db {
|
6
|
-
provider
|
7
|
-
url
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
}
|
75
|
-
|
76
|
-
model
|
77
|
-
id
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
@@
|
133
|
-
@@
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
@@
|
266
|
-
@@index([
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
1
|
+
generator client {
|
2
|
+
provider = "prisma-client-js"
|
3
|
+
}
|
4
|
+
|
5
|
+
datasource db {
|
6
|
+
provider = "mysql"
|
7
|
+
url = env("DATABASE_URL")
|
8
|
+
shadowDatabaseUrl = env("SHADOW_DATABASE_URL")
|
9
|
+
}
|
10
|
+
|
11
|
+
model AuthorizationCode {
|
12
|
+
id Int @id @default(autoincrement())
|
13
|
+
userId Int @map("user_id")
|
14
|
+
systemId Int @map("system_id")
|
15
|
+
code String @unique(map: "code") @db.VarChar(255)
|
16
|
+
expiredAt DateTime @db.DateTime(0) @map("expired_at")
|
17
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
18
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
19
|
+
status String? @default("unused") @db.VarChar(255)
|
20
|
+
|
21
|
+
@@map("sso_authorization_codes")
|
22
|
+
}
|
23
|
+
|
24
|
+
model BearerToken {
|
25
|
+
id Int @id @default(autoincrement())
|
26
|
+
userId Int @map("user_id")
|
27
|
+
token String @unique(map: "token") @db.VarChar(255)
|
28
|
+
expiredAt DateTime @db.DateTime(0) @map("expired_at")
|
29
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
30
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
31
|
+
|
32
|
+
@@map("sso_bearer_tokens")
|
33
|
+
}
|
34
|
+
|
35
|
+
model BuildingTypes {
|
36
|
+
id Int @id @default(autoincrement())
|
37
|
+
name String @db.VarChar(50)
|
38
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
39
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
40
|
+
|
41
|
+
@@map("sso_building_types")
|
42
|
+
}
|
43
|
+
|
44
|
+
model Building {
|
45
|
+
id Int @id @default(autoincrement())
|
46
|
+
name String? @db.VarChar(200)
|
47
|
+
code String @unique(map: "code") @db.VarChar(10)
|
48
|
+
buildindTypeId Int @map("building_type_id")
|
49
|
+
status String @db.VarChar(10)
|
50
|
+
email String? @db.VarChar(200)
|
51
|
+
mobile String? @db.VarChar(20)
|
52
|
+
phone String @db.VarChar(20)
|
53
|
+
address String @db.VarChar(1000)
|
54
|
+
postcode String @db.VarChar(10)
|
55
|
+
longitude Decimal? @db.Decimal(11, 8)
|
56
|
+
latitude Decimal? @db.Decimal(10, 8)
|
57
|
+
countryId Int @map("country_id")
|
58
|
+
state String @db.VarChar(50)
|
59
|
+
city String @db.VarChar(50)
|
60
|
+
createdById Int? @map("created_by_id")
|
61
|
+
updatedById Int? @map("updated_by_id")
|
62
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
63
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
64
|
+
brand String? @db.VarChar(100)
|
65
|
+
areaStaffId Int? @map("area_staff_id")
|
66
|
+
openingDate DateTime? @db.DateTime(0) @map("opening_date")
|
67
|
+
ceasedDate DateTime? @db.DateTime(0) @map("ceased_date")
|
68
|
+
opening_hours String? @db.VarChar(200) @map("opening_hours")
|
69
|
+
image String? @db.VarChar(200)
|
70
|
+
departments Departement[]
|
71
|
+
staffs Staff[]
|
72
|
+
|
73
|
+
@@map("sso_buildings")
|
74
|
+
}
|
75
|
+
|
76
|
+
model City {
|
77
|
+
id Int @id @default(autoincrement())
|
78
|
+
name String? @db.VarChar(255)
|
79
|
+
stateId Int? @map("state_id")
|
80
|
+
postCode String? @db.VarChar(255) @map("postcode")
|
81
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
82
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
83
|
+
|
84
|
+
@@map("sso_cities")
|
85
|
+
}
|
86
|
+
|
87
|
+
model Company {
|
88
|
+
id Int @id @default(autoincrement())
|
89
|
+
code String @unique(map: "code") @db.VarChar(10)
|
90
|
+
name String @db.VarChar(200)
|
91
|
+
description String? @db.VarChar(3000)
|
92
|
+
logo String? @db.Text
|
93
|
+
status String @db.VarChar(10)
|
94
|
+
createdById Int? @map("created_by_id")
|
95
|
+
updatedById Int? @map("updated_by_id")
|
96
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
97
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
98
|
+
staffs Staff[]
|
99
|
+
|
100
|
+
@@map("sso_companies")
|
101
|
+
}
|
102
|
+
|
103
|
+
model Country {
|
104
|
+
id Int @id @default(autoincrement())
|
105
|
+
code String @unique(map: "code") @db.VarChar(255)
|
106
|
+
name String @db.VarChar(100)
|
107
|
+
phoneCode String? @db.VarChar(255) @map("phonecode")
|
108
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
109
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
110
|
+
|
111
|
+
@@map("sso_countries")
|
112
|
+
}
|
113
|
+
|
114
|
+
model Departement {
|
115
|
+
id Int @id @default(autoincrement())
|
116
|
+
code String @unique(map: "code") @db.VarChar(10)
|
117
|
+
buildingId Int? @map("building_id")
|
118
|
+
status String @db.VarChar(10)
|
119
|
+
name String @db.VarChar(100)
|
120
|
+
createdById Int? @map("created_by_id")
|
121
|
+
updatedById Int? @map("updated_by_id")
|
122
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
123
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
124
|
+
building Building? @relation(fields: [buildingId], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_departments_building_id")
|
125
|
+
createdBy User? @relation("sso_departments_created_by_idTosso_users", fields: [createdById], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_departments_created_by_id")
|
126
|
+
updatedBy User? @relation("sso_departments_updated_by_idTosso_users", fields: [updatedById], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_departments_updated_by_id")
|
127
|
+
Staffs Staff[]
|
128
|
+
UserGroup UserGroup[]
|
129
|
+
|
130
|
+
@@index([buildingId], map: "fk_departments_building_id")
|
131
|
+
@@index([createdById], map: "fk_departments_created_by_id")
|
132
|
+
@@index([updatedById], map: "fk_departments_updated_by_id")
|
133
|
+
@@map("sso_departments")
|
134
|
+
}
|
135
|
+
|
136
|
+
model GroupRolePrivilege {
|
137
|
+
groupCode String @db.VarChar(10) @map("GroupCode")
|
138
|
+
roleId String @db.VarChar(30) @map("RoleId")
|
139
|
+
privilegeId String @db.VarChar(30) @map("PrivilegeId")
|
140
|
+
createdById Int @map("CreatedById")
|
141
|
+
createdAt DateTime @default(dbgenerated("('2023-01-03 17:13:45')")) @db.DateTime(0) @map("CreatedAt")
|
142
|
+
systemId Int @default(1) @map("SystemId")
|
143
|
+
system System @relation(fields: [systemId], references: [id], onDelete: Cascade, map: "sso_GroupRolePrivilege_SystemId_foreign_idx")
|
144
|
+
userGroup UserGroup @relation(fields: [groupCode], references: [groupCode], onDelete: Cascade, map: "sso_grouproleprivilege_ibfk_1")
|
145
|
+
systemRole SystemRole @relation(fields: [roleId], references: [roleId], onDelete: Cascade, map: "sso_grouproleprivilege_ibfk_2")
|
146
|
+
systemPrivilege SystemPrivilege @relation(fields: [privilegeId], references: [privilegeId], onDelete: Cascade, map: "sso_grouproleprivilege_ibfk_3")
|
147
|
+
|
148
|
+
@@id([groupCode, roleId, privilegeId, systemId])
|
149
|
+
@@index([privilegeId], map: "privilegeId")
|
150
|
+
@@index([roleId], map: "roleId")
|
151
|
+
@@index([systemId], map: "sso_GroupRolePrivilege_SystemId_foreign_idx")
|
152
|
+
@@map("sso_grouproleprivilege")
|
153
|
+
}
|
154
|
+
|
155
|
+
model GroupSystemAccess {
|
156
|
+
systemId Int @map("SystemId")
|
157
|
+
groupCode String @db.VarChar(10) @map("GroupCode")
|
158
|
+
createdById Int @map("CreatedById")
|
159
|
+
createdAt DateTime @default(dbgenerated("('2022-06-29 01:16:41')")) @db.DateTime(0)
|
160
|
+
userGroup UserGroup @relation(fields: [groupCode], references: [groupCode], onDelete: Cascade, map: "sso_groupsystemaccess_ibfk_1")
|
161
|
+
|
162
|
+
@@id([systemId, groupCode])
|
163
|
+
@@index([groupCode], map: "groupCode")
|
164
|
+
@@map("sso_groupsystemaccess")
|
165
|
+
}
|
166
|
+
|
167
|
+
model GroupSystemPrivilege {
|
168
|
+
groupCode String @db.VarChar(10) @map("GroupCode")
|
169
|
+
privilegeId String @db.VarChar(30) @map("PrivilegeId")
|
170
|
+
createdById String @db.VarChar(30) @map("CreatedById")
|
171
|
+
createdAt DateTime @default(dbgenerated("('2022-06-29 01:16:40')")) @db.DateTime(0) @map("CreatedAt")
|
172
|
+
userGroup UserGroup @relation(fields: [groupCode], references: [groupCode], onDelete: Cascade, map: "sso_groupsystemprivilege_ibfk_1")
|
173
|
+
systemPrivilege SystemPrivilege @relation(fields: [privilegeId], references: [privilegeId], onDelete: Cascade, map: "sso_groupsystemprivilege_ibfk_2")
|
174
|
+
|
175
|
+
@@id([groupCode, privilegeId])
|
176
|
+
@@index([privilegeId], map: "privilegeId")
|
177
|
+
@@map("sso_groupsystemprivilege")
|
178
|
+
}
|
179
|
+
|
180
|
+
model GroupSystemRole {
|
181
|
+
roleId String @db.VarChar(30) @map("RoleId")
|
182
|
+
groupCode String @db.VarChar(10) @map("GroupCode")
|
183
|
+
createdById String @db.VarChar(30) @map("CreatedById")
|
184
|
+
createdAt DateTime @default(dbgenerated("('2022-06-29 01:16:39')")) @db.DateTime(0) @map("CreatedAt")
|
185
|
+
systemRole SystemRole @relation(fields: [roleId], references: [roleId], onUpdate: Restrict, map: "sso_groupsystemrole_ibfk_1")
|
186
|
+
userGroup UserGroup @relation(fields: [groupCode], references: [groupCode], onUpdate: Restrict, map: "sso_groupsystemrole_ibfk_2")
|
187
|
+
|
188
|
+
@@id([roleId, groupCode])
|
189
|
+
@@index([groupCode], map: "groupCode")
|
190
|
+
@@map("sso_groupsystemrole")
|
191
|
+
}
|
192
|
+
|
193
|
+
model OAuthToken {
|
194
|
+
id Int @id @default(autoincrement())
|
195
|
+
userId Int @map("user_id")
|
196
|
+
token String @db.Text
|
197
|
+
expiredAt DateTime @db.DateTime(0) @map("expired_at")
|
198
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
199
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
200
|
+
systemId Int @default(1) @map("system_id")
|
201
|
+
system System @relation(fields: [systemId], references: [id], onDelete: Cascade, map: "sso_oauth_tokens_system_id_foreign_idx")
|
202
|
+
|
203
|
+
@@index([systemId], map: "sso_oauth_tokens_system_id_foreign_idx")
|
204
|
+
@@map("sso_oauth_tokens")
|
205
|
+
}
|
206
|
+
|
207
|
+
model Roles {
|
208
|
+
id Int @id @default(autoincrement()) @db.UnsignedInt @map("ID")
|
209
|
+
name String @db.VarChar(255)
|
210
|
+
description String? @db.Text
|
211
|
+
defaultToOn Boolean @map("default_to_on")
|
212
|
+
parentId Int? @map("parent_id")
|
213
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
214
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
215
|
+
|
216
|
+
@@map("sso_roles")
|
217
|
+
}
|
218
|
+
|
219
|
+
model StaffTypes {
|
220
|
+
id Int @id @default(autoincrement())
|
221
|
+
name String @db.VarChar(20)
|
222
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
223
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
224
|
+
staffs Staff[]
|
225
|
+
|
226
|
+
@@map("sso_staff_types")
|
227
|
+
}
|
228
|
+
|
229
|
+
model Staff {
|
230
|
+
id Int @id @default(autoincrement())
|
231
|
+
staffId String @unique(map: "staff_id") @db.VarChar(10) @map("staff_id")
|
232
|
+
fullName String @db.VarChar(200) @map("full_name")
|
233
|
+
preferredName String @db.VarChar(200) @map("preferred_name")
|
234
|
+
email String @db.VarChar(200)
|
235
|
+
staffTypeId Int @map("staff_type_id")
|
236
|
+
jobTitle String @db.VarChar(100) @map("job_title")
|
237
|
+
carPlate String @default("") @db.VarChar(20) @map("car_plate")
|
238
|
+
mobile String? @db.VarChar(20)
|
239
|
+
floor String? @db.VarChar(15)
|
240
|
+
extension Int?
|
241
|
+
isCharge Boolean @default(false) @map("is_charge")
|
242
|
+
status String @db.VarChar(10)
|
243
|
+
userId Int @map("user_id")
|
244
|
+
buildingId Int @map("building_id")
|
245
|
+
departmentId Int @map("department_id")
|
246
|
+
companyId Int? @map("company_id")
|
247
|
+
createdById Int? @map("created_by_id")
|
248
|
+
updatedById Int? @map("updated_by_id")
|
249
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
250
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
251
|
+
image String? @db.VarChar(255)
|
252
|
+
IdNo String? @db.VarChar(20) @map("IdNo")
|
253
|
+
fullAddress String? @db.VarChar(1000) @map("FullAddress")
|
254
|
+
Building Building @relation(fields: [buildingId], references: [id], onUpdate: Restrict, map: "fk_staffs_building_id")
|
255
|
+
company Company? @relation(fields: [companyId], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_staffs_company_id")
|
256
|
+
createdBy User? @relation("sso_staffs_created_by_idTosso_users", fields: [createdById], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_staffs_created_by_id")
|
257
|
+
department Departement @relation(fields: [departmentId], references: [id], onUpdate: Restrict, map: "fk_staffs_department_id")
|
258
|
+
staffType StaffTypes @relation(fields: [staffTypeId], references: [id], onUpdate: Restrict, map: "fk_staffs_staff_type_id")
|
259
|
+
updatedBy User? @relation("sso_staffs_updated_by_idTosso_users", fields: [updatedById], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "fk_staffs_updated_by_id")
|
260
|
+
user User @relation("sso_staffs_user_idTosso_users", fields: [userId], references: [id], onUpdate: Restrict, map: "fk_staffs_user_id")
|
261
|
+
|
262
|
+
@@index([buildingId], map: "fk_staffs_building_id")
|
263
|
+
@@index([companyId], map: "fk_staffs_company_id")
|
264
|
+
@@index([createdById], map: "fk_staffs_created_by_id")
|
265
|
+
@@index([departmentId], map: "fk_staffs_department_id")
|
266
|
+
@@index([staffTypeId], map: "fk_staffs_staff_type_id")
|
267
|
+
@@index([updatedById], map: "fk_staffs_updated_by_id")
|
268
|
+
@@index([userId], map: "fk_staffs_user_id")
|
269
|
+
@@map("sso_staffs")
|
270
|
+
}
|
271
|
+
|
272
|
+
model States {
|
273
|
+
id Int @id @default(autoincrement())
|
274
|
+
name String @db.VarChar(50)
|
275
|
+
countryId Int? @map("country_id")
|
276
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
277
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
278
|
+
|
279
|
+
@@map("sso_states")
|
280
|
+
}
|
281
|
+
|
282
|
+
model SystemAccess {
|
283
|
+
userId Int @map("user_id")
|
284
|
+
systemId Int @map("system_id")
|
285
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
286
|
+
system System @relation(fields: [systemId], references: [id], onUpdate: Restrict, map: "fk_system_access_system")
|
287
|
+
user User @relation(fields: [userId], references: [id], onUpdate: Restrict, map: "fk_system_access_user")
|
288
|
+
|
289
|
+
@@id([userId, systemId])
|
290
|
+
@@index([systemId], map: "fk_system_access_system")
|
291
|
+
|
292
|
+
@@map("sso_system_access")
|
293
|
+
}
|
294
|
+
|
295
|
+
model SystemPrivilege {
|
296
|
+
privilegeId String @id @db.VarChar(30) @map("PrivilegeId")
|
297
|
+
systemId Int @map("SystemId")
|
298
|
+
code String @db.VarChar(200) @map("Code")
|
299
|
+
module String? @db.VarChar(200) @map("Module")
|
300
|
+
description String? @db.VarChar(3000) @map("Description")
|
301
|
+
createdAt DateTime @default(dbgenerated("('2021-10-25 02:50:19')")) @db.DateTime(0) @map("CreatedAt")
|
302
|
+
updatedAt DateTime @default(dbgenerated("('2021-10-25 02:50:19')")) @updatedAt @db.DateTime(0) @map("UpdatedAt")
|
303
|
+
groupRolePrivileges GroupRolePrivilege[]
|
304
|
+
groupSystemPrivileges GroupSystemPrivilege[]
|
305
|
+
system System @relation(fields: [systemId], references: [id], onDelete: Cascade, map: "sso_systemprivilege_ibfk_1")
|
306
|
+
systemRolePrivileges SystemRolePrivilege[]
|
307
|
+
userSystemPrivileges UserSystemPrivilege[]
|
308
|
+
|
309
|
+
@@index([systemId], map: "systemId")
|
310
|
+
@@map("sso_systemprivilege")
|
311
|
+
}
|
312
|
+
|
313
|
+
model SystemRole {
|
314
|
+
roleId String @id @db.VarChar(30) @map("RoleId")
|
315
|
+
systemId Int @map("SystemId")
|
316
|
+
name String @db.VarChar(100) @map("Name")
|
317
|
+
description String? @db.VarChar(3000) @map("Description")
|
318
|
+
createdById Int @map("CreatedById")
|
319
|
+
createdAt DateTime @default(dbgenerated("('2021-10-25 02:50:20')")) @db.DateTime(0) @map("CreatedAt")
|
320
|
+
updatedById Int @map("UpdatedById")
|
321
|
+
updatedAt DateTime @default(dbgenerated("('2021-10-25 02:50:20')")) @updatedAt @db.DateTime(0) @map("UpdatedAt")
|
322
|
+
groupRolePrivileges GroupRolePrivilege[]
|
323
|
+
groupSystemRoles GroupSystemRole[]
|
324
|
+
system System @relation(fields: [systemId], references: [id], onDelete: Cascade, map: "sso_systemrole_ibfk_1")
|
325
|
+
systemRolePrivileges SystemRolePrivilege[]
|
326
|
+
userSystemRoles UserSystemRole[]
|
327
|
+
|
328
|
+
@@index([systemId], map: "systemId")
|
329
|
+
@@map("sso_systemrole")
|
330
|
+
}
|
331
|
+
|
332
|
+
model SystemRolePrivilege {
|
333
|
+
roleId String @db.VarChar(30) @map("RoleId")
|
334
|
+
privilegeId String @db.VarChar(30) @map("PrivilegeId")
|
335
|
+
createdAt DateTime @default(dbgenerated("('2021-10-25 02:50:20')")) @db.DateTime(0) @map("CreatedAt")
|
336
|
+
updatedAt DateTime @default(dbgenerated("('2021-10-25 02:50:20')")) @updatedAt @db.DateTime(0) @map("UpdatedAt")
|
337
|
+
systemRole SystemRole @relation(fields: [roleId], references: [roleId], onDelete: Cascade, map: "sso_systemroleprivilege_ibfk_1")
|
338
|
+
systemPrivilege SystemPrivilege @relation(fields: [privilegeId], references: [privilegeId], onDelete: Cascade, map: "sso_systemroleprivilege_ibfk_2")
|
339
|
+
|
340
|
+
@@id([roleId, privilegeId])
|
341
|
+
@@index([privilegeId], map: "privilegeId")
|
342
|
+
@@map("sso_systemroleprivilege")
|
343
|
+
}
|
344
|
+
|
345
|
+
model System {
|
346
|
+
id Int @id @default(autoincrement())
|
347
|
+
code String @unique(map: "code") @db.VarChar(10)
|
348
|
+
name String @db.VarChar(200)
|
349
|
+
description String @db.VarChar(500)
|
350
|
+
accessUrl String? @db.VarChar(2000) @map("access_url")
|
351
|
+
googlePlayUrl String? @db.VarChar(2000) @map("google_play_url")
|
352
|
+
appleStoreUrl String? @db.VarChar(2000) @map("apple_store_url")
|
353
|
+
apiKey String? @db.VarChar(255) @map("api_key")
|
354
|
+
logo String? @db.VarChar(255)
|
355
|
+
status String @db.VarChar(10)
|
356
|
+
visible Boolean @default(true)
|
357
|
+
createdAt DateTime @db.DateTime(0) @map("created_at")
|
358
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
359
|
+
apiSecret String? @db.VarChar(255) @map("api_secret")
|
360
|
+
updatedById Int? @map("updated_by_id")
|
361
|
+
createdById Int? @map("created_by_id")
|
362
|
+
groupRolePrivileges GroupRolePrivilege[]
|
363
|
+
oAuthTokens OAuthToken[]
|
364
|
+
systemAccesses SystemAccess[]
|
365
|
+
systemPrivileges SystemPrivilege[]
|
366
|
+
systemRoles SystemRole[]
|
367
|
+
userUserGroups UserUserGroup[]
|
368
|
+
|
369
|
+
@@map("sso_systems")
|
370
|
+
}
|
371
|
+
|
372
|
+
model UpdatedHistory {
|
373
|
+
historyId BigInt @id @default(autoincrement()) @map("HistoryId")
|
374
|
+
batchId String? @db.VarChar(30) @map("BatchId")
|
375
|
+
objectType String @db.VarChar(50) @map("ObjectType")
|
376
|
+
objectValue String @db.VarChar(50) @map("ObjectValue")
|
377
|
+
actionType sso_updated_history_ActionType @map("ActionType")
|
378
|
+
updatedFieldName String @db.VarChar(100) @map("UpdatedFieldName")
|
379
|
+
oldValue String? @db.VarChar(1000) @map("OldValue")
|
380
|
+
newValue String? @db.VarChar(1000) @map("NewValue")
|
381
|
+
updatedById Int
|
382
|
+
updatedAt DateTime @db.DateTime(0)
|
383
|
+
|
384
|
+
@@map("sso_updated_history")
|
385
|
+
}
|
386
|
+
|
387
|
+
model UserRoles {
|
388
|
+
userId Int @map("user_id")
|
389
|
+
roleId Int @map("role_id")
|
390
|
+
updatedById Int? @map("updated_by_id")
|
391
|
+
updatedAt DateTime @updatedAt @db.DateTime(0) @map("updated_at")
|
392
|
+
|
393
|
+
@@id([userId, roleId])
|
394
|
+
@@map("sso_user_roles")
|
395
|
+
}
|
396
|
+
|
397
|
+
model UserGroup {
|
398
|
+
groupCode String @id @db.VarChar(10) @map("GroupCode")
|
399
|
+
groupDescription String? @db.VarChar(100) @map("GroupDescription")
|
400
|
+
status sso_usergroup_Status? @map("Status")
|
401
|
+
personInCharge String? @db.VarChar(100) @map("PersonInCharge")
|
402
|
+
fullPath String? @db.VarChar(1000) @map("FullPath")
|
403
|
+
parentGroupCode String? @db.VarChar(10) @map("ParentGroupCode")
|
404
|
+
groupLevel Int @default(0) @map("GroupLevel")
|
405
|
+
groupType String? @db.VarChar(10) @map("GroupType")
|
406
|
+
allowInheritFromParentYN sso_YN? @default(N) @map("AllowInheritFromParentYN")
|
407
|
+
createdById String? @db.VarChar(30) @map("CreatedById")
|
408
|
+
createdAt DateTime? @default(dbgenerated("('2022-06-29 01:16:39')")) @db.DateTime(0) @map("CreatedAt")
|
409
|
+
updatedById String? @db.VarChar(30) @map("UpdatedById")
|
410
|
+
updatedAt DateTime? @default(dbgenerated("('2022-06-29 01:16:39')")) @updatedAt @db.DateTime(0) @map("UpdatedAt")
|
411
|
+
departmentId Int? @map("DepartmentId")
|
412
|
+
groupRolePrivileges GroupRolePrivilege[]
|
413
|
+
groupSystemAccesses GroupSystemAccess[]
|
414
|
+
groupSystemPrivileges GroupSystemPrivilege[]
|
415
|
+
groupSystemRoles GroupSystemRole[]
|
416
|
+
department Departement? @relation(fields: [departmentId], references: [id], onDelete: Restrict, onUpdate: Restrict, map: "sso_UserGroup_DepartmentId_foreign_idx")
|
417
|
+
users User[]
|
418
|
+
userUserGroups UserUserGroup[]
|
419
|
+
|
420
|
+
@@index([departmentId], map: "sso_UserGroup_DepartmentId_foreign_idx")
|
421
|
+
@@map("sso_usergroup")
|
422
|
+
}
|
423
|
+
|
424
|
+
model User {
|
425
|
+
id Int @id @default(autoincrement())
|
426
|
+
email String @unique(map: "email") @db.VarChar(255)
|
427
|
+
password String @db.VarChar(255)
|
428
|
+
status String? @db.VarChar(255)
|
429
|
+
default_password_changed Boolean? @default(false)
|
430
|
+
first_login_at DateTime? @db.DateTime(0)
|
431
|
+
created_at DateTime @db.DateTime(0)
|
432
|
+
updated_at DateTime @updatedAt @db.DateTime(0)
|
433
|
+
groupCode String? @db.VarChar(10) @map("GroupCode")
|
434
|
+
createdByDepartments Departement[] @relation("sso_departments_created_by_idTosso_users")
|
435
|
+
updatedByDepartments Departement[] @relation("sso_departments_updated_by_idTosso_users")
|
436
|
+
createdByStaff Staff[] @relation("sso_staffs_created_by_idTosso_users")
|
437
|
+
updatedByStaff Staff[] @relation("sso_staffs_updated_by_idTosso_users")
|
438
|
+
staffs Staff[] @relation("sso_staffs_user_idTosso_users")
|
439
|
+
systemAccesses SystemAccess[]
|
440
|
+
userGroup UserGroup? @relation(fields: [groupCode], references: [groupCode], onDelete: Restrict, onUpdate: Restrict, map: "sso_users_GroupCode_foreign_idx")
|
441
|
+
userSystemPrivileges UserSystemPrivilege[]
|
442
|
+
userSystemRoles UserSystemRole[]
|
443
|
+
userUserGroups UserUserGroup[]
|
444
|
+
|
445
|
+
@@index([groupCode], map: "sso_users_GroupCode_foreign_idx")
|
446
|
+
@@map("sso_users")
|
447
|
+
}
|
448
|
+
|
449
|
+
model UserSystemPrivilege {
|
450
|
+
userId Int @map("UserId")
|
451
|
+
privilegeId String @db.VarChar(30) @map("PrivilegeId")
|
452
|
+
isInheritedYN sso_YN @default(N) @map("IsInheritedYN")
|
453
|
+
isRevokedYN sso_YN @default(N) @map("IsRevokedYN")
|
454
|
+
createdAt DateTime @default(dbgenerated("('2021-10-25 02:50:20')")) @db.DateTime(0) @map("CreatedAt")
|
455
|
+
updatedAt DateTime @default(dbgenerated("('2021-10-25 02:50:20')")) @updatedAt @db.DateTime(0) @map("UpdatedAt")
|
456
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade, map: "sso_usersystemprivilege_ibfk_1")
|
457
|
+
systemPrivilege SystemPrivilege @relation(fields: [privilegeId], references: [privilegeId], onDelete: Cascade, map: "sso_usersystemprivilege_ibfk_2")
|
458
|
+
|
459
|
+
@@id([userId, privilegeId])
|
460
|
+
@@index([privilegeId], map: "privilegeId")
|
461
|
+
@@map("sso_usersystemprivilege")
|
462
|
+
}
|
463
|
+
|
464
|
+
model UserSystemRole {
|
465
|
+
userId Int @map("UserId")
|
466
|
+
roleId String @db.VarChar(30) @map("RoleId")
|
467
|
+
createdAt DateTime @default(dbgenerated("('2021-10-25 02:50:20')")) @db.DateTime(0) @map("CreatedAt")
|
468
|
+
updatedAt DateTime @default(dbgenerated("('2021-10-25 02:50:20')")) @updatedAt @db.DateTime(0) @map("UpdatedAt")
|
469
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade, map: "sso_usersystemrole_ibfk_1")
|
470
|
+
systemRole SystemRole @relation(fields: [roleId], references: [roleId], onDelete: Cascade, map: "sso_usersystemrole_ibfk_2")
|
471
|
+
|
472
|
+
@@id([userId, roleId])
|
473
|
+
@@index([roleId], map: "roleId")
|
474
|
+
@@map("sso_usersystemrole")
|
475
|
+
}
|
476
|
+
|
477
|
+
model UserUserGroup {
|
478
|
+
userId Int @map("UserId")
|
479
|
+
groupCode String @map("GroupCode")
|
480
|
+
systemId Int? @map("SystemId")
|
481
|
+
createdAt DateTime @default(dbgenerated("('2021-10-25 02:50:20')")) @db.DateTime(0) @map("CreatedAt")
|
482
|
+
updatedAt DateTime @default(dbgenerated("('2021-10-25 02:50:20')")) @updatedAt @db.DateTime(0) @map("UpdatedAt")
|
483
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade, map: "sso_UserUserGroup_ibfk_1")
|
484
|
+
system System? @relation(fields: [systemId], references: [id], onDelete: Cascade, map: "sso_UserUserGroup_ibfk_3")
|
485
|
+
userGroup UserGroup @relation(fields: [groupCode], references: [groupCode], onDelete: Cascade, map: "sso_UserUserGroup_ibfk_2")
|
486
|
+
|
487
|
+
@@id([userId, groupCode])
|
488
|
+
@@index([groupCode], map: "groupCode")
|
489
|
+
@@map("sso_UserUserGroup")
|
490
|
+
}
|
491
|
+
|
492
|
+
enum sso_usergroup_Status {
|
493
|
+
Active
|
494
|
+
Inactive
|
495
|
+
}
|
496
|
+
|
497
|
+
enum sso_updated_history_ActionType {
|
498
|
+
Add
|
499
|
+
Update
|
500
|
+
Delete
|
501
|
+
}
|
502
|
+
|
503
|
+
enum sso_YN {
|
504
|
+
Y
|
505
|
+
N
|
506
|
+
}
|