Files
exchange/prisma/schema.prisma
Ruslan Bakiev 27b86c85b7
All checks were successful
Build Docker Image / build (push) Successful in 1m54s
Migrate exchange backend from Django to Express + Apollo Server + Prisma
Replace Python/Django/Graphene with TypeScript/Express/Apollo Server.
Same 4 endpoints (public/user/team/m2m), same JWT auth.
Prisma replaces Django ORM for Offer/Request/SupplierProfile.
Temporal and Odoo integrations preserved.
2026-03-09 09:20:37 +07:00

72 lines
3.1 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
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")
@@map("offers")
}
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")
@@map("calculations")
}
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")
@@map("suppliers")
}