@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.
- package/dist/generated/client/edge.js +124 -19
- package/dist/generated/client/index-browser.js +120 -15
- package/dist/generated/client/index.d.ts +12816 -3105
- package/dist/generated/client/index.js +124 -19
- package/dist/generated/client/package.json +1 -1
- package/dist/generated/client/schema.prisma +181 -39
- package/dist/generated/generated/client/edge.js +49 -3
- package/dist/generated/generated/client/index-browser.js +47 -1
- package/dist/generated/generated/client/index.d.ts +4600 -256
- package/dist/generated/generated/client/index.js +49 -3
- package/dist/generated/generated/client/package.json +1 -1
- package/dist/generated/generated/client/schema.prisma +75 -12
- package/generated/client/edge.js +49 -3
- package/generated/client/index-browser.js +47 -1
- package/generated/client/index.d.ts +4600 -256
- package/generated/client/index.js +49 -3
- package/generated/client/package.json +1 -1
- package/generated/client/schema.prisma +75 -12
- package/package.json +1 -1
- package/prisma/migrations/20260122181100_add_vehicle_locations/migration.sql +67 -0
- package/prisma/schema.prisma +289 -238
package/prisma/schema.prisma
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
generator client {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
provider = "prisma-client-js"
|
|
3
|
+
output = "../generated/client"
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
datasource db {
|
|
7
|
-
|
|
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
|
|
97
|
-
tax_id
|
|
98
|
-
name
|
|
99
|
-
email
|
|
100
|
-
phone
|
|
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
|
|
103
|
-
created_by
|
|
104
|
-
created_at
|
|
105
|
-
updated_at
|
|
106
|
-
|
|
107
|
-
company
|
|
108
|
-
addresses
|
|
109
|
-
contacts
|
|
110
|
-
orders_as_shipper
|
|
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
|
|
120
|
-
client_id
|
|
121
|
-
title
|
|
122
|
-
address_type
|
|
123
|
-
line1
|
|
124
|
-
line2
|
|
125
|
-
city
|
|
126
|
-
state
|
|
127
|
-
postal_code
|
|
128
|
-
country
|
|
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
|
|
131
|
-
longitude
|
|
132
|
-
is_default
|
|
133
|
-
created_at
|
|
134
|
-
updated_at
|
|
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
|
|
144
|
-
client_id
|
|
145
|
-
name
|
|
146
|
-
email
|
|
147
|
-
phone
|
|
148
|
-
is_default Boolean
|
|
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
|
|
160
|
-
reference
|
|
161
|
-
shipper_id
|
|
162
|
-
attachments Json?
|
|
163
|
-
status
|
|
164
|
-
created_at
|
|
165
|
-
updated_at
|
|
166
|
-
|
|
167
|
-
shipper
|
|
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
|
|
182
|
+
routes Route[]
|
|
170
183
|
|
|
171
184
|
@@index([shipper_id])
|
|
172
185
|
@@map("orders")
|
|
173
186
|
}
|
|
174
187
|
|
|
175
188
|
model companies {
|
|
176
|
-
id
|
|
177
|
-
tax_id
|
|
178
|
-
name
|
|
179
|
-
address
|
|
180
|
-
contact_info Json?
|
|
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
|
|
183
|
-
updated_at
|
|
195
|
+
created_at DateTime @default(now())
|
|
196
|
+
updated_at DateTime @updatedAt
|
|
184
197
|
|
|
185
|
-
clients
|
|
186
|
-
vehicles
|
|
198
|
+
clients Client[]
|
|
199
|
+
vehicles Vehicle[]
|
|
187
200
|
user_companies UserCompany[]
|
|
188
|
-
equipments
|
|
201
|
+
equipments Equipment[]
|
|
189
202
|
|
|
190
203
|
@@map("companies")
|
|
191
204
|
}
|
|
192
205
|
|
|
193
206
|
model HandlingUnit {
|
|
194
|
-
id
|
|
195
|
-
order_id
|
|
196
|
-
description
|
|
197
|
-
quantity
|
|
198
|
-
weight
|
|
199
|
-
weight_unit
|
|
200
|
-
length
|
|
201
|
-
width
|
|
202
|
-
height
|
|
203
|
-
volume
|
|
204
|
-
dimension_unit
|
|
205
|
-
total_volume
|
|
206
|
-
total_weight
|
|
207
|
-
commodity
|
|
208
|
-
delivery_contact
|
|
209
|
-
pickup_contact
|
|
210
|
-
delivery_address
|
|
211
|
-
pickup_address
|
|
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
|
|
214
|
-
client_id
|
|
215
|
-
contact_notify
|
|
216
|
-
eta
|
|
217
|
-
created_at
|
|
218
|
-
updated_at
|
|
219
|
-
|
|
220
|
-
order
|
|
221
|
-
client
|
|
222
|
-
route_handling_units
|
|
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
|
|
233
|
-
email
|
|
234
|
-
name
|
|
235
|
-
password
|
|
236
|
-
role
|
|
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
|
|
241
|
-
user_companies
|
|
242
|
-
sessions
|
|
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
|
|
249
|
-
user_id
|
|
250
|
-
company_id String
|
|
251
|
-
is_primary Boolean
|
|
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
|
|
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
|
|
266
|
-
user_id
|
|
267
|
-
refresh_token String
|
|
268
|
-
device_info
|
|
269
|
-
ip_address
|
|
270
|
-
expires_at
|
|
271
|
-
created_at
|
|
272
|
-
updated_at
|
|
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
|
|
283
|
-
name
|
|
284
|
-
logo_url
|
|
285
|
-
is_active
|
|
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
|
|
302
|
+
models VehicleModel[]
|
|
290
303
|
vehicles Vehicle[]
|
|
291
304
|
|
|
292
305
|
@@map("vehicle_brands")
|
|
293
306
|
}
|
|
294
307
|
|
|
295
308
|
model VehicleModel {
|
|
296
|
-
id
|
|
297
|
-
name
|
|
298
|
-
brand_id
|
|
299
|
-
is_active
|
|
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
|
|
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
|
|
314
|
-
license_plate
|
|
315
|
-
brand_id
|
|
316
|
-
model_id
|
|
317
|
-
capacity
|
|
318
|
-
year
|
|
319
|
-
fuel_type
|
|
320
|
-
color
|
|
321
|
-
chassis_number String?
|
|
322
|
-
size
|
|
323
|
-
gps_enabled
|
|
324
|
-
image_url
|
|
325
|
-
company_id
|
|
326
|
-
created_at
|
|
327
|
-
updated_at
|
|
328
|
-
|
|
329
|
-
brand
|
|
330
|
-
model
|
|
331
|
-
company
|
|
332
|
-
routes
|
|
333
|
-
equipments
|
|
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
|
|
345
|
-
order_id
|
|
346
|
-
driver_id
|
|
347
|
-
vehicle_id
|
|
348
|
-
status
|
|
349
|
-
started_at
|
|
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
|
|
353
|
-
optimization_polyline
|
|
354
|
-
optimization_distance_meters
|
|
355
|
-
optimization_duration_seconds
|
|
356
|
-
optimization_distance_saved_meters
|
|
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
|
|
359
|
-
optimization_waypoint_order
|
|
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
|
|
365
|
-
driver
|
|
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
|
|
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
|
|
379
|
-
route_id
|
|
380
|
-
handling_unit_id String
|
|
381
|
-
created_at
|
|
382
|
-
updated_at
|
|
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
|
|
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
|
|
398
|
-
address_type
|
|
399
|
-
sequence
|
|
400
|
-
title
|
|
401
|
-
address_line1
|
|
402
|
-
address_line2
|
|
403
|
-
apartment
|
|
404
|
-
city
|
|
405
|
-
state
|
|
406
|
-
postal_code
|
|
407
|
-
country
|
|
408
|
-
latitude
|
|
409
|
-
longitude
|
|
410
|
-
google_address Json?
|
|
411
|
-
route_id
|
|
412
|
-
created_at
|
|
413
|
-
updated_at
|
|
414
|
-
|
|
415
|
-
route
|
|
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
|
|
424
|
-
address_id
|
|
425
|
-
handling_unit_id String
|
|
426
|
-
created_at
|
|
427
|
-
updated_at
|
|
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
|
|
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
|
|
440
|
-
name
|
|
441
|
-
logo_url
|
|
442
|
-
is_active
|
|
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
|
|
452
|
+
models EquipmentModel[]
|
|
447
453
|
equipments Equipment[]
|
|
448
454
|
|
|
449
455
|
@@map("equipment_brands")
|
|
450
456
|
}
|
|
451
457
|
|
|
452
458
|
model EquipmentModel {
|
|
453
|
-
id
|
|
454
|
-
name
|
|
455
|
-
brand_id
|
|
456
|
-
is_active
|
|
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
|
|
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
|
|
471
|
-
title
|
|
472
|
-
plate
|
|
473
|
-
year
|
|
474
|
-
color
|
|
475
|
-
brand_id
|
|
476
|
-
model_id
|
|
477
|
-
axles
|
|
478
|
-
chassis_number String?
|
|
479
|
-
weight
|
|
480
|
-
weight_unit
|
|
481
|
-
length
|
|
482
|
-
width
|
|
483
|
-
height
|
|
484
|
-
dimension_unit DimensionUnits
|
|
485
|
-
pallets
|
|
486
|
-
load_capacity
|
|
487
|
-
status
|
|
488
|
-
company_id
|
|
489
|
-
vehicle_id
|
|
490
|
-
created_at
|
|
491
|
-
updated_at
|
|
492
|
-
|
|
493
|
-
brand
|
|
494
|
-
model
|
|
495
|
-
company
|
|
496
|
-
vehicle
|
|
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
|
+
}
|