@delpa/mt-prisma 0.14.0 → 0.16.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 (50) hide show
  1. package/dist/generated/client/edge.js +425 -23
  2. package/dist/generated/client/index-browser.js +430 -29
  3. package/dist/generated/client/index.d.ts +71466 -28468
  4. package/dist/generated/client/index.js +426 -24
  5. package/dist/generated/client/package.json +3 -3
  6. package/dist/generated/client/query_compiler_fast_bg.js +2 -0
  7. package/dist/generated/client/query_compiler_fast_bg.wasm +0 -0
  8. package/dist/generated/client/query_compiler_fast_bg.wasm-base64.js +2 -0
  9. package/dist/generated/client/runtime/client.d.ts +4 -17
  10. package/dist/generated/client/runtime/client.js +20 -20
  11. package/dist/generated/client/runtime/wasm-compiler-edge.js +18 -18
  12. package/dist/generated/client/schema.prisma +648 -66
  13. package/dist/generated/client/wasm-edge-light-loader.mjs +1 -1
  14. package/dist/generated/client/wasm-worker-loader.mjs +1 -1
  15. package/dist/generated/generated/client/edge.js +225 -24
  16. package/dist/generated/generated/client/index-browser.js +218 -18
  17. package/dist/generated/generated/client/index.d.ts +63096 -34291
  18. package/dist/generated/generated/client/index.js +226 -25
  19. package/dist/generated/generated/client/package.json +3 -3
  20. package/dist/generated/generated/client/query_compiler_fast_bg.js +2 -0
  21. package/dist/generated/generated/client/query_compiler_fast_bg.wasm +0 -0
  22. package/dist/generated/generated/client/query_compiler_fast_bg.wasm-base64.js +2 -0
  23. package/dist/generated/generated/client/runtime/client.d.ts +4 -17
  24. package/dist/generated/generated/client/runtime/client.js +20 -20
  25. package/dist/generated/generated/client/runtime/wasm-compiler-edge.js +18 -18
  26. package/dist/generated/generated/client/schema.prisma +398 -73
  27. package/dist/generated/generated/client/wasm-edge-light-loader.mjs +1 -1
  28. package/dist/generated/generated/client/wasm-worker-loader.mjs +1 -1
  29. package/generated/client/edge.js +225 -24
  30. package/generated/client/index-browser.js +218 -18
  31. package/generated/client/index.d.ts +63096 -34291
  32. package/generated/client/index.js +226 -25
  33. package/generated/client/package.json +3 -3
  34. package/generated/client/query_compiler_fast_bg.js +2 -0
  35. package/generated/client/query_compiler_fast_bg.wasm +0 -0
  36. package/generated/client/query_compiler_fast_bg.wasm-base64.js +2 -0
  37. package/generated/client/runtime/client.d.ts +4 -17
  38. package/generated/client/runtime/client.js +20 -20
  39. package/generated/client/runtime/wasm-compiler-edge.js +18 -18
  40. package/generated/client/schema.prisma +398 -73
  41. package/generated/client/wasm-edge-light-loader.mjs +1 -1
  42. package/generated/client/wasm-worker-loader.mjs +1 -1
  43. package/package.json +1 -1
  44. package/prisma/migrations/20260127193502_enable_postgis/migration.sql +2 -0
  45. package/prisma/migrations/20260127193503_add_schema_tenders/migration.sql +410 -0
  46. package/prisma/migrations/20260202133514_agrega_product_in_handling_units/migration.sql +8 -0
  47. package/prisma/migrations/20260202150634_simplify_handling_unit_remove_redundant_fields/migration.sql +29 -0
  48. package/prisma/migrations/20260202162217_fix_reference_for_products/migration.sql +22 -0
  49. package/prisma/migrations/20260202163057_fix_vechicle_equipment_name/migration.sql +25 -0
  50. package/prisma/schema.prisma +495 -168
@@ -154,9 +154,46 @@ enum GpsProviders {
154
154
  SASCAR
155
155
  }
156
156
 
