x
This commit is contained in:
1 parent
ed69a4b840
commit
992335a52b
22 files changed
+1064
-346
No files matched your search
@@ -9,25 +9,25 @@ datasource db {
|
||||
provider = "postgresql"
|
||||
}
|
||||
|
||||
model Scent {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
model ProductBrand {
|
||||
id Int @id @default(autoincrement())
|
||||
name String @unique
|
||||
products Product[]
|
||||
translations ScentTranslation[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
translations ProductBrandTranslation[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model ScentTranslation {
|
||||
id Int @id @default(autoincrement())
|
||||
scentId Int
|
||||
scent Scent @relation(fields: [scentId], references: [id], onDelete: Cascade)
|
||||
model ProductBrandTranslation {
|
||||
id Int @id @default(autoincrement())
|
||||
brandId Int
|
||||
brand ProductBrand @relation(fields: [brandId], references: [id], onDelete: Cascade)
|
||||
langCode String
|
||||
name String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([scentId, langCode])
|
||||
@@unique([brandId, langCode])
|
||||
}
|
||||
|
||||
model Category {
|
||||
@@ -60,16 +60,15 @@ model Product {
|
||||
name String?
|
||||
description String?
|
||||
details String?
|
||||
scentId Int
|
||||
scent Scent @relation(fields: [scentId], references: [id])
|
||||
brandId Int
|
||||
brand ProductBrand @relation(fields: [brandId], references: [id])
|
||||
options Json? @default("[]") // Expected shape: [{ name: "Color", values: ["Red", "Blue"] }, ...]
|
||||
variants ProductVariant[]
|
||||
images ProductImage[]
|
||||
reviews Review[]
|
||||
translations ProductTranslation[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([scentId, categoryId])
|
||||
}
|
||||
|
||||
model ProductTranslation {
|
||||
@@ -96,15 +95,22 @@ model ProductImage {
|
||||
|
||||
model ProductVariant {
|
||||
id Int @id @default(autoincrement())
|
||||
size String
|
||||
sku String? @unique
|
||||
barcode String?
|
||||
price Float? @default(0)
|
||||
stock Int @default(0)
|
||||
|
||||
option1 String @default("") // Maps to Product.options[0]
|
||||
option2 String @default("") // Maps to Product.options[1]
|
||||
option3 String @default("") // Maps to Product.options[2]
|
||||
|
||||
productId Int
|
||||
product Product @relation(fields: [productId], references: [id])
|
||||
bomItems BomItem[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@unique([productId, size])
|
||||
@@unique([productId, option1, option2, option3])
|
||||
}
|
||||
|
||||
model User {
|
||||
@@ -147,7 +153,6 @@ model CustomerAddress {
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
|
||||
model Coupon {
|
||||
id Int @id @default(autoincrement())
|
||||
code String @unique
|
||||
|
||||
Reference in new issue
Block a user