@delpa/mt-prisma 0.12.0 → 0.13.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.
@@ -1,10 +1,10 @@
1
1
  generator client {
2
- provider = "prisma-client-js"
3
- output = "../generated/client"
2
+ provider = "prisma-client-js"
3
+ output = "../generated/client"
4
4
  }
5
5
 
6
6
  datasource db {
7
- provider = "postgresql"
7
+ provider = "postgresql"
8
8
  }
9
9
 
10
10
  enum RouteStatus {
@@ -63,8 +63,6 @@ enum FuelType {
63
63
  GAS
64
64
  }
65
65
 
66
-
67
-
68
66
  enum AddressType {
69
67
  PICKUP
70
68
  DELIVERY
@@ -92,22 +90,37 @@ enum EquipmentStatus {
92
90
  MAINTENANCE
93
91
  }
94
92
 
93
+ enum GpsProviders {
94
+ BEERMAN
95
+ GETRAK
96
+ GPS_GLOBAL
97
+ GPS_CHILE
98
+ IGPS
99
+ MAVI_GPS
100
+ MICHELIN
101
+ RED_GPS
102
+ TRUCK_CONTROL
103
+ GYG
104
+ ONIX
105
+ SASCAR
106
+ }
107
+
95
108
  model Client {
96
- id String @id @default(uuid()) @db.Uuid
97
- tax_id String?
98
- name String
99
- email String?
100
- phone String?
109
+ id String @id @default(uuid()) @db.Uuid
110
+ tax_id String?
111
+ name String
112
+ email String?
113
+ phone String?
101
114
  country_code String?
102
- company_id String? @db.Uuid
103
- created_by String? @db.Uuid
104
- created_at DateTime @default(now())
105
- updated_at DateTime @updatedAt
106
-
107
- company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
108
- addresses ClientAddress[]
109
- contacts ClientContact[]
110
- orders_as_shipper Order[] @relation("shipper_client")
115
+ company_id String? @db.Uuid
116
+ created_by String? @db.Uuid
117
+ created_at DateTime @default(now())
118
+ updated_at DateTime @updatedAt
119
+
120
+ company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
121
+ addresses ClientAddress[]
122
+ contacts ClientContact[]
123
+ orders_as_shipper Order[] @relation("shipper_client")
111
124
  handling_units_as_consignee HandlingUnit[]
112
125
 
113
126
  @@index([company_id])
@@ -116,22 +129,22 @@ model Client {
116
129
  }
117
130
 
118
131
  model ClientAddress {
119
- id String @id @default(uuid()) @db.Uuid
120
- client_id String @db.Uuid
121
- title String?
122
- address_type AddressType @default(OTHER)
123
- line1 String
124
- line2 String?
125
- city String?
126
- state String?
127
- postal_code String?
128
- country String?
132
+ id String @id @default(uuid()) @db.Uuid
133
+ client_id String @db.Uuid
134
+ title String?
135
+ address_type AddressType @default(OTHER)
136
+ line1 String
137
+ line2 String?
138
+ city String?
139
+ state String?
140
+ postal_code String?
141
+ country String?
129
142
  formatted_address String?
130
- latitude Float?
131
- longitude Float?
132
- is_default Boolean @default(false)
133
- created_at DateTime @default(now())
134
- updated_at DateTime @updatedAt
143
+ latitude Float?
144
+ longitude Float?
145
+ is_default Boolean @default(false)
146
+ created_at DateTime @default(now())
147
+ updated_at DateTime @updatedAt
135
148
 
136
149
  client Client @relation(fields: [client_id], references: [id], onDelete: Cascade)
137
150
 
@@ -140,12 +153,12 @@ model ClientAddress {
140
153
  }
141
154
 
142
155
  model ClientContact {
143
- id String @id @default(uuid()) @db.Uuid
144
- client_id String @db.Uuid
145
- name String
146
- email String?
147
- phone String?
148
- is_default Boolean @default(false)
156
+ id String @id @default(uuid()) @db.Uuid
157
+ client_id String @db.Uuid
158
+ name String
159
+ email String?
160
+ phone String?
161
+ is_default Boolean @default(false)
149
162
  created_at DateTime @default(now())
150
163
  updated_at DateTime @updatedAt
151
164
 
@@ -156,103 +169,103 @@ model ClientContact {
156
169
  }
157
170
 
158
171
  model Order {
159
- id String @id @default(uuid()) @db.Uuid
160
- reference String?
161
- shipper_id String? @db.Uuid
162
- attachments Json? @default("[]")
163
- status RouteStatus @default(PENDING)
164
- created_at DateTime @default(now())
165
- updated_at DateTime @updatedAt
166
-
167
- shipper Client? @relation("shipper_client", fields: [shipper_id], references: [id], onDelete: SetNull)
172
+ id String @id @default(uuid()) @db.Uuid
173
+ reference String?
174
+ shipper_id String? @db.Uuid
175
+ attachments Json? @default("[]")
176
+ status RouteStatus @default(PENDING)
177
+ created_at DateTime @default(now())
178
+ updated_at DateTime @updatedAt
179
+
180
+ shipper Client? @relation("shipper_client", fields: [shipper_id], references: [id], onDelete: SetNull)
168
181
  handling_units HandlingUnit[]
169
- routes Route[]
182
+ routes Route[]
170
183
 
171
184
  @@index([shipper_id])
172
185
  @@map("orders")
173
186
  }
174
187
 
175
188
  model companies {
176
- id String @id @default(uuid()) @db.Uuid
177
- tax_id String? @unique
178
- name String
179
- address Json? @default("{}")
180
- contact_info Json? @default("{}")
189
+ id String @id @default(uuid()) @db.Uuid
190
+ tax_id String? @unique
191
+ name String
192
+ address Json? @default("{}")
193
+ contact_info Json? @default("{}")
181
194
  country_code String?
182
- created_at DateTime @default(now())
183
- updated_at DateTime @updatedAt
195
+ created_at DateTime @default(now())
196
+ updated_at DateTime @updatedAt
184
197
 
185
- clients Client[]
186
- vehicles Vehicle[]
198
+ clients Client[]
199
+ vehicles Vehicle[]
187
200
  user_companies UserCompany[]
188
- equipments Equipment[]
201
+ equipments Equipment[]
189
202
 
190
203
  @@map("companies")
191
204
  }
192
205
 
193
206
  model HandlingUnit {
194
- id String @id @default(uuid()) @db.Uuid
195
- order_id String @db.Uuid
196
- description String
197
- quantity Int @default(1)
198
- weight Float?
199
- weight_unit WeightUnits @default(KG)
200
- length Float?
201
- width Float?
202
- height Float?
203
- volume Float?
204
- dimension_unit DimensionUnits @default(CM)
205
- total_volume Float?
206
- total_weight Float?
207
- commodity String?
208
- delivery_contact Json? @default("{}")
209
- pickup_contact Json? @default("{}")
210
- delivery_address Json? @default("{}")
211
- pickup_address Json? @default("{}")
207
+ id String @id @default(uuid()) @db.Uuid
208
+ order_id String @db.Uuid
209
+ description String
210
+ quantity Int @default(1)
211
+ weight Float?
212
+ weight_unit WeightUnits @default(KG)
213
+ length Float?
214
+ width Float?
215
+ height Float?
216
+ volume Float?
217
+ dimension_unit DimensionUnits @default(CM)
218
+ total_volume Float?
219
+ total_weight Float?
220
+ commodity String?
221
+ delivery_contact Json? @default("{}")
222
+ pickup_contact Json? @default("{}")
223
+ delivery_address Json? @default("{}")
224
+ pickup_address Json? @default("{}")
212
225
  delivery_instructions String?
213
- pickup_instructions String?
214
- client_id String? @db.Uuid
215
- contact_notify Json? @default("[]")
216
- eta DateTime?
217
- created_at DateTime @default(now())
218
- updated_at DateTime @updatedAt
219
-
220
- order Order @relation(fields: [order_id], references: [id], onDelete: Cascade)
221
- client Client? @relation(fields: [client_id], references: [id], onDelete: SetNull)
222
- route_handling_units RouteHandlingUnit[]
226
+ pickup_instructions String?
227
+ client_id String? @db.Uuid
228
+ contact_notify Json? @default("[]")
229
+ eta DateTime?
230
+ created_at DateTime @default(now())
231
+ updated_at DateTime @updatedAt
232
+
233
+ order Order @relation(fields: [order_id], references: [id], onDelete: Cascade)
234
+ client Client? @relation(fields: [client_id], references: [id], onDelete: SetNull)
235
+ route_handling_units RouteHandlingUnit[]
223
236
  address_handling_units AddressHandlingUnit[]
224
237
 
225
238
  @@index([order_id])
226
239
  @@index([client_id])
227
-
228
240
  @@map("handling_units")
229
241
  }
230
242
 
231
243
  model User {
232
- id String @id @default(uuid()) @db.Uuid
233
- email String @unique
234
- name String
235
- password String
236
- role Roles @default(GUEST)
244
+ id String @id @default(uuid()) @db.Uuid
245
+ email String @unique
246
+ name String
247
+ password String
248
+ role Roles @default(GUEST)
237
249
  created_at DateTime @default(now())
238
250
  updated_at DateTime @updatedAt
239
251
 
240
- routes Route[]
241
- user_companies UserCompany[]
242
- sessions Session[]
252
+ routes Route[]
253
+ user_companies UserCompany[]
254
+ sessions Session[]
255
+ driverLocations DriverLocation[]
243
256
 
244
257
  @@map("users")
245
258
  }
246
259
 
247
260
  model UserCompany {
248
- id String @id @default(uuid()) @db.Uuid
249
- user_id String @db.Uuid
250
- company_id String @db.Uuid
251
- is_primary Boolean @default(false)
261
+ id String @id @default(uuid()) @db.Uuid
262
+ user_id String @db.Uuid
263
+ company_id String @db.Uuid
264
+ is_primary Boolean @default(false)
252
265
  created_at DateTime @default(now())
253
266
  updated_at DateTime @updatedAt
254
267
 
255
- user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
268
+ user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
256
269
  company companies @relation(fields: [company_id], references: [id], onDelete: Cascade)
257
270
 
258
271
  @@unique([user_id, company_id])
@@ -262,14 +275,14 @@ model UserCompany {
262
275
  }
263
276
 
264
277
  model Session {
265
- id String @id @default(uuid()) @db.Uuid
266
- user_id String @db.Uuid
267
- refresh_token String @unique
268
- device_info String?
269
- ip_address String?
270
- expires_at DateTime
271
- created_at DateTime @default(now())
272
- updated_at DateTime @updatedAt
278
+ id String @id @default(uuid()) @db.Uuid
279
+ user_id String @db.Uuid
280
+ refresh_token String @unique
281
+ device_info String?
282
+ ip_address String?
283
+ expires_at DateTime
284
+ created_at DateTime @default(now())
285
+ updated_at DateTime @updatedAt
273
286
 
274
287
  user User @relation(fields: [user_id], references: [id], onDelete: Cascade)
275
288
 
@@ -279,28 +292,28 @@ model Session {
279
292
  }
280
293
 
281
294
  model VehicleBrand {
282
- id String @id @default(uuid()) @db.Uuid
283
- name String @unique
284
- logo_url String?
285
- is_active Boolean @default(true)
295
+ id String @id @default(uuid()) @db.Uuid
296
+ name String @unique
297
+ logo_url String?
298
+ is_active Boolean @default(true)
286
299
  created_at DateTime @default(now())
287
300
  updated_at DateTime @updatedAt
288
301
 
289
- models VehicleModel[]
302
+ models VehicleModel[]
290
303
  vehicles Vehicle[]
291
304
 
292
305
  @@map("vehicle_brands")
293
306
  }
294
307
 
295
308
  model VehicleModel {
296
- id String @id @default(uuid()) @db.Uuid
297
- name String
298
- brand_id String @db.Uuid
299
- is_active Boolean @default(true)
309
+ id String @id @default(uuid()) @db.Uuid
310
+ name String
311
+ brand_id String @db.Uuid
312
+ is_active Boolean @default(true)
300
313
  created_at DateTime @default(now())
301
314
  updated_at DateTime @updatedAt
302
315
 
303
- brand VehicleBrand @relation(fields: [brand_id], references: [id], onDelete: Cascade)
316
+ brand VehicleBrand @relation(fields: [brand_id], references: [id], onDelete: Cascade)
304
317
  vehicles Vehicle[]
305
318
 
306
319
  @@unique([name, brand_id])
@@ -308,65 +321,63 @@ model VehicleModel {
308
321
  @@map("vehicle_models")
309
322
  }
310
323
 
311
-
312
324
  model Vehicle {
313
- id String @id @default(uuid()) @db.Uuid
314
- license_plate String @unique
315
- brand_id String? @db.Uuid
316
- model_id String? @db.Uuid
317
- capacity Float?
318
- year Int?
319
- fuel_type FuelType? @default(DIESEL)
320
- color VehicleColor?
321
- chassis_number String? @unique
322
- size VehicleSize? @default(MEDIUM)
323
- gps_enabled Boolean @default(false)
324
- image_url Json? @default("[]")
325
- company_id String? @db.Uuid
326
- created_at DateTime @default(now())
327
- updated_at DateTime @updatedAt
328
-
329
- brand VehicleBrand? @relation(fields: [brand_id], references: [id], onDelete: SetNull)
330
- model VehicleModel? @relation(fields: [model_id], references: [id], onDelete: SetNull)
331
- company companies? @relation(fields: [company_id], references: [id], onDelete: Cascade)
332
- routes Route[]
333
- equipments Equipment[]
325
+ id String @id @default(uuid()) @db.Uuid
326
+ license_plate String @unique
327
+ brand_id String? @db.Uuid
328
+ model_id String? @db.Uuid
329
+ capacity Float?
330
+ year Int?
331
+ fuel_type FuelType? @default(DIESEL)
332
+ color VehicleColor?
333
+ chassis_number String? @unique
334
+ size VehicleSize? @default(MEDIUM)
335
+ gps_enabled Boolean @default(false)
336
+ image_url Json? @default("[]")
337
+ company_id String? @db.Uuid
338
+ created_at DateTime @default(now())
339
+ updated_at DateTime @updatedAt
340
+
341
+ brand VehicleBrand? @relation(fields: [brand_id], references: [id], onDelete: SetNull)
342
+ model VehicleModel? @relation(fields: [model_id], references: [id], onDelete: SetNull)
343
+ company companies? @relation(fields: [company_id], references: [id], onDelete: Cascade)
344
+ routes Route[]
345
+ equipments Equipment[]
346
+ vehicleLocations VehicleLocation[]
334
347
 
335
348
  @@index([company_id])
336
349
  @@index([brand_id])
337
350
  @@index([model_id])
338
-
339
351
  @@map("vehicles")
340
352
  }
341
353
 
342
-
343
354
  model Route {
344
- id String @id @default(uuid()) @db.Uuid
345
- order_id String? @db.Uuid
346
- driver_id String? @db.Uuid
347
- vehicle_id String? @db.Uuid
348
- status RouteStatus @default(PENDING)
349
- started_at DateTime?
355
+ id String @id @default(uuid()) @db.Uuid
356
+ order_id String? @db.Uuid
357
+ driver_id String? @db.Uuid
358
+ vehicle_id String? @db.Uuid
359
+ status RouteStatus @default(PENDING)
360
+ started_at DateTime?
350
361
  completed_at DateTime?
351
-
352
- optimized_at DateTime?
353
- optimization_polyline String?
354
- optimization_distance_meters Int?
355
- optimization_duration_seconds Int?
356
- optimization_distance_saved_meters Int?
362
+
363
+ optimized_at DateTime?
364
+ optimization_polyline String?
365
+ optimization_distance_meters Int?
366
+ optimization_duration_seconds Int?
367
+ optimization_distance_saved_meters Int?
357
368
  optimization_duration_saved_seconds Int?
358
- optimization_percentage Float?
359
- optimization_waypoint_order Json?
360
-
369
+ optimization_percentage Float?
370
+ optimization_waypoint_order Json?
371
+
361
372
  created_at DateTime @default(now())
362
373
  updated_at DateTime @updatedAt
363
374
 
364
- order Order? @relation(fields: [order_id], references: [id], onDelete: Cascade)
365
- driver User? @relation(fields: [driver_id], references: [id], onDelete: SetNull)
375
+ order Order? @relation(fields: [order_id], references: [id], onDelete: Cascade)
376
+ driver User? @relation(fields: [driver_id], references: [id], onDelete: SetNull)
366
377
  vehicle Vehicle? @relation(fields: [vehicle_id], references: [id], onDelete: SetNull)
367
378
 
368
379
  route_handling_units RouteHandlingUnit[]
369
- addresses Address[]
380
+ addresses Address[]
370
381
 
371
382
  @@index([order_id])
372
383
  @@index([driver_id])
@@ -375,89 +386,84 @@ model Route {
375
386
  }
376
387
 
377
388
  model RouteHandlingUnit {
378
- id String @id @default(uuid()) @db.Uuid
379
- route_id String @db.Uuid
380
- handling_unit_id String @db.Uuid
381
- created_at DateTime @default(now())
382
- updated_at DateTime @updatedAt
389
+ id String @id @default(uuid()) @db.Uuid
390
+ route_id String @db.Uuid
391
+ handling_unit_id String @db.Uuid
392
+ created_at DateTime @default(now())
393
+ updated_at DateTime @updatedAt
383
394
 
384
- route Route @relation(fields: [route_id], references: [id], onDelete: Cascade)
395
+ route Route @relation(fields: [route_id], references: [id], onDelete: Cascade)
385
396
  handling_unit HandlingUnit @relation(fields: [handling_unit_id], references: [id], onDelete: Cascade)
386
397
 
387
398
  @@index([route_id])
388
399
  @@index([handling_unit_id])
389
-
390
400
  @@map("route_handling_units")
391
401
  }
392
402
 
393
-
394
-
395
-
396
403
  model Address {
397
- id String @id @default(uuid()) @db.Uuid
398
- address_type AddressType @default(OTHER)
399
- sequence Int?
400
- title String?
401
- address_line1 String
402
- address_line2 String?
403
- apartment String?
404
- city String?
405
- state String?
406
- postal_code String?
407
- country String
408
- latitude Float?
409
- longitude Float?
410
- google_address Json? @default("{}")
411
- route_id String? @db.Uuid
412
- created_at DateTime @default(now())
413
- updated_at DateTime @updatedAt
414
-
415
- route Route? @relation(fields: [route_id], references: [id], onDelete: Cascade)
404
+ id String @id @default(uuid()) @db.Uuid
405
+ address_type AddressType @default(OTHER)
406
+ sequence Int?
407
+ title String?
408
+ address_line1 String
409
+ address_line2 String?
410
+ apartment String?
411
+ city String?
412
+ state String?
413
+ postal_code String?
414
+ country String
415
+ latitude Float?
416
+ longitude Float?
417
+ google_address Json? @default("{}")
418
+ route_id String? @db.Uuid
419
+ created_at DateTime @default(now())
420
+ updated_at DateTime @updatedAt
421
+
422
+ route Route? @relation(fields: [route_id], references: [id], onDelete: Cascade)
416
423
  address_handling_units AddressHandlingUnit[]
417
424
 
418
425
  @@index([route_id])
419
426
  @@map("addresses")
420
- }
427
+ }
421
428
 
422
429
  model AddressHandlingUnit {
423
- id String @id @default(uuid()) @db.Uuid
424
- address_id String @db.Uuid
425
- handling_unit_id String @db.Uuid
426
- created_at DateTime @default(now())
427
- updated_at DateTime @updatedAt
430
+ id String @id @default(uuid()) @db.Uuid
431
+ address_id String @db.Uuid
432
+ handling_unit_id String @db.Uuid
433
+ created_at DateTime @default(now())
434
+ updated_at DateTime @updatedAt
428
435
 
429
- address Address @relation(fields: [address_id], references: [id], onDelete: Cascade)
436
+ address Address @relation(fields: [address_id], references: [id], onDelete: Cascade)
430
437
  handling_unit HandlingUnit @relation(fields: [handling_unit_id], references: [id], onDelete: Cascade)
431
438
 
432
439
  @@index([address_id])
433
440
  @@index([handling_unit_id])
434
-
435
441
  @@map("address_handling_units")
436
442
  }
437
443
 
438
444
  model EquipmentBrand {
439
- id String @id @default(uuid()) @db.Uuid
440
- name String @unique
441
- logo_url String?
442
- is_active Boolean @default(true)
445
+ id String @id @default(uuid()) @db.Uuid
446
+ name String @unique
447
+ logo_url String?
448
+ is_active Boolean @default(true)
443
449
  created_at DateTime @default(now())
444
450
  updated_at DateTime @updatedAt
445
451
 
446
- models EquipmentModel[]
452
+ models EquipmentModel[]
447
453
  equipments Equipment[]
448
454
 
449
455
  @@map("equipment_brands")
450
456
  }
451
457
 
452
458
  model EquipmentModel {
453
- id String @id @default(uuid()) @db.Uuid
454
- name String
455
- brand_id String @db.Uuid
456
- is_active Boolean @default(true)
459
+ id String @id @default(uuid()) @db.Uuid
460
+ name String
461
+ brand_id String @db.Uuid
462
+ is_active Boolean @default(true)
457
463
  created_at DateTime @default(now())
458
464
  updated_at DateTime @updatedAt
459
465
 
460
- brand EquipmentBrand @relation(fields: [brand_id], references: [id], onDelete: Cascade)
466
+ brand EquipmentBrand @relation(fields: [brand_id], references: [id], onDelete: Cascade)
461
467
  equipment Equipment[]
462
468
 
463
469
  @@unique([name, brand_id])
@@ -465,35 +471,35 @@ model EquipmentModel {
465
471
  @@map("equipment_models")
466
472
  }
467
473
 
468
-
469
474
  model Equipment {
470
- id String @id @default(uuid()) @db.Uuid
471
- title String
472
- plate String? @unique
473
- year Int?
474
- color VehicleColor?
475
- brand_id String? @db.Uuid
476
- model_id String? @db.Uuid
477
- axles Int?
478
- chassis_number String? @unique
479
- weight Float?
480
- weight_unit WeightUnits @default(KG)
481
- length Float?
482
- width Float?
483
- height Float?
484
- dimension_unit DimensionUnits @default(CM)
485
- pallets Int?
486
- load_capacity Float?
487
- status EquipmentStatus @default(ACTIVE)
488
- company_id String? @db.Uuid
489
- vehicle_id String? @db.Uuid
490
- created_at DateTime @default(now())
491
- updated_at DateTime @updatedAt
492
-
493
- brand EquipmentBrand? @relation(fields: [brand_id], references: [id], onDelete: SetNull)
494
- model EquipmentModel? @relation(fields: [model_id], references: [id], onDelete: SetNull)
495
- company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
496
- vehicle Vehicle? @relation(fields: [vehicle_id], references: [id], onDelete: SetNull)
475
+ id String @id @default(uuid()) @db.Uuid
476
+ title String
477
+ plate String? @unique
478
+ year Int?
479
+ color VehicleColor?
480
+ brand_id String? @db.Uuid
481
+ model_id String? @db.Uuid
482
+ axles Int?
483
+ chassis_number String? @unique
484
+ weight Float?
485
+ weight_unit WeightUnits @default(KG)
486
+ length Float?
487
+ width Float?
488
+ height Float?
489
+ dimension_unit DimensionUnits @default(CM)
490
+ pallets Int?
491
+ load_capacity Float?
492
+ status EquipmentStatus @default(ACTIVE)
493
+ company_id String? @db.Uuid
494
+ vehicle_id String? @db.Uuid
495
+ created_at DateTime @default(now())
496
+ updated_at DateTime @updatedAt
497
+
498
+ brand EquipmentBrand? @relation(fields: [brand_id], references: [id], onDelete: SetNull)
499
+ model EquipmentModel? @relation(fields: [model_id], references: [id], onDelete: SetNull)
500
+ company companies? @relation(fields: [company_id], references: [id], onDelete: SetNull)
501
+ vehicle Vehicle? @relation(fields: [vehicle_id], references: [id], onDelete: SetNull)
502
+ vehicleLocations VehicleLocation[]
497
503
 
498
504
  @@index([company_id])
499
505
  @@index([brand_id])
@@ -501,4 +507,49 @@ model Equipment {
501
507
  @@index([vehicle_id])
502
508
  @@index([plate])
503
509
  @@map("equipments")
504
- }
510
+ }
511
+
512
+ model VehicleLocation {
513
+ id String @id @default(uuid()) @db.Uuid
514
+ vehicle_id String? @db.Uuid
515
+ equiment_id String? @db.Uuid
516
+ provider GpsProviders?
517
+ plate String?
518
+ temperature Float?
519
+ voltage String?
520
+ odometer String?
521
+ batery_level String?
522
+ stopped_time String?
523
+ ignition_status Boolean?
524
+ current_speed Float?
525
+ latitude Float?
526
+ longitude Float?
527
+ metadata Json? @default("{}")
528
+ created_at DateTime @default(now())
529
+ updated_at DateTime @updatedAt
530
+
531
+ vehicle Vehicle? @relation(fields: [vehicle_id], references: [id], onDelete: SetNull)
532
+ equipment Equipment? @relation(fields: [equiment_id], references: [id], onDelete: SetNull)
533
+
534
+ @@index([vehicle_id])
535
+ @@index([equiment_id])
536
+ @@index([provider])
537
+ @@index([plate])
538
+ @@index([created_at])
539
+ @@map("vehicle_locations")
540
+ }
541
+
542
+ model DriverLocation {
543
+ id String @id @default(uuid()) @db.Uuid
544
+ driver_id String @db.Uuid
545
+ latitude Float
546
+ longitude Float
547
+ created_at DateTime @default(now())
548
+ updated_at DateTime @updatedAt
549
+
550
+ driver User @relation(fields: [driver_id], references: [id], onDelete: Cascade)
551
+
552
+ @@index([driver_id])
553
+ @@index([created_at])
554
+ @@map("driver_locations")
555
+ }