efiber-prisma-schema 1.0.0

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 (26) hide show
  1. package/README.md +16 -0
  2. package/index.d.ts +1 -0
  3. package/index.js +1 -0
  4. package/package.json +27 -0
  5. package/prisma/migrations/20231209164007_/migration.sql +8 -0
  6. package/prisma/migrations/20231209192452_country_table/migration.sql +7 -0
  7. package/prisma/migrations/20231209194848_/migration.sql +10 -0
  8. package/prisma/migrations/20231209195140_/migration.sql +8 -0
  9. package/prisma/migrations/20231209201218_country_update/migration.sql +29 -0
  10. package/prisma/migrations/20231209201405_/migration.sql +8 -0
  11. package/prisma/migrations/20231209213149_camusat_country/migration.sql +20 -0
  12. package/prisma/migrations/20231209221814_platform/migration.sql +26 -0
  13. package/prisma/migrations/20231209223246_/migration.sql +16 -0
  14. package/prisma/migrations/20231209231721_roles/migration.sql +34 -0
  15. package/prisma/migrations/20231210113501_team_and_users/migration.sql +119 -0
  16. package/prisma/migrations/20231210181832_user_update/migration.sql +25 -0
  17. package/prisma/migrations/20231219121311_add_projects/migration.sql +60 -0
  18. package/prisma/migrations/20231219123045_/migration.sql +8 -0
  19. package/prisma/migrations/20231219123850_audit/migration.sql +20 -0
  20. package/prisma/migrations/20240116090035_/migration.sql +57 -0
  21. package/prisma/migrations/20240220085809_emails/migration.sql +82 -0
  22. package/prisma/migrations/20240226075734_update_email_config_and_workorder/migration.sql +33 -0
  23. package/prisma/migrations/20240227112839_update_email_config/migration.sql +2 -0
  24. package/prisma/migrations/20240227124801_work_order_update/migration.sql +6 -0
  25. package/prisma/migrations/migration_lock.toml +3 -0
  26. package/prisma/schema.prisma +1077 -0
