@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.
- package/dist/generated/client/edge.js +425 -23
- package/dist/generated/client/index-browser.js +430 -29
- package/dist/generated/client/index.d.ts +71466 -28468
- package/dist/generated/client/index.js +426 -24
- package/dist/generated/client/package.json +3 -3
- package/dist/generated/client/query_compiler_fast_bg.js +2 -0
- package/dist/generated/client/query_compiler_fast_bg.wasm +0 -0
- package/dist/generated/client/query_compiler_fast_bg.wasm-base64.js +2 -0
- package/dist/generated/client/runtime/client.d.ts +4 -17
- package/dist/generated/client/runtime/client.js +20 -20
- package/dist/generated/client/runtime/wasm-compiler-edge.js +18 -18
- package/dist/generated/client/schema.prisma +648 -66
- package/dist/generated/client/wasm-edge-light-loader.mjs +1 -1
- package/dist/generated/client/wasm-worker-loader.mjs +1 -1
- package/dist/generated/generated/client/edge.js +225 -24
- package/dist/generated/generated/client/index-browser.js +218 -18
- package/dist/generated/generated/client/index.d.ts +63096 -34291
- package/dist/generated/generated/client/index.js +226 -25
- package/dist/generated/generated/client/package.json +3 -3
- package/dist/generated/generated/client/query_compiler_fast_bg.js +2 -0
- package/dist/generated/generated/client/query_compiler_fast_bg.wasm +0 -0
- package/dist/generated/generated/client/query_compiler_fast_bg.wasm-base64.js +2 -0
- package/dist/generated/generated/client/runtime/client.d.ts +4 -17
- package/dist/generated/generated/client/runtime/client.js +20 -20
- package/dist/generated/generated/client/runtime/wasm-compiler-edge.js +18 -18
- package/dist/generated/generated/client/schema.prisma +398 -73
- package/dist/generated/generated/client/wasm-edge-light-loader.mjs +1 -1
- package/dist/generated/generated/client/wasm-worker-loader.mjs +1 -1
- package/generated/client/edge.js +225 -24
- package/generated/client/index-browser.js +218 -18
- package/generated/client/index.d.ts +63096 -34291
- package/generated/client/index.js +226 -25
- package/generated/client/package.json +3 -3
- package/generated/client/query_compiler_fast_bg.js +2 -0
- package/generated/client/query_compiler_fast_bg.wasm +0 -0
- package/generated/client/query_compiler_fast_bg.wasm-base64.js +2 -0
- package/generated/client/runtime/client.d.ts +4 -17
- package/generated/client/runtime/client.js +20 -20
- package/generated/client/runtime/wasm-compiler-edge.js +18 -18
- package/generated/client/schema.prisma +398 -73
- package/generated/client/wasm-edge-light-loader.mjs +1 -1
- package/generated/client/wasm-worker-loader.mjs +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20260127193502_enable_postgis/migration.sql +2 -0
- package/prisma/migrations/20260127193503_add_schema_tenders/migration.sql +410 -0
- package/prisma/migrations/20260202133514_agrega_product_in_handling_units/migration.sql +8 -0
- package/prisma/migrations/20260202150634_simplify_handling_unit_remove_redundant_fields/migration.sql +29 -0
- package/prisma/migrations/20260202162217_fix_reference_for_products/migration.sql +22 -0
- package/prisma/migrations/20260202163057_fix_vechicle_equipment_name/migration.sql +25 -0
- package/prisma/schema.prisma +495 -168
package/prisma/schema.prisma
CHANGED
|
@@ -153,28 +153,68 @@ enum GpsProviders {
|
|
|
153
153
|
ONIX
|
|
154
154
|
SASCAR
|
|
155
155
|
}
|
|
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
|
+
|
|
156
194
|
model Product {
|
|
157
|
-
id
|
|
158
|
-
|
|
159
|
-
description
|
|
160
|
-
sku
|
|
161
|
-
quantity
|
|
162
|
-
packaging_type PackagingType
|
|
163
|
-
category
|
|
164
|
-
subcategory
|
|
165
|
-
dimension_unit DimensionUnits
|
|
166
|
-
length
|
|
167
|
-
width
|
|
168
|
-
height
|
|
169
|
-
weight_unit
|
|
170
|
-
weight
|
|
171
|
-
is_active
|
|
172
|
-
created_at
|
|
173
|
-
updated_at
|
|
195
|
+
id String @id @default(uuid()) @db.Uuid
|
|
196
|
+
company_id String @db.Uuid
|
|
197
|
+
description String
|
|
198
|
+
sku String @unique
|
|
199
|
+
quantity Int @default(0)
|
|
200
|
+
packaging_type PackagingType @default(BOX)
|
|
201
|
+
category ProductCategory @default(OTHER)
|
|
202
|
+
subcategory ProductSubcategory @default(OTHER)
|
|
203
|
+
dimension_unit DimensionUnits @default(CM)
|
|
204
|
+
length Float?
|
|
205
|
+
width Float?
|
|
206
|
+
height Float?
|
|
207
|
+
weight_unit WeightUnits @default(KG)
|
|
208
|
+
weight Float?
|
|
209
|
+
is_active Boolean @default(true)
|
|
210
|
+
created_at DateTime @default(now())
|
|
211
|
+
updated_at DateTime @updatedAt
|
|
174
212
|
|
|
175
|
-
|
|
213
|
+
handlingUnits HandlingUnit[]
|
|
176
214
|
|
|
177
|
-
|
|
215
|
+
company Companies @relation(fields: [company_id], references: [id], onDelete: Cascade)
|
|
216
|
+
|
|
217
|
+
@@index([company_id])
|
|
178
218
|
@@index([sku])
|
|
179
219
|
@@index([category])
|
|
180
220
|
@@map("products")
|
|
@@ -192,12 +232,11 @@ model Client {
|
|
|
192
232
|
created_at DateTime @default(now())
|
|
193
233
|
updated_at DateTime @updatedAt
|
|
194
234
|
|
|
195
|
-
company
|
|
235
|
+
company Companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
|
|
196
236
|
addresses ClientAddress[]
|
|
197
237
|
contacts ClientContact[]
|
|
198
238
|
orders_as_shipper Order[] @relation("shipper_client")
|
|
199
239
|
handling_units_as_consignee HandlingUnit[]
|
|
200
|
-
products Product[]
|
|
201
240
|
|
|
202
241
|
@@index([company_id])
|
|
203
242
|
@@index([created_by])
|
|
@@ -256,85 +295,101 @@ model Order {
|
|
|
256
295
|
shipper Client? @relation("shipper_client", fields: [shipper_id], references: [id], onDelete: SetNull)
|
|
257
296
|
handling_units HandlingUnit[]
|
|
258
297
|
routes Route[]
|
|
298
|
+
tenders Tender[]
|
|
259
299
|
|
|
260
300
|
@@index([shipper_id])
|
|
261
301
|
@@map("orders")
|
|
262
302
|
}
|
|
263
303
|
|
|
264
|
-
model
|
|
304
|
+
model Companies {
|
|
265
305
|
id String @id @default(uuid()) @db.Uuid
|
|
266
306
|
tax_id String? @unique
|
|
267
307
|
name String
|
|
268
308
|
address Json? @default("{}")
|
|
269
309
|
contact_info Json? @default("{}")
|
|
270
310
|
country_code String?
|
|
311
|
+
is_validated Boolean? @default(false)
|
|
312
|
+
documents Json? @default("[]")
|
|
271
313
|
created_at DateTime @default(now())
|
|
272
314
|
updated_at DateTime @updatedAt
|
|
273
315
|
|
|
274
|
-
clients
|
|
275
|
-
vehicles
|
|
276
|
-
user_companies
|
|
277
|
-
equipments
|
|
278
|
-
form_templates
|
|
279
|
-
form_responses
|
|
280
|
-
forms
|
|
281
|
-
|
|
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])
|
|
282
334
|
@@map("companies")
|
|
283
335
|
}
|
|
284
336
|
|
|
285
337
|
model HandlingUnit {
|
|
286
|
-
id String
|
|
287
|
-
order_id String
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
width Float?
|
|
294
|
-
height Float?
|
|
295
|
-
volume Float?
|
|
296
|
-
dimension_unit DimensionUnits @default(CM)
|
|
297
|
-
total_volume Float?
|
|
298
|
-
total_weight Float?
|
|
299
|
-
commodity String?
|
|
300
|
-
delivery_contact Json? @default("{}")
|
|
301
|
-
pickup_contact Json? @default("{}")
|
|
302
|
-
delivery_address Json? @default("{}")
|
|
303
|
-
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("{}")
|
|
304
345
|
delivery_instructions String?
|
|
305
346
|
pickup_instructions String?
|
|
306
|
-
client_id String?
|
|
307
|
-
contact_notify Json?
|
|
347
|
+
client_id String? @db.Uuid
|
|
348
|
+
contact_notify Json? @default("[]")
|
|
308
349
|
eta DateTime?
|
|
309
|
-
|
|
310
|
-
|
|
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)
|
|
311
358
|
|
|
312
|
-
order Order @relation(fields: [order_id], references: [id], onDelete: Cascade)
|
|
313
|
-
client Client? @relation(fields: [client_id], references: [id], onDelete: SetNull)
|
|
314
359
|
route_handling_units RouteHandlingUnit[]
|
|
315
360
|
address_handling_units AddressHandlingUnit[]
|
|
316
361
|
|
|
317
362
|
@@index([order_id])
|
|
318
363
|
@@index([client_id])
|
|
364
|
+
@@index([product_id])
|
|
319
365
|
@@map("handling_units")
|
|
320
366
|
}
|
|
321
367
|
|
|
322
368
|
model User {
|
|
323
|
-
id
|
|
324
|
-
email
|
|
325
|
-
name
|
|
326
|
-
password
|
|
327
|
-
role
|
|
328
|
-
|
|
329
|
-
|
|
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
|
|
330
378
|
|
|
331
|
-
routes
|
|
332
|
-
user_companies
|
|
333
|
-
sessions
|
|
334
|
-
driverLocations
|
|
379
|
+
routes Route[]
|
|
380
|
+
user_companies UserCompany[]
|
|
381
|
+
sessions Session[]
|
|
382
|
+
driverLocations DriverLocation[]
|
|
335
383
|
form_templates_created FormTemplate[]
|
|
336
|
-
form_responses
|
|
337
|
-
forms_created
|
|
384
|
+
form_responses FormResponse[]
|
|
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[]
|
|
338
393
|
|
|
339
394
|
@@map("users")
|
|
340
395
|
}
|
|
@@ -348,7 +403,7 @@ model UserCompany {
|
|
|
348
403
|
updated_at DateTime @updatedAt
|
|
349
404
|
|
|
350
405
|
user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
|
|
351
|
-
company
|
|
406
|
+
company Companies @relation(fields: [company_id], references: [id], onDelete: Cascade)
|
|
352
407
|
|
|
353
408
|
@@unique([user_id, company_id])
|
|
354
409
|
@@index([user_id])
|
|
@@ -404,28 +459,33 @@ model VehicleModel {
|
|
|
404
459
|
}
|
|
405
460
|
|
|
406
461
|
model Vehicle {
|
|
407
|
-
id
|
|
408
|
-
license_plate
|
|
409
|
-
brand_id
|
|
410
|
-
model_id
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
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[]
|
|
429
489
|
|
|
430
490
|
@@index([company_id])
|
|
431
491
|
@@index([brand_id])
|
|
@@ -574,12 +634,14 @@ model Equipment {
|
|
|
574
634
|
status EquipmentStatus @default(ACTIVE)
|
|
575
635
|
company_id String? @db.Uuid
|
|
576
636
|
vehicle_id String? @db.Uuid
|
|
637
|
+
is_validated Boolean? @default(false)
|
|
638
|
+
documents Json? @default("[]")
|
|
577
639
|
created_at DateTime @default(now())
|
|
578
640
|
updated_at DateTime @updatedAt
|
|
579
641
|
|
|
580
642
|
brand EquipmentBrand? @relation(fields: [brand_id], references: [id], onDelete: SetNull)
|
|
581
643
|
model EquipmentModel? @relation(fields: [model_id], references: [id], onDelete: SetNull)
|
|
582
|
-
company
|
|
644
|
+
company Companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
|
|
583
645
|
vehicle Vehicle? @relation(fields: [vehicle_id], references: [id], onDelete: SetNull)
|
|
584
646
|
vehicleLocations VehicleLocation[]
|
|
585
647
|
|
|
@@ -635,6 +697,7 @@ model DriverLocation {
|
|
|
635
697
|
@@index([created_at])
|
|
636
698
|
@@map("driver_locations")
|
|
637
699
|
}
|
|
700
|
+
|
|
638
701
|
// ============================================
|
|
639
702
|
// FORMS - Form Templates, Fields and Responses
|
|
640
703
|
// ============================================
|
|
@@ -666,23 +729,23 @@ enum FormResponseStatus {
|
|
|
666
729
|
}
|
|
667
730
|
|
|
668
731
|
model FormTemplate {
|
|
669
|
-
id
|
|
670
|
-
name
|
|
732
|
+
id String @id @default(uuid()) @db.Uuid
|
|
733
|
+
name String
|
|
671
734
|
description String?
|
|
672
|
-
company_id
|
|
673
|
-
is_active
|
|
674
|
-
is_global
|
|
675
|
-
category
|
|
676
|
-
version
|
|
677
|
-
created_by
|
|
678
|
-
created_at
|
|
679
|
-
updated_at
|
|
680
|
-
|
|
681
|
-
company
|
|
682
|
-
created_by_user User?
|
|
683
|
-
fields
|
|
684
|
-
responses
|
|
685
|
-
forms
|
|
735
|
+
company_id String? @db.Uuid
|
|
736
|
+
is_active Boolean @default(true)
|
|
737
|
+
is_global Boolean @default(false)
|
|
738
|
+
category String?
|
|
739
|
+
version Int @default(1)
|
|
740
|
+
created_by String? @db.Uuid
|
|
741
|
+
created_at DateTime @default(now())
|
|
742
|
+
updated_at DateTime @updatedAt
|
|
743
|
+
|
|
744
|
+
company Companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
|
|
745
|
+
created_by_user User? @relation(fields: [created_by], references: [id], onDelete: SetNull)
|
|
746
|
+
fields TemplateField[]
|
|
747
|
+
responses FormResponse[]
|
|
748
|
+
forms Form[]
|
|
686
749
|
|
|
687
750
|
@@index([company_id])
|
|
688
751
|
@@index([is_global])
|
|
@@ -692,20 +755,20 @@ model FormTemplate {
|
|
|
692
755
|
}
|
|
693
756
|
|
|
694
757
|
model TemplateField {
|
|
695
|
-
id
|
|
696
|
-
template_id
|
|
697
|
-
label
|
|
698
|
-
field_type
|
|
699
|
-
placeholder
|
|
700
|
-
help_text
|
|
701
|
-
is_required
|
|
702
|
-
order
|
|
703
|
-
options
|
|
704
|
-
validations
|
|
705
|
-
default_value
|
|
758
|
+
id String @id @default(uuid()) @db.Uuid
|
|
759
|
+
template_id String @db.Uuid
|
|
760
|
+
label String
|
|
761
|
+
field_type FieldType
|
|
762
|
+
placeholder String?
|
|
763
|
+
help_text String?
|
|
764
|
+
is_required Boolean @default(false)
|
|
765
|
+
order Int @default(0)
|
|
766
|
+
options Json?
|
|
767
|
+
validations Json?
|
|
768
|
+
default_value String?
|
|
706
769
|
conditional_logic Json?
|
|
707
|
-
created_at
|
|
708
|
-
updated_at
|
|
770
|
+
created_at DateTime @default(now())
|
|
771
|
+
updated_at DateTime @updatedAt
|
|
709
772
|
|
|
710
773
|
template FormTemplate @relation(fields: [template_id], references: [id], onDelete: Cascade)
|
|
711
774
|
|
|
@@ -714,23 +777,23 @@ model TemplateField {
|
|
|
714
777
|
}
|
|
715
778
|
|
|
716
779
|
model FormResponse {
|
|
717
|
-
id
|
|
718
|
-
template_id
|
|
719
|
-
form_id
|
|
720
|
-
entity_type
|
|
721
|
-
entity_id
|
|
722
|
-
company_id
|
|
723
|
-
respondent_id String?
|
|
724
|
-
responses
|
|
725
|
-
status
|
|
726
|
-
submitted_at
|
|
727
|
-
created_at
|
|
728
|
-
updated_at
|
|
729
|
-
|
|
730
|
-
template
|
|
731
|
-
form
|
|
732
|
-
company
|
|
733
|
-
respondent User?
|
|
780
|
+
id String @id @default(uuid()) @db.Uuid
|
|
781
|
+
template_id String? @db.Uuid
|
|
782
|
+
form_id String? @db.Uuid
|
|
783
|
+
entity_type String
|
|
784
|
+
entity_id String @db.Uuid
|
|
785
|
+
company_id String? @db.Uuid
|
|
786
|
+
respondent_id String? @db.Uuid
|
|
787
|
+
responses Json
|
|
788
|
+
status FormResponseStatus @default(DRAFT)
|
|
789
|
+
submitted_at DateTime?
|
|
790
|
+
created_at DateTime @default(now())
|
|
791
|
+
updated_at DateTime @updatedAt
|
|
792
|
+
|
|
793
|
+
template FormTemplate? @relation(fields: [template_id], references: [id])
|
|
794
|
+
form Form? @relation(fields: [form_id], references: [id])
|
|
795
|
+
company Companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
|
|
796
|
+
respondent User? @relation(fields: [respondent_id], references: [id], onDelete: SetNull)
|
|
734
797
|
|
|
735
798
|
@@index([template_id])
|
|
736
799
|
@@index([form_id])
|
|
@@ -761,25 +824,25 @@ enum FormStatus {
|
|
|
761
824
|
}
|
|
762
825
|
|
|
763
826
|
model Form {
|
|
764
|
-
id
|
|
765
|
-
name
|
|
827
|
+
id String @id @default(uuid()) @db.Uuid
|
|
828
|
+
name String
|
|
766
829
|
description String?
|
|
767
|
-
template_id String?
|
|
768
|
-
company_id
|
|
830
|
+
template_id String? @db.Uuid
|
|
831
|
+
company_id String? @db.Uuid
|
|
769
832
|
target_type FormTargetType
|
|
770
|
-
target_ids
|
|
771
|
-
is_required Boolean
|
|
772
|
-
due_date
|
|
773
|
-
status
|
|
774
|
-
created_by
|
|
775
|
-
created_at
|
|
776
|
-
updated_at
|
|
777
|
-
|
|
778
|
-
template
|
|
779
|
-
company
|
|
780
|
-
created_by_user User?
|
|
781
|
-
fields
|
|
782
|
-
responses
|
|
833
|
+
target_ids String[] @db.Uuid
|
|
834
|
+
is_required Boolean @default(false)
|
|
835
|
+
due_date DateTime?
|
|
836
|
+
status FormStatus @default(ACTIVE)
|
|
837
|
+
created_by String? @db.Uuid
|
|
838
|
+
created_at DateTime @default(now())
|
|
839
|
+
updated_at DateTime @updatedAt
|
|
840
|
+
|
|
841
|
+
template FormTemplate? @relation(fields: [template_id], references: [id], onDelete: SetNull)
|
|
842
|
+
company Companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
|
|
843
|
+
created_by_user User? @relation("FormCreator", fields: [created_by], references: [id], onDelete: SetNull)
|
|
844
|
+
fields FormField[]
|
|
845
|
+
responses FormResponse[]
|
|
783
846
|
|
|
784
847
|
@@index([company_id])
|
|
785
848
|
@@index([template_id])
|
|
@@ -790,24 +853,288 @@ model Form {
|
|
|
790
853
|
}
|
|
791
854
|
|
|
792
855
|
model FormField {
|
|
793
|
-
id
|
|
794
|
-
form_id
|
|
795
|
-
source_field_id
|
|
796
|
-
label
|
|
797
|
-
field_type
|
|
798
|
-
placeholder
|
|
799
|
-
help_text
|
|
800
|
-
is_required
|
|
801
|
-
order
|
|
802
|
-
options
|
|
803
|
-
validations
|
|
804
|
-
default_value
|
|
856
|
+
id String @id @default(uuid()) @db.Uuid
|
|
857
|
+
form_id String @db.Uuid
|
|
858
|
+
source_field_id String? @db.Uuid
|
|
859
|
+
label String
|
|
860
|
+
field_type FieldType
|
|
861
|
+
placeholder String?
|
|
862
|
+
help_text String?
|
|
863
|
+
is_required Boolean @default(false)
|
|
864
|
+
order Int @default(0)
|
|
865
|
+
options Json?
|
|
866
|
+
validations Json?
|
|
867
|
+
default_value String?
|
|
805
868
|
conditional_logic Json?
|
|
806
|
-
created_at
|
|
807
|
-
updated_at
|
|
869
|
+
created_at DateTime @default(now())
|
|
870
|
+
updated_at DateTime @updatedAt
|
|
808
871
|
|
|
809
872
|
form Form @relation(fields: [form_id], references: [id], onDelete: Cascade)
|
|
810
873
|
|
|
811
874
|
@@index([form_id])
|
|
812
875
|
@@map("form_fields")
|
|
813
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
|
+
}
|