Split exchange into quotes service
All checks were successful
Build Docker Image / build (push) Successful in 2m0s

This commit is contained in:
Ruslan Bakiev
2026-05-31 16:14:18 +05:00
parent 5eae00961c
commit a499e03401
16 changed files with 2048 additions and 2656 deletions

View File

@@ -4,68 +4,67 @@ generator client {
datasource db {
provider = "postgresql"
url = env("EXCHANGE_DATABASE_URL")
}
model Offer {
id Int @id @default(autoincrement())
uuid String @unique @default(uuid())
teamUuid String @map("team_uuid") @db.VarChar(100)
status String @default("active") @db.VarChar(20)
workflowStatus String @default("pending") @map("workflow_status") @db.VarChar(20)
workflowError String? @map("workflow_error")
locationUuid String? @map("location_uuid") @db.VarChar(100)
locationName String @default("") @map("location_name") @db.VarChar(255)
locationCountry String @default("") @map("location_country") @db.VarChar(100)
locationCountryCode String @default("") @map("location_country_code") @db.VarChar(10)
locationLatitude Float? @map("location_latitude")
locationLongitude Float? @map("location_longitude")
productUuid String @map("product_uuid") @db.VarChar(100)
productName String @map("product_name") @db.VarChar(255)
categoryName String @default("") @map("category_name") @db.VarChar(255)
quantity Decimal @db.Decimal(12, 2)
unit String @default("ton") @db.VarChar(20)
pricePerUnit Decimal @map("price_per_unit") @db.Decimal(12, 2)
currency String @default("USD") @db.VarChar(10)
terminusSchemaId String? @map("terminus_schema_id") @db.VarChar(255)
terminusDocumentId String? @map("terminus_document_id") @db.VarChar(255)
description String?
validUntil DateTime? @map("valid_until") @db.Date
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
model Quote {
id Int @id @default(autoincrement())
uuid String @unique @default(uuid())
supplierId Int @map("supplier_id")
supplier Supplier @relation(fields: [supplierId], references: [id], onDelete: Cascade)
productId Int @map("product_id")
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
status String @default("active") @db.VarChar(20)
quantity Decimal @db.Decimal(12, 2)
unit String @default("ton") @db.VarChar(20)
pricePerUnit Decimal @map("price_per_unit") @db.Decimal(12, 2)
currency String @default("USD") @db.VarChar(10)
incotermsCode String? @map("incoterms_code") @db.VarChar(20)
originPointUuid String? @map("origin_point_uuid") @db.VarChar(100)
originName String? @map("origin_name") @db.VarChar(255)
validUntil DateTime? @map("valid_until") @db.Date
notes String?
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("offers")
@@index([status, productId, createdAt])
@@index([supplierId, createdAt])
@@map("exchange_quotes")
}
model Request {
id Int @id @default(autoincrement())
uuid String @unique @default(uuid())
productUuid String @map("product_uuid") @db.VarChar(100)
quantity Decimal @db.Decimal(12, 2)
sourceLocationUuid String @map("source_location_uuid") @db.VarChar(100)
userId String @map("user_id") @db.VarChar(255)
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
model Supplier {
id Int @id @default(autoincrement())
uuid String @unique @default(uuid())
teamUuid String? @unique @map("team_uuid") @db.VarChar(100)
name String @db.VarChar(255)
description String?
country String @default("") @db.VarChar(100)
countryCode String @default("") @map("country_code") @db.VarChar(10)
logoUrl String? @map("logo_url") @db.VarChar(500)
isVerified Boolean @default(false) @map("is_verified")
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("calculations")
quotes Quote[]
@@index([countryCode, isActive])
@@map("exchange_suppliers")
}
model SupplierProfile {
id Int @id @default(autoincrement())
uuid String @unique @default(uuid())
teamUuid String @unique @map("team_uuid") @db.VarChar(100)
kycProfileUuid String? @map("kyc_profile_uuid") @db.VarChar(100)
name String @db.VarChar(255)
description String?
country String @default("") @db.VarChar(100)
countryCode String @default("") @map("country_code") @db.VarChar(10)
logoUrl String? @map("logo_url") @db.VarChar(500)
latitude Float?
longitude Float?
isVerified Boolean @default(false) @map("is_verified")
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
model Product {
id Int @id @default(autoincrement())
uuid String @unique @default(uuid())
sku String? @unique @db.VarChar(100)
name String @db.VarChar(255)
categoryName String @default("") @map("category_name") @db.VarChar(255)
unit String @default("ton") @db.VarChar(20)
description String?
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("suppliers")
quotes Quote[]
@@index([categoryName, isActive])
@@map("exchange_products")
}