Persist multimodal order routes
Build and deploy Docker image / build (push) Successful in 1m2s

This commit is contained in:
Ruslan Bakiev
2026-08-24 21:45:05 +07:00
parent c3464e5f3f
commit f1ecd83e9c
5 changed files with 575 additions and 28 deletions
+62
View File
@@ -95,12 +95,41 @@ model Quotation {
orders Order[]
changes QuotationChange[]
routeStages QuotationRouteStage[]
@@index([teamUuid, status, createdAt])
@@index([teamUuid, sourceCountryCode, destinationCountryCode])
@@map("orders_quotation")
}
model QuotationRouteStage {
id Int @id @default(autoincrement())
uuid String @unique @default(uuid())
quotationId Int @map("quotation_id")
quotation Quotation @relation(fields: [quotationId], references: [id], onDelete: Cascade)
sequence Int
stageType String @map("stage_type") @db.VarChar(30)
transportType String? @map("transport_type") @db.VarChar(50)
sourcePointUuid String? @map("source_point_uuid") @db.VarChar(100)
sourcePointType String @map("source_point_type") @db.VarChar(30)
sourceLocationName String @map("source_location_name") @db.VarChar(255)
sourceLatitude Float? @map("source_latitude")
sourceLongitude Float? @map("source_longitude")
destinationPointUuid String? @map("destination_point_uuid") @db.VarChar(100)
destinationPointType String @map("destination_point_type") @db.VarChar(30)
destinationLocationName String @map("destination_location_name") @db.VarChar(255)
destinationLatitude Float? @map("destination_latitude")
destinationLongitude Float? @map("destination_longitude")
distanceKm Float? @map("distance_km")
travelTimeSeconds Int? @map("travel_time_seconds")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@unique([quotationId, sequence])
@@index([quotationId, sequence])
@@map("orders_quotation_route_stage")
}
model QuotationChange {
id Int @id @default(autoincrement())
uuid String @unique @default(uuid())
@@ -138,6 +167,7 @@ model Order {
exchangeRateLockedAt DateTime? @map("exchange_rate_locked_at")
pricingCountryCode String? @map("pricing_country_code") @db.VarChar(2)
pricingKycProfileUuid String? @map("pricing_kyc_profile_uuid") @db.VarChar(100)
sourceHubUuid String? @map("source_hub_uuid") @db.VarChar(100)
sourceLocationUuid String? @map("source_location_uuid") @db.VarChar(100)
sourceLocationName String? @map("source_location_name") @db.VarChar(255)
sourceCountryCode String? @map("source_country_code") @db.VarChar(10)
@@ -146,6 +176,7 @@ model Order {
destinationLocationUuid String? @map("destination_location_uuid") @db.VarChar(100)
destinationLocationName String? @map("destination_location_name") @db.VarChar(255)
destinationCountryCode String? @map("destination_country_code") @db.VarChar(10)
destinationHubUuid String? @map("destination_hub_uuid") @db.VarChar(100)
destinationLatitude Float? @map("destination_latitude")
destinationLongitude Float? @map("destination_longitude")
etaDays Int? @map("eta_days")
@@ -153,6 +184,37 @@ model Order {
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
routeStages OrderRouteStage[]
@@index([teamUuid, createdAt])
@@map("orders_order")
}
model OrderRouteStage {
id Int @id @default(autoincrement())
uuid String @unique @default(uuid())
orderId Int @map("order_id")
order Order @relation(fields: [orderId], references: [id], onDelete: Cascade)
quotationRouteStageUuid String? @map("quotation_route_stage_uuid") @db.VarChar(100)
sequence Int
stageType String @map("stage_type") @db.VarChar(30)
transportType String? @map("transport_type") @db.VarChar(50)
sourcePointUuid String? @map("source_point_uuid") @db.VarChar(100)
sourcePointType String @map("source_point_type") @db.VarChar(30)
sourceLocationName String @map("source_location_name") @db.VarChar(255)
sourceLatitude Float? @map("source_latitude")
sourceLongitude Float? @map("source_longitude")
destinationPointUuid String? @map("destination_point_uuid") @db.VarChar(100)
destinationPointType String @map("destination_point_type") @db.VarChar(30)
destinationLocationName String @map("destination_location_name") @db.VarChar(255)
destinationLatitude Float? @map("destination_latitude")
destinationLongitude Float? @map("destination_longitude")
distanceKm Float? @map("distance_km")
travelTimeSeconds Int? @map("travel_time_seconds")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@unique([orderId, sequence])
@@index([orderId, sequence])
@@map("orders_order_route_stage")
}