feat: add product review and rating system with schema update
This commit is contained in:
1 parent
091eeef7d8
commit
e4f7951b34
5 files changed
+230
-1
No files matched your search
@@ -38,6 +38,7 @@ model Product {
|
||||
scent Scent @relation(fields: [scentId], references: [id])
|
||||
variants ProductVariant[]
|
||||
images ProductImage[]
|
||||
reviews Review[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@ -82,6 +83,7 @@ model Customer {
|
||||
email String?
|
||||
phone String?
|
||||
orders Order[]
|
||||
reviews Review[]
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
@@ -372,3 +374,21 @@ model LazadaOrderItem {
|
||||
shippingFee Float @default(0)
|
||||
status String?
|
||||
}
|
||||
|
||||
// ── Reviews ────────────────────────────────────────────────────────────────
|
||||
model Review {
|
||||
id Int @id @default(autoincrement())
|
||||
rating Int @default(5)
|
||||
comment String?
|
||||
productId Int
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
customerId Int?
|
||||
customer Customer? @relation(fields: [customerId], references: [id], onDelete: SetNull)
|
||||
customerName String?
|
||||
isPublished Boolean @default(true)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([productId])
|
||||
@@index([customerId])
|
||||
}
|
||||
Reference in new issue
Block a user