@delpa/mt-prisma 0.13.0 → 0.14.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.
@@ -63,6 +63,55 @@ enum FuelType {
63
63
  GAS
64
64
  }
65
65
 
66
+ enum PackagingType {
67
+ BOX
68
+ PALLET
69
+ CRATE
70
+ BARREL
71
+ BAG
72
+ ROLL
73
+ BUNDLE
74
+ CONTAINER
75
+ LOOSE
76
+ OTHER
77
+ }
78
+
79
+ enum ProductCategory {
80
+ ELECTRONICS
81
+ FOOD_BEVERAGE
82
+ PHARMACEUTICALS
83
+ TEXTILES
84
+ MACHINERY
85
+ CHEMICALS
86
+ CONSTRUCTION
87
+ AUTOMOTIVE
88
+ AGRICULTURE
89
+ FURNITURE
90
+ PAPER
91
+ PLASTICS
92
+ METALS
93
+ GLASS
94
+ OTHER
95
+ }
96
+
97
+ enum ProductSubcategory {
98
+ RAW_MATERIALS
99
+ FINISHED_GOODS
100
+ SEMI_FINISHED
101
+ SPARE_PARTS
102
+ CONSUMABLES
103
+ HAZARDOUS
104
+ FRAGILE
105
+ PERISHABLE
106
+ REFRIGERATED
107
+ FROZEN
108
+ BULK
109
+ LIQUID
110
+ OVERSIZED
111
+ HIGH_VALUE
112
+ OTHER
113
+ }
114
+
66
115
  enum AddressType {
67
116
  PICKUP
68
117
  DELIVERY
@@ -104,6 +153,32 @@ enum GpsProviders {
104
153
  ONIX
105
154
  SASCAR
106
155
  }
156
+ model Product {
157
+ id String @id @default(uuid()) @db.Uuid
158
+ client_id String @db.Uuid
159
+ description String
160
+ sku String @unique
161
+ quantity Int @default(0)
162
+ packaging_type PackagingType @default(BOX)
163
+ category ProductCategory @default(OTHER)
164
+ subcategory ProductSubcategory @default(OTHER)
165
+ dimension_unit DimensionUnits @default(CM)
166
+ length Float?
167
+ width Float?
168
+ height Float?
169
+ weight_unit WeightUnits @default(KG)
170
+ weight Float?
171
+ is_active Boolean @default(true)
172
+ created_at DateTime @default(now())
173
+ updated_at DateTime @updatedAt
174
+
175
+ client Client @relation(fields: [client_id], references: [id], onDelete: Cascade)
176
+
177
+ @@index([client_id])
178
+ @@index([sku])
179
+ @@index([category])
180
+ @@map("products")
181
+ }
107
182
 
108
183
  model Client {
109
184
  id String @id @default(uuid()) @db.Uuid
@@ -122,6 +197,7 @@ model Client {
122
197
  contacts ClientContact[]
123
198
  orders_as_shipper Order[] @relation("shipper_client")
124
199
  handling_units_as_consignee HandlingUnit[]
200
+ products Product[]
125
201
 
126
202
  @@index([company_id])
127
203
  @@index([created_by])
@@ -198,7 +274,10 @@ model companies {
198
274
  clients Client[]
199
275
  vehicles Vehicle[]
200
276
  user_companies UserCompany[]
201
- equipments Equipment[]
277
+ equipments Equipment[]
278
+ form_templates FormTemplate[]
279
+ form_responses FormResponse[]
280
+ forms Form[]
202
281
 
203
282
  @@map("companies")
204
283
  }
@@ -253,6 +332,9 @@ model User {
253
332
  user_companies UserCompany[]
254
333
  sessions Session[]
255
334
  driverLocations DriverLocation[]
335
+ form_templates_created FormTemplate[]
336
+ form_responses FormResponse[]
337
+ forms_created Form[] @relation("FormCreator")
256
338
 
257
339
  @@map("users")
258
340
  }
@@ -553,3 +635,179 @@ model DriverLocation {
553
635
  @@index([created_at])
554
636
  @@map("driver_locations")
555
637
  }
638
+ // ============================================
639
+ // FORMS - Form Templates, Fields and Responses
640
+ // ============================================
641
+
642
+ enum FieldType {
643
+ TEXT
644
+ TEXTAREA
645
+ NUMBER
646
+ EMAIL
647
+ PHONE
648
+ DATE
649
+ DATETIME
650
+ TIME
651
+ SELECT
652
+ MULTISELECT
653
+ CHECKBOX
654
+ RADIO
655
+ FILE
656
+ IMAGE
657
+ SIGNATURE
658
+ LOCATION
659
+ }
660
+
661
+ enum FormResponseStatus {
662
+ DRAFT
663
+ SUBMITTED
664
+ APPROVED
665
+ REJECTED
666
+ }
667
+
668
+ model FormTemplate {
669
+ id String @id @default(uuid()) @db.Uuid
670
+ name String
671
+ description String?
672
+ company_id String? @db.Uuid
673
+ is_active Boolean @default(true)
674
+ is_global Boolean @default(false)
675
+ category String?
676
+ version Int @default(1)
677
+ created_by String? @db.Uuid
678
+ created_at DateTime @default(now())
679
+ updated_at DateTime @updatedAt
680
+
681
+ company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
682
+ created_by_user User? @relation(fields: [created_by], references: [id], onDelete: SetNull)
683
+ fields TemplateField[]
684
+ responses FormResponse[]
685
+ forms Form[]
686
+
687
+ @@index([company_id])
688
+ @@index([is_global])
689
+ @@index([category])
690
+ @@index([is_active])
691
+ @@map("form_templates")
692
+ }
693
+
694
+ model TemplateField {
695
+ id String @id @default(uuid()) @db.Uuid
696
+ template_id String @db.Uuid
697
+ label String
698
+ field_type FieldType
699
+ placeholder String?
700
+ help_text String?
701
+ is_required Boolean @default(false)
702
+ order Int @default(0)
703
+ options Json?
704
+ validations Json?
705
+ default_value String?
706
+ conditional_logic Json?
707
+ created_at DateTime @default(now())
708
+ updated_at DateTime @updatedAt
709
+
710
+ template FormTemplate @relation(fields: [template_id], references: [id], onDelete: Cascade)
711
+
712
+ @@index([template_id])
713
+ @@map("template_fields")
714
+ }
715
+
716
+ model FormResponse {
717
+ id String @id @default(uuid()) @db.Uuid
718
+ template_id String? @db.Uuid
719
+ form_id String? @db.Uuid
720
+ entity_type String
721
+ entity_id String @db.Uuid
722
+ company_id String? @db.Uuid
723
+ respondent_id String? @db.Uuid
724
+ responses Json
725
+ status FormResponseStatus @default(DRAFT)
726
+ submitted_at DateTime?
727
+ created_at DateTime @default(now())
728
+ updated_at DateTime @updatedAt
729
+
730
+ template FormTemplate? @relation(fields: [template_id], references: [id])
731
+ form Form? @relation(fields: [form_id], references: [id])
732
+ company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
733
+ respondent User? @relation(fields: [respondent_id], references: [id], onDelete: SetNull)
734
+
735
+ @@index([template_id])
736
+ @@index([form_id])
737
+ @@index([entity_type, entity_id])
738
+ @@index([company_id])
739
+ @@index([status])
740
+ @@map("form_responses")
741
+ }
742
+
743
+ // ============================================
744
+ // FORMS - Created forms from templates
745
+ // ============================================
746
+
747
+ enum FormTargetType {
748
+ DRIVER
749
+ VEHICLE
750
+ COMPANY_PARTNER
751
+ CLIENT
752
+ ORDER
753
+ ROUTE
754
+ }
755
+
756
+ enum FormStatus {
757
+ ACTIVE
758
+ COMPLETED
759
+ CANCELLED
760
+ EXPIRED
761
+ }
762
+
763
+ model Form {
764
+ id String @id @default(uuid()) @db.Uuid
765
+ name String
766
+ description String?
767
+ template_id String? @db.Uuid
768
+ company_id String? @db.Uuid
769
+ target_type FormTargetType
770
+ target_ids String[] @db.Uuid
771
+ is_required Boolean @default(false)
772
+ due_date DateTime?
773
+ status FormStatus @default(ACTIVE)
774
+ created_by String? @db.Uuid
775
+ created_at DateTime @default(now())
776
+ updated_at DateTime @updatedAt
777
+
778
+ template FormTemplate? @relation(fields: [template_id], references: [id], onDelete: SetNull)
779
+ company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
780
+ created_by_user User? @relation("FormCreator", fields: [created_by], references: [id], onDelete: SetNull)
781
+ fields FormField[]
782
+ responses FormResponse[]
783
+
784
+ @@index([company_id])
785
+ @@index([template_id])
786
+ @@index([target_type])
787
+ @@index([status])
788
+ @@index([due_date])
789
+ @@map("forms")
790
+ }
791
+
792
+ model FormField {
793
+ id String @id @default(uuid()) @db.Uuid
794
+ form_id String @db.Uuid
795
+ source_field_id String? @db.Uuid
796
+ label String
797
+ field_type FieldType
798
+ placeholder String?
799
+ help_text String?
800
+ is_required Boolean @default(false)
801
+ order Int @default(0)
802
+ options Json?
803
+ validations Json?
804
+ default_value String?
805
+ conditional_logic Json?
806
+ created_at DateTime @default(now())
807
+ updated_at DateTime @updatedAt
808
+
809
+ form Form @relation(fields: [form_id], references: [id], onDelete: Cascade)
810
+
811
+ @@index([form_id])
812
+ @@map("form_fields")
813
+ }