@@ -0,0 +1,1077 @@
1
+ generator client {
2
+ provider = "prisma-client-js"
3
+ }
4
+
5
+ datasource db {
6
+ provider = "postgresql"
7
+ url = env("DATABASE_URL")
8
+ }
9
+
10
+ model Country {
11
+ id String @id @unique @default(uuid())
12
+ no Int @default(autoincrement())
13
+ name String
14
+ official_name String
15
+ code String
16
+ capital String
17
+ region String
18
+ subregion String
19
+ population String
20
+ timezones String
21
+ flag String?
22
+
23
+ createdAt DateTime @default(now())
24
+ updatedAt DateTime @updatedAt
25
+ CamusatCountry CamusatCountry[]
26
+ User User[]
27
+ }
28
+
29
+ model CamusatCountry {
30
+ id String @id @unique @default(uuid())
31
+ no Int @default(autoincrement())
32
+ name String @unique
33
+ original String?
34
+ description String?
35
+ status String @default("active")
36
+ type String @default("subsidiary")
37
+
38
+ createdAt DateTime @default(now())
39
+ updatedAt DateTime @updatedAt
40
+ deletedAt DateTime?
41
+ CamusatClient CamusatClient[]
42
+ mainProjects MainProject[]
43
+
44
+ Country Country @relation(fields: [countryId], references: [id])
45
+ countryId String
46
+
47
+ dispatchProject DispatchProject[]
48
+ SubsidiaryMaterial SubsidiaryMaterial[]
49
+ }
50
+
51
+ model CamusatClient {
52
+ id String @id @unique @default(uuid())
53
+ no Int @default(autoincrement())
54
+ name String
55
+ logo String? @db.Text //Upload file for logo
56
+ type String @default("client")
57
+
58
+ createdAt DateTime @default(now())
59
+ updatedAt DateTime @updatedAt
60
+ deletedAt DateTime?
61
+
62
+ Country CamusatCountry @relation(fields: [countryId], references: [id])
63
+ countryId String
64
+
65
+ mainProject MainProject[]
66
+ clientMaterial clientMaterial[]
67
+ }
68
+
69
+ model Platform {
70
+ id String @id @unique @default(uuid())
71
+ no Int @default(autoincrement())
72
+ name String
73
+ url String?
74
+ directory String?
75
+ status String @default("active")
76
+ countries Json?
77
+ createdAt DateTime @default(now())
78
+ updatedAt DateTime @updatedAt
79
+ deletedAt DateTime?
80
+
81
+ User User[]
82
+ Project Project[]
83
+ }
84
+
85
+ model Position {
86
+ id String @id @unique @default(uuid())
87
+ no Int @default(autoincrement())
88
+ name String
89
+ description String?
90
+ status String @default("active")
91
+ countries Json?
92
+
93
+ createdAt DateTime @default(now())
94
+ updatedAt DateTime @updatedAt
95
+ deletedAt DateTime?
96
+ User User[]
97
+ }
98
+
99
+ model Role {
100
+ id String @id @unique @default(uuid())
101
+ no Int @default(autoincrement())
102
+ name String
103
+ description String?
104
+ status String @default("active")
105
+ countries Json?
106
+ platforms Json?
107
+ login Boolean @default(false)
108
+ access_web Boolean @default(false)
109
+ access_mobile Boolean @default(false)
110
+ add_users Boolean @default(false)
111
+ view_users Boolean @default(false)
112
+ delete_users Boolean @default(false)
113
+ view_requests Boolean @default(false)
114
+ manage_requests Boolean @default(false) //Either approve or rejects
115
+ add_main_projects Boolean @default(false)
116
+ view_main_projects Boolean @default(false)
117
+ edit_main_projects Boolean @default(false)
118
+ delete_main_projects Boolean @default(false)
119
+ view_settings Boolean @default(false)
120
+ view_audit Boolean @default(false)
121
+ full_projects Boolean @default(false)
122
+ add_projects Boolean @default(false)
123
+ edit_projects Boolean @default(false)
124
+ view_projects Boolean @default(false)
125
+ delete_projects Boolean @default(false)
126
+ add_sub_projects Boolean @default(false)
127
+ manage_work_orders Boolean @default(false)
128
+ full_teams Boolean @default(false)
129
+ add_team Boolean @default(false)
130
+ view_team Boolean @default(false)
131
+ quality Boolean @default(false)
132
+ dispatch_web_access Boolean @default(false)
133
+ dispatch_mobile Boolean @default(false)
134
+ dispatch_add_workorders Boolean @default(false)
135
+ dispatch_view_workorders Boolean @default(false)
136
+ dispatch_edit_workorders Boolean @default(false)
137
+ dispatch_view_schedule Boolean @default(false)
138
+ dispatch_add_teams Boolean @default(false)
139
+ dispatch_view_teams Boolean @default(false)
140
+ dispatch_edit_teams Boolean @default(false)
141
+ dispatch_delete_teams Boolean @default(false)
142
+ dispatch_view_projects Boolean @default(false)
143
+ dispatch_edit_projects Boolean @default(false)
144
+ dispatch_edit_materials Boolean @default(false)
145
+ dispatch_view_materials Boolean @default(false)
146
+ dispatch_add_materials Boolean @default(false)
147
+ dispatch_delete_materials Boolean @default(false)
148
+ dispatch_view_reports Boolean @default(false)
149
+ dispatch_view_kpi Boolean @default(false)
150
+
151
+ createdAt DateTime @default(now())
152
+ updatedAt DateTime @updatedAt
153
+ deletedAt DateTime?
154
+ User User[]
155
+ }
156
+
157
+ model Template {
158
+ id String @id @unique @default(uuid())
159
+ no Int @default(autoincrement())
160
+ name String @unique
161
+ statusColor String?
162
+ buttonName String
163
+ workflowType String @default("template")
164
+
165
+ createdAt DateTime @default(now())
166
+
167
+ features Feature[]
168
+ templateComponents TemplateComponent[]
169
+ projectWorkFlow ProjectWorkFlow[]
170
+ }
171
+
172
+ model Feature {
173
+ id String @id @unique @default(uuid())
174
+ no Int @default(autoincrement())
175
+ functionality String? // Describes the feature type
176
+ description String // Placeholder in the mobile app
177
+ classification String
178
+ KPI String
179
+ options Json?
180
+ linkToScheduler Boolean @default(false) // For Date and Time, will reschedule the work order
181
+ value String?
182
+
183
+ createdAt DateTime @default(now())
184
+ updatedAt DateTime @updatedAt
185
+ deletedAt DateTime?
186
+
187
+ featureType FeatureType @relation(fields: [featureTypeId], references: [id])
188
+ featureTypeId String
189
+
190
+ template Template @relation(fields: [templateId], references: [id])
191
+ templateId String
192
+ }
193
+
194
+ model FeatureType {
195
+ id String @id @unique @default(uuid())
196
+ no Int @default(autoincrement())
197
+ type String
198
+ functionality String
199
+
200
+ createdAt DateTime @default(now())
201
+ updatedAt DateTime @updatedAt
202
+ deletedAt DateTime?
203
+
204
+ Feature Feature[]
205
+ }
206
+
207
+ model TemplateComponent {
208
+ id String @id @unique @default(uuid())
209
+ no Int @default(autoincrement())
210
+
211
+ type String
212
+ createdAt DateTime @default(now())
213
+
214
+ template Template? @relation(fields: [templateId], references: [id])
215
+ templateId String?
216
+
217
+ bomComponent BillOfMaterial? @relation(fields: [bomComponentId], references: [id])
218
+ bomComponentId String?
219
+
220
+ dispatchProject DispatchProject? @relation(fields: [dispatchProjectId], references: [id])
221
+ dispatchProjectId String?
222
+
223
+ index Int? //order of the component
224
+
225
+ workOrderTasks WorkOrderTask[]
226
+
227
+ // TODO: Figure out how to tie this to a dispatch Project
228
+ }
229
+
230
+ model ProjectWorkFlow {
231
+ id String @id @unique @default(uuid())
232
+ no Int @default(autoincrement())
233
+ name String
234
+ project Project @relation(fields: [projectId], references: [id])
235
+ projectId String
236
+ index Int? //order of the workflow
237
+
238
+ createdAt DateTime @default(now())
239
+ updatedAt DateTime @updatedAt
240
+
241
+ template Template? @relation(fields: [templateId], references: [id])
242
+ templateId String?
243
+
244
+ billofMaterial BillOfMaterial? @relation(fields: [billofMaterialId], references: [id])
245
+ billofMaterialId String?
246
+ }
247
+
248
+ model TeamType {
249
+ id String @id @unique @default(uuid())
250
+ no Int @default(autoincrement())
251
+ name String
252
+ description String?
253
+ status String @default("active")
254
+ countries Json?
255
+ platforms Json?
256
+
257
+ createdAt DateTime @default(now())
258
+ updatedAt DateTime @updatedAt
259
+ deletedAt DateTime?
260
+
261
+ Team Team[]
262
+ User User[]
263
+ }
264
+
265
+ model Team {
266
+ id String @id @unique @default(uuid())
267
+ no Int @default(autoincrement())
268
+ name String
269
+ description String?
270
+ status String @default("active")
271
+ countries Json?
272
+ platforms Json?
273
+
274
+ createdAt DateTime @default(now())
275
+ updatedAt DateTime @updatedAt
276
+ deletedAt DateTime?
277
+
278
+ teamType TeamType @relation(fields: [teamTypeId], references: [id])
279
+ teamTypeId String
280
+ TeamPlatform TeamPlatform[]
281
+ User User[]
282
+ }
283
+
284
+ model TeamPlatform {
285
+ id String @id @unique @default(uuid())
286
+ no Int @default(autoincrement())
287
+ name String
288
+ description String?
289
+ priority String?
290
+ status String @default("active")
291
+ countries Json?
292
+ platforms Json?
293
+ staffs Json?
294
+
295
+ createdAt DateTime @default(now())
296
+ updatedAt DateTime @updatedAt
297
+ deletedAt DateTime?
298
+
299
+ team Team @relation(fields: [teamId], references: [id])
300
+ teamId String
301
+ User User? @relation(fields: [userId], references: [id])
302
+ userId String?
303
+ }
304
+
305
+ model User {
306
+ id String @id @unique @default(uuid())
307
+ no Int @default(autoincrement())
308
+ name String
309
+ surname String
310
+ email String @unique
311
+ mobile String
312
+ password String
313
+ otp String?
314
+ passport String? //National Id/ Passport No.
315
+ passportFile String? @db.Text //Upload file for passport
316
+ status String @default("active")
317
+ countries Json? //Manage countrie
318
+ platforms Json? //Platform Access
319
+ staffId String? //Staff ID
320
+ deviceId1 String? //Build ID to limit number of devices
321
+ deviceId2 String? //Build ID to limit number of devices
322
+ notificationTokens String[] @default([])
323
+
324
+ platforms_list Platform[]
325
+
326
+ refreshToken String? @unique
327
+
328
+ createdAt DateTime @default(now())
329
+ updatedAt DateTime @updatedAt
330
+ activatedAt DateTime?
331
+ deletedAt DateTime?
332
+
333
+ position Position? @relation(fields: [positionId], references: [id])
334
+ teamType TeamType? @relation(fields: [teamTypeId], references: [id])
335
+ team Team? @relation(fields: [teamId], references: [id])
336
+ country Country? @relation(fields: [countryId], references: [id])
337
+ role Role? @relation(fields: [roleId], references: [id])
338
+
339
+ positionId String?
340
+ teamTypeId String?
341
+ teamId String?
342
+ countryId String?
343
+ roleId String?
344
+
345
+ TeamPlatform TeamPlatform[]
346
+ project Project[]
347
+ audit Audit[]
348
+
349
+ leadTechnician DispatchTeam[] @relation("LeadTechnician")
350
+ firstTechnician DispatchTeam[] @relation("FirstTechnician")
351
+ secondTechnician DispatchTeam[] @relation("SecondTechnician")
352
+ otherTechnician DispatchTeam[] @relation("OtherTechnician")
353
+ DispatchProject DispatchProject[]
354
+ WorkOrder WorkOrder[]
355
+ WorkOrderTasks WorkOrderTask[]
356
+ workOrderActivityLogs WorkOrderActivityLog[]
357
+ workOrderEditLogs WorkOrderEditLog[]
358
+ Notifications Notifications[]
359
+ }
360
+
361
+ model MainProject {
362
+ id String @id @unique @default(uuid())
363
+ no Int @default(autoincrement())
364
+ CamusatCountry CamusatCountry @relation(fields: [camusatCountryId], references: [id])
365
+ camusatCountryId String
366
+
367
+ CamusatClient CamusatClient? @relation(fields: [camusatClientId], references: [id])
368
+ camusatClientId String?
369
+ name String
370
+ projects Project[]
371
+ }
372
+
373
+ model Project {
374
+ id String @id @unique @default(uuid())
375
+ no Int @default(autoincrement())
376
+ name String
377
+ logo String? @db.Text //Upload file for logo
378
+ status String @default("Pending")
379
+ countries Json? //Manage countries
380
+ auditMatrices Json? //Audit Matrices
381
+
382
+ createdAt DateTime @default(now())
383
+ updatedAt DateTime @updatedAt
384
+ activatedAt DateTime?
385
+ deletedAt DateTime?
386
+
387
+ types ProjectType[]
388
+
389
+ mainProject MainProject @relation(fields: [mainProjectId], references: [id])
390
+ mainProjectId String
391
+
392
+ User User? @relation(fields: [userId], references: [id])
393
+ userId String?
394
+
395
+ DispatchProject DispatchProject[]
396
+ projectWorkflow ProjectWorkFlow[]
397
+ BillOfMaterial BillOfMaterial[]
398
+ WorkOrder WorkOrder[]
399
+ EmailConfigurations EmailConfigurations[]
400
+ WorkOrderChannel WorkOrderChannel[]
401
+ problemCategorization problemCategorization[]
402
+ EmailTemplates EmailTemplates[]
403
+ ReportFormats ReportFormats[]
404
+ platforms Platform[]
405
+ }
406
+
407
+ model Audit {
408
+ id Int @id @default(autoincrement())
409
+ no Int @default(autoincrement())
410
+ module String
411
+ moduleId Int?
412
+ activity String
413
+ detail String? @db.Text
414
+ device String? @db.Text
415
+ deviceIp String?
416
+ platform String?
417
+ status String @default("active")
418
+
419
+ createdAt DateTime @default(now())
420
+ updatedAt DateTime @updatedAt
421
+ deletedAt DateTime?
422
+ User User? @relation(fields: [userId], references: [id])
423
+ userId String?
424
+ }
425
+
426
+ model DispatchTeam {
427
+ id String @id @unique @default(uuid())
428
+ name String? //Team name
429
+ status String @default("active")
430
+
431
+ createdAt DateTime @default(now())
432
+ updatedAt DateTime @updatedAt
433
+ deletedAt DateTime?
434
+ type String @default("team")
435
+
436
+ LeadTechnician User @relation("LeadTechnician", fields: [leadTechnicianId], references: [id])
437
+ FirstTechnician User? @relation("FirstTechnician", fields: [firstTechnicianId], references: [id])
438
+ SecondTechnician User? @relation("SecondTechnician", fields: [secondTechnicianId], references: [id])
439
+ OtherTechnician User? @relation("OtherTechnician", fields: [otherTechnicianId], references: [id])
440
+ leadTechnicianId String
441
+ firstTechnicianId String?
442
+ secondTechnicianId String?
443
+ otherTechnicianId String?
444
+
445
+ TeamMaterial TeamMaterial[]
446
+ WorkOrders WorkOrder[]
447
+ dispatchProjects DispatchProject[]
448
+ workOrderActivityLogs WorkOrderActivityLog[]
449
+ }
450
+
451
+ model DispatchProject {
452
+ id String @id @unique @default(uuid())
453
+ no Int @default(autoincrement())
454
+ name String //sub project name
455
+ type String
456
+ teams DispatchTeam[] //Prject Teams
457
+ logo String? @db.Text //Upload file for logo
458
+ status String @default("active")
459
+ createdAt DateTime @default(now())
460
+ updatedAt DateTime @updatedAt
461
+ activatedAt DateTime?
462
+ deletedAt DateTime?
463
+ userId String?
464
+ projectId String?
465
+ Project Project? @relation(fields: [projectId], references: [id])
466
+ User User? @relation(fields: [userId], references: [id])
467
+ subsidiary CamusatCountry? @relation(fields: [subsidiaryId], references: [id])
468
+ subsidiaryId String?
469
+ DispatchMaterial DispatchMaterial[]
470
+ SubsidiaryMaterial SubsidiaryMaterial[]
471
+ clientMaterial clientMaterial[]
472
+ teamMaterial TeamMaterial[]
473
+ workOrderMaterial WorkOrderMaterial[]
474
+ templateComponent TemplateComponent[]
475
+ clientMaterialMovementLog clientMaterialMovementLog[]
476
+ teamMaterialMovementLog TeamMaterialMovementLog[]
477
+ subsidiaryMaterialMovementLog SubsidiaryMaterialMovementLog[]
478
+ }
479
+
480
+ model ProjectType {
481
+ id String @id @unique @default(uuid())
482
+ no Int @default(autoincrement())
483
+ name String
484
+ projects Project[]
485
+ }
486
+
487
+ model EmailConfigurations {
488
+ id String @id @unique @default(uuid())
489
+ no Int @default(autoincrement())
490
+ name String?
491
+ email String?
492
+ password String?
493
+ typeserver String? @default("IMAP")
494
+ server String?
495
+ serverportincoming String?
496
+ serverportoutgoing String?
497
+ authincoming String?
498
+ authoutgoing String?
499
+ sslincoming Boolean? @default(true)
500
+ ssloutgoing Boolean? @default(true)
501
+ infodelimiter String? @default(":")
502
+ otherdelimiter String?
503
+ subject String?
504
+ status String @default("active")
505
+ channel String @default("EMAIL")
506
+ mainId String?
507
+ column1title String?
508
+ column1key String?
509
+ column2title String?
510
+ column2key String?
511
+ typeKey String?
512
+ types Json?
513
+ data Json?
514
+ sampleData String? @db.Text
515
+ emailcount Int? @default(0)
516
+ emailsamplenumber Int?
517
+ emailuid String?
518
+ emailfirstpull Int?
519
+ emailfirstcount Int?
520
+ excelrownumber Int?
521
+
522
+ createdAt DateTime @default(now())
523
+ updatedAt DateTime @updatedAt
524
+ activatedAt DateTime?
525
+ deletedAt DateTime?
526
+ EmailsIncoming EmailsIncoming[]
527
+ EmailsOutGoing EmailsOutgoing[]
528
+ WorkOrder WorkOrder[]
529
+ Project Project? @relation(fields: [projectId], references: [id])
530
+ projectId String?
531
+ EmailsIncomingSample EmailsIncomingSample[]
532
+ }
533
+
534
+ model EmailsIncomingSample {
535
+ id String @id @unique @default(uuid())
536
+ messageId String?
537
+ subject String?
538
+ rawbody String?
539
+ attachment String?
540
+ headers Json?
541
+ body Json?
542
+ createdAt DateTime @default(now())
543
+ updatedAt DateTime @updatedAt
544
+
545
+ emailConfigurationsId String
546
+ EmailConfigurations EmailConfigurations @relation(fields: [emailConfigurationsId], references: [id])
547
+ }
548
+
549
+ model EmailsIncoming {
550
+ id String @id @unique @default(uuid())
551
+ no Int @default(autoincrement())
552
+ messageId String
553
+ sender String
554
+ receiver String
555
+ datereceived String
556
+ datesent String?
557
+ subject String?
558
+ body String?
559
+ attachment String?
560
+ seen Boolean @default(false)
561
+ status String @default("active")
562
+ createdAt DateTime @default(now())
563
+ updatedAt DateTime @updatedAt
564
+ activatedAt DateTime?
565
+ deletedAt DateTime?
566
+ emailConfigurationsId String?
567
+ EmailConfigurations EmailConfigurations? @relation(fields: [emailConfigurationsId], references: [id])
568
+
569
+ WorkOrder WorkOrder[]
570
+ }
571
+
572
+ model EmailsOutgoing {
573
+ id String @id @unique @default(uuid())
574
+ no Int @default(autoincrement())
575
+ receiver String
576
+ subject String?
577
+ body String?
578
+ attachment String?
579
+ status String @default("active")
580
+ createdAt DateTime @default(now())
581
+ updatedAt DateTime @updatedAt
582
+ activatedAt DateTime?
583
+ deletedAt DateTime?
584
+ emailConfigurationsId String?
585
+ EmailConfigurations EmailConfigurations? @relation(fields: [emailConfigurationsId], references: [id])
586
+ }
587
+
588
+ model EmailTemplates {
589
+ id String @id @unique @default(uuid())
590
+ no Int @default(autoincrement())
591
+ name String
592
+ subject String?
593
+ body String?
594
+ attachments Json?
595
+ workOrderInfo Json?
596
+ mailingList Json?
597
+ templateInfo Json?
598
+ status String @default("active")
599
+ createdAt DateTime @default(now())
600
+ updatedAt DateTime @updatedAt
601
+ deletedAt DateTime?
602
+ project Project @relation(fields: [projectId], references: [id])
603
+ projectId String
604
+ }
605
+
606
+ model WorkOrder {
607
+ id String @id @unique @default(uuid())
608
+ no Int @default(autoincrement())
609
+ mainId String
610
+ column1 String?
611
+ column2 String?
612
+ type String?
613
+ channel String? @default("EMAIL")
614
+ data Json?
615
+ rawData Json?
616
+ status String @default("new")
617
+ statusColour String @default("#ffffff")
618
+ workOrderTeamStatus String?
619
+ scheduledStartAt DateTime?
620
+ scheduledEndAt DateTime?
621
+ actionDate DateTime? //Date the work order was completed
622
+ auditMatrices Json?
623
+ sla String?
624
+
625
+ createdAt DateTime @default(now())
626
+ updatedAt DateTime @updatedAt
627
+ deletedAt DateTime?
628
+
629
+ team DispatchTeam? @relation(fields: [teamId], references: [id])
630
+ teamId String?
631
+
632
+ projectId String
633
+ Project Project @relation(fields: [projectId], references: [id])
634
+
635
+ EmailConfigurations EmailConfigurations? @relation(fields: [emailConfigurationsId], references: [id])
636
+ emailConfigurationsId String?
637
+
638
+ EmailsIncoming EmailsIncoming? @relation(fields: [emailsIncomingId], references: [id])
639
+ emailsIncomingId String?
640
+
641
+ manager User? @relation(fields: [managerId], references: [id])
642
+ managerId String?
643
+
644
+ workOrderTasks WorkOrderTask[]
645
+ workOrderActivityLogs WorkOrderActivityLog[]
646
+ workOrderEditLogs WorkOrderEditLog[]
647
+ }
648
+
649
+ model WorkOrderChannel {
650
+ id String @id @unique @default(uuid())
651
+ no Int @default(autoincrement())
652
+ name String
653
+
654
+ Project Project @relation(fields: [projectId], references: [id])
655
+ projectId String
656
+
657
+ createdAt DateTime @default(now())
658
+ updatedAt DateTime @updatedAt
659
+ deletedAt DateTime?
660
+ }
661
+
662
+ model WorkOrderTask {
663
+ id String @id @unique @default(uuid())
664
+ no Int @default(autoincrement())
665
+ name String
666
+ buttonName String
667
+ isSpecialFeature Boolean @default(false)
668
+ statusColor String?
669
+ featureName String?
670
+ status String @default("pending")
671
+ features Json?
672
+ comments String?
673
+ scheduledStartAt DateTime?
674
+
675
+ createdAt DateTime @default(now())
676
+ updatedAt DateTime @updatedAt
677
+ deletedAt DateTime?
678
+
679
+ technician User? @relation(fields: [technicianId], references: [id])
680
+ technicianId String?
681
+
682
+ workOrder WorkOrder @relation(fields: [workOrderId], references: [id])
683
+ workOrderId String
684
+
685
+ templateComponent TemplateComponent? @relation(fields: [templateComponentId], references: [id])
686
+ templateComponentId String
687
+
688
+ // workOrderTaskData WorkOrderTaskData[]
689
+ }
690
+
691
+ model WorkOrderActivityLog {
692
+ id String @id @unique @default(uuid())
693
+ no Int @default(autoincrement())
694
+ type String //Type of activity
695
+ activity String
696
+ detail Json?
697
+ reason String?
698
+ comment String?
699
+ statusUpdate String?
700
+
701
+ createdAt DateTime @default(now())
702
+ updatedAt DateTime @updatedAt
703
+ deletedAt DateTime?
704
+
705
+ workOrder WorkOrder @relation(fields: [workOrderId], references: [id])
706
+ workOrderId String
707
+
708
+ User User? @relation(fields: [userId], references: [id])
709
+ userId String?
710
+
711
+ team DispatchTeam? @relation(fields: [teamId], references: [id])
712
+ teamId String?
713
+ }
714
+
715
+ model WorkOrderEditLog {
716
+ id String @id @unique @default(uuid())
717
+ no Int @default(autoincrement())
718
+ action String @default("Edit")
719
+ description String @default("Edit Ticket")
720
+ newValues Json?
721
+ oldValues Json?
722
+
723
+ createdAt DateTime @default(now())
724
+ updatedAt DateTime @updatedAt
725
+ deletedAt DateTime?
726
+
727
+ workOrder WorkOrder @relation(fields: [workOrderId], references: [id])
728
+ workOrderId String
729
+
730
+ User User? @relation(fields: [userId], references: [id])
731
+ userId String?
732
+ }
733
+
734
+ // Have data as JSON for now
735
+ model WorkOrderTaskData {
736
+ id String @id @unique @default(uuid())
737
+ no Int @default(autoincrement())
738
+ description String
739
+ value String
740
+
741
+ createdAt DateTime @default(now())
742
+ updatedAt DateTime @updatedAt
743
+ deletedAt DateTime?
744
+
745
+ // workOrderTask WorkOrderTask @relation(fields: [workOrderTaskId], references: [id])
746
+ // workOrderTaskId String
747
+ }
748
+
749
+ // Houses the materials of a project
750
+ model BillOfMaterial {
751
+ id String @id @unique @default(uuid())
752
+ no Int @default(autoincrement())
753
+ name String
754
+ project Project? @relation(fields: [projectId], references: [id])
755
+ projectId String?
756
+ workflowType String @default("bom")
757
+
758
+ materials MaterialBillOfMaterial[]
759
+ projectWorkFlow ProjectWorkFlow[]
760
+ templateComponent TemplateComponent[]
761
+
762
+ createdAt DateTime @default(now())
763
+ updatedAt DateTime @updatedAt
764
+ deletedAt DateTime?
765
+ }
766
+
767
+ model Material {
768
+ id String @id @unique @default(uuid())
769
+ no Int @default(autoincrement())
770
+ name String
771
+ code String
772
+ description String?
773
+ unit String
774
+ status String @default("active")
775
+
776
+ createdAt DateTime @default(now())
777
+ updatedAt DateTime @updatedAt
778
+ deletedAt DateTime?
779
+
780
+ billOfMaterial MaterialBillOfMaterial[]
781
+ }
782
+
783
+ model MaterialBillOfMaterial {
784
+ id String @id @unique @default(uuid())
785
+ no Int @default(autoincrement())
786
+
787
+ createdAt DateTime @default(now())
788
+ updatedAt DateTime @updatedAt
789
+ deletedAt DateTime?
790
+
791
+ material Material @relation(fields: [materialId], references: [id])
792
+ materialId String
793
+ billOfMaterial BillOfMaterial @relation(fields: [billOfMaterialId], references: [id])
794
+ billOfMaterialId String
795
+
796
+ dispatchMaterial DispatchMaterial[]
797
+ }
798
+
799
+ model DispatchMaterial {
800
+ id String @id @unique @default(uuid())
801
+ no Int @default(autoincrement())
802
+ materialBillOfMaterial MaterialBillOfMaterial? @relation(fields: [materialbomId], references: [id])
803
+ materialbomId String?
804
+
805
+ dispatchProject DispatchProject? @relation(fields: [dispatchProjectId], references: [id])
806
+ dispatchProjectId String?
807
+
808
+ materialCode String?
809
+ materialName String?
810
+ description String?
811
+ unit String?
812
+ status String @default("active")
813
+
814
+ quantityAdded String @default("0")
815
+ quantityUsed String @default("0")
816
+ quantityRemaining String @default("0")
817
+
818
+ createdAt DateTime @default(now())
819
+ updatedAt DateTime @updatedAt
820
+ deletedAt DateTime?
821
+
822
+ stockMovement StockMovement[]
823
+ clientMaterial clientMaterial[]
824
+ teamMaterial TeamMaterial[]
825
+ workOrderMaterial WorkOrderMaterial[]
826
+ subsidiaryMaterial SubsidiaryMaterial[]
827
+ MaterialChangeLog MaterialChangeLog[]
828
+ }
829
+
830
+ model StockMovement {
831
+ id String @id @unique @default(uuid())
832
+ no Int @default(autoincrement())
833
+ material DispatchMaterial[]
834
+ movementType String
835
+ to String?
836
+ toId String?
837
+ from String?
838
+ fromId String?
839
+ quantity String
840
+
841
+ createdAt DateTime @default(now())
842
+ updatedAt DateTime @updatedAt
843
+ }
844
+
845
+ model clientMaterial {
846
+ id String @id @unique @default(uuid())
847
+ no Int @default(autoincrement())
848
+ material DispatchMaterial @relation(fields: [materialId], references: [id])
849
+ materialId String
850
+ client CamusatClient @relation(fields: [clientId], references: [id])
851
+ clientId String
852
+
853
+ quantityAdded String @default("0")
854
+ quantityUsed String @default("0")
855
+ quantityRemaining String @default("0")
856
+ status String @default("active")
857
+ type String @default("client")
858
+
859
+ createdAt DateTime @default(now())
860
+ updatedAt DateTime @updatedAt
861
+ deletedAt DateTime?
862
+
863
+ clientMaterialMovementLog clientMaterialMovementLog[]
864
+ dispatchProject DispatchProject[]
865
+ }
866
+
867
+ model clientMaterialMovementLog {
868
+ id String @id @unique @default(uuid())
869
+ no Int @default(autoincrement())
870
+ material clientMaterial[]
871
+ movementType String
872
+ movementFrom String?
873
+ movementFromName String?
874
+ movementFromId String?
875
+ movementTo String?
876
+ movementToName String?
877
+ movementToId String?
878
+ quantity String
879
+ materialMoved Json?
880
+
881
+ dispatchProject DispatchProject? @relation(fields: [dispatchProjectId], references: [id])
882
+ dispatchProjectId String?
883
+
884
+ createdAt DateTime @default(now())
885
+ updatedAt DateTime @updatedAt
886
+ deletedAt DateTime?
887
+ }
888
+
889
+ model SubsidiaryMaterial {
890
+ id String @id @unique @default(uuid())
891
+ no Int @default(autoincrement())
892
+ material DispatchMaterial @relation(fields: [materialId], references: [id])
893
+ materialId String
894
+
895
+ subsidiary CamusatCountry @relation(fields: [subsidiaryId], references: [id])
896
+ subsidiaryId String
897
+ dispatchProject DispatchProject[]
898
+
899
+ quantityAdded String @default("0")
900
+ quantityUsed String @default("0")
901
+ quantityRemaining String @default("0")
902
+ status String @default("active")
903
+ type String @default("subsidiary")
904
+
905
+ createdAt DateTime @default(now())
906
+ updatedAt DateTime @updatedAt
907
+ deletedAt DateTime?
908
+
909
+ subsidiaryMaterialMovementLog SubsidiaryMaterialMovementLog[]
910
+ }
911
+
912
+ model SubsidiaryMaterialMovementLog {
913
+ id String @id @unique @default(uuid())
914
+ no Int @default(autoincrement())
915
+ material SubsidiaryMaterial[]
916
+ movementType String
917
+ movementFrom String?
918
+ movementFromName String?
919
+ movementFromId String?
920
+ movementTo String?
921
+ movementToName String?
922
+ movementToId String?
923
+ quantity String
924
+ materialMoved Json?
925
+
926
+ dispatchProject DispatchProject? @relation(fields: [dispatchProjectId], references: [id])
927
+ dispatchProjectId String?
928
+
929
+ createdAt DateTime @default(now())
930
+ updatedAt DateTime @updatedAt
931
+ deletedAt DateTime?
932
+ }
933
+
934
+ model TeamMaterial {
935
+ id String @id @unique @default(uuid())
936
+ no Int @default(autoincrement())
937
+ material DispatchMaterial @relation(fields: [materialId], references: [id])
938
+ materialId String
939
+ team DispatchTeam @relation(fields: [teamId], references: [id])
940
+ teamId String
941
+
942
+ quantityAdded String @default("0")
943
+ quantityUsed String @default("0")
944
+ quantityRemaining String @default("0")
945
+ status String @default("active")
946
+ type String @default("team")
947
+
948
+ createdAt DateTime @default(now())
949
+ updatedAt DateTime @updatedAt
950
+ deletedAt DateTime?
951
+
952
+ teamMaterialMovementLog TeamMaterialMovementLog[]
953
+ dispatchProject DispatchProject[]
954
+ }
955
+
956
+ model TeamMaterialMovementLog {
957
+ id String @id @unique @default(uuid())
958
+ no Int @default(autoincrement())
959
+ material TeamMaterial[]
960
+ movementType String
961
+ movementFrom String?
962
+ movementFromName String?
963
+ movementFromId String?
964
+ movementTo String?
965
+ movementToName String?
966
+ movementToId String?
967
+ quantity String
968
+ materialMoved Json?
969
+
970
+ dispatchProject DispatchProject? @relation(fields: [dispatchProjectId], references: [id])
971
+ dispatchProjectId String?
972
+
973
+ createdAt DateTime @default(now())
974
+ updatedAt DateTime @updatedAt
975
+ deletedAt DateTime?
976
+ }
977
+
978
+ model WorkOrderMaterial {
979
+ id String @id @unique @default(uuid())
980
+ no Int @default(autoincrement())
981
+ material DispatchMaterial @relation(fields: [materialId], references: [id])
982
+ materialId String
983
+
984
+ quantityAdded String? @default("0")
985
+ quantityUsed String @default("0")
986
+ quantityRemaining String @default("0")
987
+ status String @default("active")
988
+
989
+ createdAt DateTime @default(now())
990
+ updatedAt DateTime @updatedAt
991
+ deletedAt DateTime?
992
+
993
+ ticketMaterialMovementLog ticketMaterialMovementLog[]
994
+ dispatchProject DispatchProject[]
995
+ }
996
+
997
+ model ticketMaterialMovementLog {
998
+ id String @id @unique @default(uuid())
999
+ no Int @default(autoincrement())
1000
+ material WorkOrderMaterial[]
1001
+ movementType String
1002
+ movementFrom String?
1003
+ movementFromId String?
1004
+ movementTo String?
1005
+ movementToId String?
1006
+ quantity String
1007
+ materialMoved Json?
1008
+
1009
+ createdAt DateTime @default(now())
1010
+ updatedAt DateTime @updatedAt
1011
+ deletedAt DateTime?
1012
+ }
1013
+
1014
+ model MaterialChangeLog {
1015
+ id String @id @unique @default(uuid())
1016
+ no Int @default(autoincrement())
1017
+
1018
+ material DispatchMaterial @relation(fields: [materialId], references: [id])
1019
+ materialId String
1020
+
1021
+ action String
1022
+ createdAt DateTime @default(now())
1023
+ updatedAt DateTime @updatedAt
1024
+ deletedAt DateTime?
1025
+ }
1026
+
1027
+ model problemCategorization {
1028
+ id String @id @unique @default(uuid())
1029
+ no Int @default(autoincrement())
1030
+ reason String
1031
+ problemType String
1032
+ platformName String
1033
+ project Project? @relation(fields: [projectId], references: [id])
1034
+ projectId String?
1035
+
1036
+ createdAt DateTime @default(now())
1037
+ updatedAt DateTime @updatedAt
1038
+ deletedAt DateTime?
1039
+ }
1040
+
1041
+ model Notifications {
1042
+ id String @id @unique @default(uuid())
1043
+ no Int @default(autoincrement())
1044
+ title String
1045
+ description String
1046
+ status String @default("unread")
1047
+ createdAt DateTime @default(now())
1048
+ updatedAt DateTime @updatedAt
1049
+ deletedAt DateTime?
1050
+
1051
+ user User @relation(fields: [userId], references: [id])
1052
+ userId String
1053
+ }
1054
+
1055
+ model ReportFormats {
1056
+ id String @id @unique @default(uuid())
1057
+ no Int @default(autoincrement())
1058
+ name String
1059
+ header1 String?
1060
+ header2 String?
1061
+ header3 String?
1062
+ mainInfo Json? //Ticket Main info
1063
+ ticketDetails Json? //More ticket details
1064
+ materialInfo Json? //Material Info
1065
+ teamInfo Json? //Team Info
1066
+ interventionResults Json? //Work Order Results
1067
+ attachments Json? //Attachments
1068
+
1069
+ status String @default("active")
1070
+
1071
+ createdAt DateTime @default(now())
1072
+ updatedAt DateTime @updatedAt
1073
+ deletedAt DateTime?
1074
+
1075
+ project Project @relation(fields: [projectId], references: [id])
1076
+ projectId String
1077
+ }