diff --git a/prisma/schema.prisma b/prisma/schema.prisma index d29cd8b..02f27a0 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -60,6 +60,21 @@ model Product { manualSaleItems ManualSaleItem[] stockLevels StockLevel[] 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