roadmap/schemas/market.prisma

63 lines
1.9 KiB
Plaintext

// Market Intelligence Domain
// Contains market prices, demand analysis, and business intelligence
model MarketPrice {
id String @id @default(cuid())
productId String
variantId String?
market String
region String
price Decimal
unit String @default("kg")
qualityGrade QualityGrade
priceDate DateTime
source String? // where price data came from
volume Decimal? // trading volume
trend PriceTrend?
verified Boolean @default(false)
verifiedBy String?
notes String?
createdAt DateTime @default(now())
// Relations
product Product @relation(fields: [productId], references: [id])
variant ProductVariant? @relation(fields: [variantId], references: [id])
@@index([productId, variantId])
@@index([market, region])
@@index([priceDate])
@@index([qualityGrade])
@@index([trend])
@@index([verified])
@@index([price])
@@map("market_prices")
}
model MarketDemand {
id String @id @default(cuid())
productId String
variantId String?
region String
demandLevel DemandLevel
estimatedVolume Decimal?
priceRange String?
season String?
factors String[] // factors affecting demand
forecastDate DateTime
forecastBy String?
accuracy Decimal? // percentage
notes String?
createdAt DateTime @default(now())
// Relations
product Product @relation(fields: [productId], references: [id])
variant ProductVariant? @relation(fields: [variantId], references: [id])
@@index([productId, variantId])
@@index([region])
@@index([demandLevel])
@@index([forecastDate])
@@index([season])
@@index([accuracy])
@@map("market_demand")
}