feat(backend): implement pricing engine for loyalty points and 3-level promotions
This commit is contained in:
1 parent
36ea126993
commit
77c52e0534
4 files changed
+109
-7
No files matched your search
@@ -82,6 +82,7 @@ model Customer {
|
||||
pictureUrl String?
|
||||
email String?
|
||||
phone String?
|
||||
points Int @default(0)
|
||||
orders Order[]
|
||||
reviews Review[]
|
||||
createdAt DateTime @default(now())
|
||||
@@ -116,12 +117,27 @@ model Coupon {
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model Promotion {
|
||||
id Int @id @default(autoincrement())
|
||||
name String
|
||||
level Int
|
||||
type String
|
||||
value Float
|
||||
minPurchase Float @default(0)
|
||||
isActive Boolean @default(true)
|
||||
startDate DateTime?
|
||||
endDate DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model StoreSettings {
|
||||
id Int @id @default(1)
|
||||
shippingFee Float @default(35)
|
||||
bankName String @default("KASIKORNBANK (KBANK)")
|
||||
bankAccountName String @default("HomAroma Co., Ltd.")
|
||||
bankAccountNumber String @default("012-3-45678-9")
|
||||
pointsEarnRate Float @default(1.0)
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
@@ -131,10 +147,22 @@ model Order {
|
||||
customerEmail String
|
||||
customerPhone String
|
||||
shippingAddress String
|
||||
totalAmount Float
|
||||
shippingFee Float @default(35)
|
||||
|
||||
subtotal Float @default(0)
|
||||
promoLevel1Name String?
|
||||
promoLevel1Disc Float @default(0)
|
||||
promoLevel2Name String?
|
||||
promoLevel2Disc Float @default(0)
|
||||
|
||||
couponCode String?
|
||||
discountAmount Float @default(0)
|
||||
|
||||
pointsUsed Int @default(0)
|
||||
pointsDiscount Float @default(0)
|
||||
pointsEarned Int @default(0)
|
||||
|
||||
shippingFee Float @default(35)
|
||||
totalAmount Float
|
||||
status String @default("PENDING_PAYMENT")
|
||||
paymentSlipUrl String?
|
||||
|
||||
|
||||
Reference in new issue
Block a user