157
+ enum TenderStatus {
158
+ OPEN
159
+ CLOSED
160
+ AWARDED
161
+ CANCELLED
162
+ DRAFT
163
+ PAUSED
164
+ }
165
+
166
+ enum TenderType {
167
+ FIXED_PRICE_TENDER
168
+ TENDER_WITHOUT_FIXED_PRICES
169
+ }
170
+
171
+ enum TripType {
172
+ NATIONAL
173
+ INTERNATIONAL
174
+ }
175
+
176
+ enum ApplicationStatus {
177
+ PENDING
178
+ APPROVED
179
+ REJECTED
180
+ WITHDRAWN
181
+ }
182
+
183
+ enum LocationType {
184
+ CITY
185
+ STATE
186
+ COUNTRY
187
+ }
188
+
189
+ enum TenderMode {
190
+ PUBLIC
191
+ PRIVATE
192
+ }
193
+
157
194
  model Product {
158
195
  id String @id @default(uuid()) @db.Uuid
159
- client_id String @db.Uuid
196
+ company_id String @db.Uuid
160
197
  description String
161
198
  sku String @unique
162
199
  quantity Int @default(0)
@@ -173,9 +210,11 @@ model Product {
173
210
  created_at DateTime @default(now())
174
211
  updated_at DateTime @updatedAt
175
212
 
176
- client Client @relation(fields: [client_id], references: [id], onDelete: Cascade)
213
+ handlingUnits HandlingUnit[]
177
214
 
178
- @@index([client_id])
215
+ company Companies @relation(fields: [company_id], references: [id], onDelete: Cascade)
216
+
217
+ @@index([company_id])
179
218
  @@index([sku])
180
219
  @@index([category])
181
220
  @@map("products")
@@ -193,12 +232,11 @@ model Client {
193
232
  created_at DateTime @default(now())
194
233
  updated_at DateTime @updatedAt
195
234
 
196
- company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
235
+ company Companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
197
236
  addresses ClientAddress[]
198
237
  contacts ClientContact[]
199
238
  orders_as_shipper Order[] @relation("shipper_client")
200
239
  handling_units_as_consignee HandlingUnit[]
201
- products Product[]
202
240
 
203
241
  @@index([company_id])
204
242
  @@index([created_by])
@@ -257,77 +295,86 @@ model Order {
257
295
  shipper Client? @relation("shipper_client", fields: [shipper_id], references: [id], onDelete: SetNull)
258
296
  handling_units HandlingUnit[]
259
297
  routes Route[]
298
+ tenders Tender[]
260
299
 
261
300
  @@index([shipper_id])
262
301
  @@map("orders")
263
302
  }
264
303
 
265
- model companies {
304
+ model Companies {
266
305
  id String @id @default(uuid()) @db.Uuid
267
306
  tax_id String? @unique
268
307
  name String
269
308
  address Json? @default("{}")
270
309
  contact_info Json? @default("{}")
271
310
  country_code String?
311
+ is_validated Boolean? @default(false)
312
+ documents Json? @default("[]")
272
313
  created_at DateTime @default(now())
273
314
  updated_at DateTime @updatedAt
274
315
 
275
- clients Client[]
276
- vehicles Vehicle[]
277
- user_companies UserCompany[]
278
- equipments Equipment[]
279
- form_templates FormTemplate[]
280
- form_responses FormResponse[]
281
- forms Form[]
282
-
316
+ clients Client[]
317
+ vehicles Vehicle[]
318
+ user_companies UserCompany[]
319
+ equipments Equipment[]
320
+ form_templates FormTemplate[]
321
+ form_responses FormResponse[]
322
+ forms Form[]
323
+ tenders Tender[]
324
+ groups Group[]
325
+ companyLocations CompanyLocation[]
326
+ regularSuppliers RegularSupplier[]
327
+ products Product[]
328
+
329
+ regularSuppliers2 RegularSupplier[] @relation("SupplierCompany")
330
+
331
+ @@index([tax_id])
332
+ @@index([country_code])
333
+ @@index([name])
283
334
  @@map("companies")
284
335
  }
285
336
 
286
337
  model HandlingUnit {
287
- id String @id @default(uuid()) @db.Uuid
288
- order_id String @db.Uuid
289
- description String
290
- quantity Int @default(1)
291
- weight Float?
292
- weight_unit WeightUnits @default(KG)
293
- length Float?
294
- width Float?
295
- height Float?
296
- volume Float?
297
- dimension_unit DimensionUnits @default(CM)
298
- total_volume Float?
299
- total_weight Float?
300
- commodity String?
301
- delivery_contact Json? @default("{}")
302
- pickup_contact Json? @default("{}")
303
- delivery_address Json? @default("{}")
304
- pickup_address Json? @default("{}")
338
+ id String @id @default(uuid()) @db.Uuid
339
+ order_id String @db.Uuid
340
+ quantity Int @default(1)
341
+ delivery_contact Json? @default("{}")
342
+ pickup_contact Json? @default("{}")
343
+ delivery_address Json? @default("{}")
344
+ pickup_address Json? @default("{}")
305
345
  delivery_instructions String?
306
346
  pickup_instructions String?
307
- client_id String? @db.Uuid
308
- contact_notify Json? @default("[]")
347
+ client_id String? @db.Uuid
348
+ contact_notify Json? @default("[]")
309
349
  eta DateTime?
310
- created_at DateTime @default(now())
311
- updated_at DateTime @updatedAt
350
+ product_id String? @db.Uuid
351
+ notes String?
352
+ created_at DateTime @default(now())
353
+ updated_at DateTime @updatedAt
354
+
355
+ order Order @relation(fields: [order_id], references: [id], onDelete: Cascade)
356
+ client Client? @relation(fields: [client_id], references: [id], onDelete: SetNull)
357
+ product Product? @relation(fields: [product_id], references: [id], onDelete: SetNull)
312
358
 
313
- order Order @relation(fields: [order_id], references: [id], onDelete: Cascade)
314
- client Client? @relation(fields: [client_id], references: [id], onDelete: SetNull)
315
359
  route_handling_units RouteHandlingUnit[]
316
360
  address_handling_units AddressHandlingUnit[]
317
361
 
318
362
  @@index([order_id])
319
363
  @@index([client_id])
364
+ @@index([product_id])
320
365
  @@map("handling_units")
321
366
  }
322
367
 
323
368
  model User {
324
- id String @id @default(uuid()) @db.Uuid
325
- email String @unique
326
- name String
327
- password String
328
- role Roles @default(GUEST)
329
- created_at DateTime @default(now())
330
- updated_at DateTime @updatedAt
369
+ id String @id @default(uuid()) @db.Uuid
370
+ email String @unique
371
+ name String
372
+ password String
373
+ role Roles @default(GUEST)
374
+ driver_validated Boolean? @default(false)
375
+ documents Json? @default("[]")
376
+ created_at DateTime @default(now())
377
+ updated_at DateTime @updatedAt
331
378
 
332
379
  routes Route[]
333
380
  user_companies UserCompany[]
@@ -335,7 +382,14 @@ model User {
335
382
  driverLocations DriverLocation[]
336
383
  form_templates_created FormTemplate[]
337
384
  form_responses FormResponse[]
338
- forms_created Form[] @relation("FormCreator")
385
+ forms_created Form[] @relation("FormCreator")
386
+ tenders Tender[]
387
+ tenderChats TenderChat[] @relation("TenderChatSender")
388
+ tenderChats2 TenderChat[] @relation("TenderChatReceiver")
389
+ tenderApplications TenderApplication[] @relation("ApplicantUser")
390
+ tenderApplications2 TenderApplication[] @relation("UpdaterUser")
391
+ userGroups UserGroup[]
392
+ tenderNotifications TenderNotification[]
339
393
 
340
394
  @@map("users")
341
395
  }
@@ -349,7 +403,7 @@ model UserCompany {
349
403
  updated_at DateTime @updatedAt
350
404
 
351
405
  user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
352
- company companies @relation(fields: [company_id], references: [id], onDelete: Cascade)
406
+ company Companies @relation(fields: [company_id], references: [id], onDelete: Cascade)
353
407
 
354
408
  @@unique([user_id, company_id])
355
409
  @@index([user_id])
@@ -405,28 +459,33 @@ model VehicleModel {
405
459
  }
406
460
 
407
461
  model Vehicle {
408
- id String @id @default(uuid()) @db.Uuid
409
- license_plate String @unique
410
- brand_id String? @db.Uuid
411
- model_id String? @db.Uuid
412
- capacity Float?
413
- year Int?
414
- fuel_type FuelType? @default(DIESEL)
415
- color VehicleColor?
416
- chassis_number String? @unique
417
- size VehicleSize? @default(MEDIUM)
418
- gps_enabled Boolean @default(false)
419
- image_url Json? @default("[]")
420
- company_id String? @db.Uuid
421
- created_at DateTime @default(now())
422
- updated_at DateTime @updatedAt
423
-
424
- brand VehicleBrand? @relation(fields: [brand_id], references: [id], onDelete: SetNull)
425
- model VehicleModel? @relation(fields: [model_id], references: [id], onDelete: SetNull)
426
- company companies? @relation(fields: [company_id], references: [id], onDelete: Cascade)
427
- routes Route[]
428
- equipments Equipment[]
429
- vehicleLocations VehicleLocation[]
462
+ id String @id @default(uuid()) @db.Uuid
463
+ license_plate String @unique
464
+ brand_id String? @db.Uuid
465
+ model_id String? @db.Uuid
466
+ vehicle_type_id String? @db.Uuid
467
+ capacity Float?
468
+ year Int?
469
+ fuel_type FuelType? @default(DIESEL)
470
+ color VehicleColor?
471
+ chassis_number String? @unique
472
+ size VehicleSize? @default(MEDIUM)
473
+ gps_enabled Boolean @default(false)
474
+ image_url Json? @default("[]")
475
+ company_id String? @db.Uuid
476
+ is_validated Boolean? @default(false)
477
+ documents Json? @default("[]")
478
+ created_at DateTime @default(now())
479
+ updated_at DateTime @updatedAt
480
+
481
+ brand VehicleBrand? @relation(fields: [brand_id], references: [id], onDelete: SetNull)
482
+ model VehicleModel? @relation(fields: [model_id], references: [id], onDelete: SetNull)
483
+ company Companies? @relation(fields: [company_id], references: [id], onDelete: Cascade)
484
+ vehicle_type VehicleType? @relation(fields: [vehicle_type_id], references: [id], onDelete: SetNull)
485
+ routes Route[]
486
+ equipments Equipment[]
487
+ vehicleLocations VehicleLocation[]
488
+ tenderApplications TenderApplication[]
430
489
 
431
490
  @@index([company_id])
432
491
  @@index([brand_id])
@@ -575,12 +634,14 @@ model Equipment {
575
634
  status EquipmentStatus @default(ACTIVE)
576
635
  company_id String? @db.Uuid
577
636
  vehicle_id String? @db.Uuid
637
+ is_validated Boolean? @default(false)
638
+ documents Json? @default("[]")
578
639
  created_at DateTime @default(now())
579
640
  updated_at DateTime @updatedAt
580
641
 
581
642
  brand EquipmentBrand? @relation(fields: [brand_id], references: [id], onDelete: SetNull)
582
643
  model EquipmentModel? @relation(fields: [model_id], references: [id], onDelete: SetNull)
583
- company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
644
+ company Companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
584
645
  vehicle Vehicle? @relation(fields: [vehicle_id], references: [id], onDelete: SetNull)
585
646
  vehicleLocations VehicleLocation[]
586
647
 
@@ -680,7 +741,7 @@ model FormTemplate {
680
741
  created_at DateTime @default(now())
681
742
  updated_at DateTime @updatedAt
682
743
 
683
- company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
744
+ company Companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
684
745
  created_by_user User? @relation(fields: [created_by], references: [id], onDelete: SetNull)
685
746
  fields TemplateField[]
686
747
  responses FormResponse[]
@@ -731,7 +792,7 @@ model FormResponse {
731
792
 
732
793
  template FormTemplate? @relation(fields: [template_id], references: [id])
733
794
  form Form? @relation(fields: [form_id], references: [id])
734
- company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
795
+ company Companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
735
796
  respondent User? @relation(fields: [respondent_id], references: [id], onDelete: SetNull)
736
797
 
737
798
  @@index([template_id])
@@ -778,7 +839,7 @@ model Form {
778
839
  updated_at DateTime @updatedAt
779
840
 
780
841
  template FormTemplate? @relation(fields: [template_id], references: [id], onDelete: SetNull)
781
- company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
842
+ company Companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
782
843
  created_by_user User? @relation("FormCreator", fields: [created_by], references: [id], onDelete: SetNull)
783
844
  fields FormField[]
784
845
  responses FormResponse[]
@@ -813,3 +874,267 @@ model FormField {
813
874
  @@index([form_id])
814
875
  @@map("form_fields")
815
876
  }
877
+
878
+ model VehicleType {
879
+ id String @id @default(uuid()) @db.Uuid
880
+ name String @unique
881
+ description String?
882
+ is_active Boolean @default(true)
883
+ created_at DateTime @default(now())
884
+ updated_at DateTime @updatedAt
885
+
886
+ vehicles Vehicle[]
887
+ tenderVehicles TenderVehicle[]
888
+
889
+ @@map("vehicle_types")
890
+ }
891
+
892
+ model VehicleEquipment {
893
+ id String @id @default(uuid()) @db.Uuid
894
+ name String @unique
895
+
896
+ tenderVehicleEquipments TenderVehicleEquipment[]
897
+
898
+ @@map("vehicle_equipments")
899
+ }
900
+
901
+ model Tender {
902
+ id String @id @default(uuid()) @db.Uuid
903
+ title String
904
+ description String?
905
+ status TenderStatus @default(DRAFT)
906
+ tender_type TenderType @default(FIXED_PRICE_TENDER)
907
+ tender_mode TenderMode @default(PUBLIC)
908
+ budget Float?
909
+ currency String? @default("USD")
910
+ user_id String @db.Uuid
911
+ company_id String @db.Uuid
912
+ order_id String? @db.Uuid
913
+ trip_type TripType @default(NATIONAL)
914
+ expiration_date DateTime
915
+ terms_and_conditions Json?
916
+ created_at DateTime @default(now())
917
+ updated_at DateTime @updatedAt
918
+
919
+ user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
920
+ company Companies @relation(fields: [company_id], references: [id], onDelete: Cascade)
921
+ order Order? @relation(fields: [order_id], references: [id], onDelete: SetNull)
922
+ tenderVehicles TenderVehicle[]
923
+ tenderChats TenderChat[]
924
+ tenderNotifications TenderNotification[]
925
+ tenderLocationNotifications TenderLocationNotification[]
926
+
927
+ @@index([user_id])
928
+ @@index([company_id])
929
+ @@index([order_id])
930
+ @@map("tenders")
931
+ }
932
+
933
+ model TenderVehicle {
934
+ id String @id @default(uuid()) @db.Uuid
935
+ tender_id String @db.Uuid
936
+ vehicle_type_id String @db.Uuid
937
+ quantity Int @default(1)
938
+ min_weight_capacity Float?
939
+ weight_unit WeightUnits @default(KG)
940
+ min_volume_capacity Float?
941
+ dimension_unit DimensionUnits @default(MT)
942
+ min_year Int?
943
+ pickup_datetime DateTime?
944
+ delivery_datetime DateTime?
945
+ pickup_instructions String?
946
+ delivery_instructions String?
947
+ budget_per_vehicle Float?
948
+ currency String? @default("USD")
949
+ is_negotiable Boolean @default(false)
950
+ created_at DateTime @default(now())
951
+ updated_at DateTime @updatedAt
952
+
953
+ tender Tender @relation(fields: [tender_id], references: [id], onDelete: Cascade)
954
+ vehicle_type VehicleType @relation(fields: [vehicle_type_id], references: [id], onDelete: Cascade)
955
+ tenderVehicleEquipments TenderVehicleEquipment[]
956
+ tenderApplications TenderApplication[]
957
+
958
+ @@index([tender_id])
959
+ @@index([vehicle_type_id])
960
+ @@map("tender_vehicles")
961
+ }
962
+
963
+ model TenderVehicleEquipment {
964
+ id String @id @default(uuid()) @db.Uuid
965
+ tender_vehicle_id String @db.Uuid
966
+ vehicle_equipment_id String @db.Uuid
967
+ created_at DateTime @default(now())
968
+ updated_at DateTime @updatedAt
969
+
970
+ tender_vehicle TenderVehicle @relation(fields: [tender_vehicle_id], references: [id], onDelete: Cascade)
971
+ vehicle_equipment VehicleEquipment @relation(fields: [vehicle_equipment_id], references: [id], onDelete: Cascade)
972
+
973
+ @@index([tender_vehicle_id])
974
+ @@index([vehicle_equipment_id])
975
+ @@map("tender_vehicle_equipments")
976
+ }
977
+
978
+ model TenderChat {
979
+ id String @id @default(uuid()) @db.Uuid
980
+ tender_id String @db.Uuid
981
+ user_sends_id String @db.Uuid
982
+ user_receives_id String @db.Uuid
983
+ message String
984
+ created_at DateTime @default(now())
985
+
986
+ tender Tender @relation(fields: [tender_id], references: [id], onDelete: Cascade)
987
+ user_sends User @relation("TenderChatSender", fields: [user_sends_id], references: [id], onDelete: Cascade)
988
+ user_receives User @relation("TenderChatReceiver", fields: [user_receives_id], references: [id], onDelete: Cascade)
989
+
990
+ @@map("tender_chats")
991
+ }
992
+
993
+ model TenderApplication {
994
+ id String @id @default(uuid()) @db.Uuid
995
+ status ApplicationStatus @default(PENDING)
996
+ tender_vehicle_id String @db.Uuid
997
+ vehicle_id String @db.Uuid
998
+ user_id String @db.Uuid
999
+ updated_user_id String? @db.Uuid
1000
+ accepts_terms_conditions Boolean @default(false)
1001
+ postulated_price Float?
1002
+ currency String? @default("USD")
1003
+ created_at DateTime @default(now())
1004
+ updated_at DateTime @updatedAt
1005
+ edit_limit DateTime?
1006
+
1007
+ tender_vehicle TenderVehicle @relation(fields: [tender_vehicle_id], references: [id], onDelete: Cascade)
1008
+ vehicle Vehicle @relation(fields: [vehicle_id], references: [id], onDelete: Cascade)
1009
+ user User @relation("ApplicantUser", fields: [user_id], references: [id], onDelete: Cascade)
1010
+ updated_user User? @relation("UpdaterUser", fields: [updated_user_id], references: [id], onDelete: SetNull)
1011
+
1012
+ @@index([tender_vehicle_id])
1013
+ @@index([vehicle_id])
1014
+ @@index([user_id])
1015
+ @@index([status])
1016
+ @@map("tender_applications")
1017
+ }
1018
+
1019
+ model Group {
1020
+ id String @id @default(uuid()) @db.Uuid
1021
+ name String
1022
+ company_id String @db.Uuid
1023
+ created_at DateTime @default(now())
1024
+ updated_at DateTime @updatedAt
1025
+
1026
+ company Companies @relation(fields: [company_id], references: [id], onDelete: Cascade)
1027
+
1028
+ userGroups UserGroup[]
1029
+ tenderNotifications TenderNotification[]
1030
+
1031
+ @@map("groups")
1032
+ }
1033
+
1034
+ model UserGroup {
1035
+ id String @id @default(uuid()) @db.Uuid
1036
+ user_id String @db.Uuid
1037
+ group_id String @db.Uuid
1038
+ created_at DateTime @default(now())
1039
+ updated_at DateTime @updatedAt
1040
+
1041
+ user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
1042
+ group Group @relation(fields: [group_id], references: [id], onDelete: Cascade)
1043
+
1044
+ @@unique([user_id, group_id])
1045
+ @@index([user_id])
1046
+ @@index([group_id])
1047
+ @@map("user_groups")
1048
+ }
1049
+
1050
+ model TenderNotification {
1051
+ id String @id @default(uuid()) @db.Uuid
1052
+ tender_id String @db.Uuid
1053
+ user_id String? @db.Uuid
1054
+ group_id String? @db.Uuid
1055
+ whatsapp Boolean @default(false)
1056
+ email Boolean @default(false)
1057
+ push Boolean @default(false)
1058
+ message String
1059
+ created_at DateTime @default(now())
1060
+
1061
+ tender Tender @relation(fields: [tender_id], references: [id], onDelete: Cascade)
1062
+ user User? @relation(fields: [user_id], references: [id], onDelete: Cascade)
1063
+ group Group? @relation(fields: [group_id], references: [id], onDelete: Cascade)
1064
+
1065
+ @@index([tender_id])
1066
+ @@index([user_id])
1067
+ @@index([group_id])
1068
+ @@map("tender_notifications")
1069
+ }
1070
+
1071
+ model Location {
1072
+ id String @id @default(uuid()) @db.Uuid
1073
+ title String
1074
+ location_type LocationType
1075
+ country_code String
1076
+ zip_code String?
1077
+ geom Unsupported("geography(Point, 4326)")
1078
+ geofence Unsupported("geography(MultiPolygon, 4326)")?
1079
+
1080
+ created_at DateTime @default(now())
1081
+ updated_at DateTime @updatedAt
1082
+ companyLocations CompanyLocation[]
1083
+ tenderLocationNotifications TenderLocationNotification[]
1084
+
1085
+ @@index([title])
1086
+ @@index([location_type])
1087
+ @@index([country_code])
1088
+ @@index([zip_code])
1089
+ @@map("locations")
1090
+ }
1091
+
1092
+ model CompanyLocation {
1093
+ id String @id @default(uuid()) @db.Uuid
1094
+ company_id String @db.Uuid
1095
+ location_id String @db.Uuid
1096
+ is_active Boolean @default(true)
1097
+
1098
+ created_at DateTime @default(now())
1099
+ updated_at DateTime @updatedAt
1100
+
1101
+ company Companies @relation(fields: [company_id], references: [id], onDelete: Cascade)
1102
+ location Location @relation(fields: [location_id], references: [id], onDelete: Cascade)
1103
+
1104
+ @@unique([company_id, location_id])
1105
+ @@index([company_id])
1106
+ @@index([location_id])
1107
+ @@map("company_locations")
1108
+ }
1109
+
1110
+ model TenderLocationNotification {
1111
+ id String @id @default(uuid()) @db.Uuid
1112
+ tender_id String @db.Uuid
1113
+ location_id String @db.Uuid
1114
+
1115
+ created_at DateTime @default(now())
1116
+ updated_at DateTime @updatedAt
1117
+
1118
+ tender Tender @relation(fields: [tender_id], references: [id], onDelete: Cascade)
1119
+ location Location @relation(fields: [location_id], references: [id], onDelete: Cascade)
1120
+
1121
+ @@index([tender_id])
1122
+ @@index([location_id])
1123
+ @@map("tender_location_notifications")
1124
+ }
1125
+
1126
+ model RegularSupplier {
1127
+ id String @id @default(uuid()) @db.Uuid
1128
+ company_id String @db.Uuid
1129
+ supplier_id String @db.Uuid
1130
+ created_at DateTime @default(now())
1131
+ updated_at DateTime @updatedAt
1132
+
1133
+ company Companies @relation(fields: [company_id], references: [id], onDelete: Cascade)
1134
+ supplier Companies @relation("SupplierCompany", fields: [supplier_id], references: [id], onDelete: Cascade)
1135
+
1136
+ @@unique([company_id, supplier_id])
1137
+ @@index([company_id])
1138
+ @@index([supplier_id])
1139
+ @@map("regular_suppliers")
1140
+ }
@@ -2,4 +2,4 @@
2
2
  /* !!! This is code generated by Prisma. Do not edit directly. !!!
3
3
  /* eslint-disable */
4
4
  // biome-ignore-all lint: generated file
5
- export default import('./query_compiler_bg.wasm?module')
5
+ export default import('./query_compiler_fast_bg.wasm?module')
@@ -2,4 +2,4 @@
2
2
  /* !!! This is code generated by Prisma. Do not edit directly. !!!
3
3
  /* eslint-disable */
4
4
  // biome-ignore-all lint: generated file
5
- export default import('./query_compiler_bg.wasm')
5
+ export default import('./query_compiler_fast_bg.wasm')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delpa/mt-prisma",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "Prisma ORM package for Moving Truck microservices",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,2 @@
1
+ -- Enable PostGIS extension for geography types
2
+ CREATE EXTENSION IF NOT EXISTS postgis;