Add ProductImage schema for bulk image upload
- ProductImage model links images to products with detected color - Supports any product type (tees, hoodies, mugs, etc.) - One image per color per product (unique constraint) Bulk upload form + color detection coming next. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
7cb8d9b5a6
commit
158c9cf934
@@ -60,6 +60,21 @@ model Product {
|
|||||||
manualSaleItems ManualSaleItem[]
|
manualSaleItems ManualSaleItem[]
|
||||||
stockLevels StockLevel[]
|
stockLevels StockLevel[]
|
||||||
purchaseItems PurchaseItem[]
|
purchaseItems PurchaseItem[]
|
||||||
|
productImages ProductImage[]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bulk-uploaded product images with auto-detected colors. Supports any product type
|
||||||
|
// (tees, hoodies, mugs, etc.). User uploads a folder, colors are extracted, then saved
|
||||||
|
// as color-swatch references for the product's color palette.
|
||||||
|
model ProductImage {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
productId String
|
||||||
|
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||||
|
color String // hex color detected from the image, e.g. "#1EA7E0"
|
||||||
|
imageDataUrl String // the uploaded image itself as a data URL
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
|
||||||
|
@@unique([productId, color])
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quantity on hand for one product/colour/size combination. Purchases increase
|
// Quantity on hand for one product/colour/size combination. Purchases increase
|
||||||
|
|||||||
Reference in New Issue
Block a user