Add store loan methods with public website calculate API.

Supports dashboard CRUD and tenant list/get/calculate so storefronts can offer installments, requiring a method pick when several exist.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-09-24 23:17:51 +03:30
co-authored by Cursor
parent 2a01873c95
commit 4a9e10e614
11 changed files with 1209 additions and 5 deletions
+30
View File
@@ -160,6 +160,7 @@ model Business {
shoppingCards ShoppingCard[]
storeItemVariants StoreItemVariant[]
storeItems StoreItem[]
storeLoanMethods StoreLoanMethod[]
storeSpecials StoreSpecial[]
transactions Transaction[]
userProductTechnicalFieldValues UserProductTechnicalFieldValue[]
@@ -379,6 +380,7 @@ model Media {
oldId BigInt? @map("old_id")
blogs blogs[]
brandImages Brand[]
storeLoanMethodImages StoreLoanMethod[]
faviconBusinesses Business[] @relation("BusinessFavicon")
logoBusinesses Business[] @relation("BusinessLogo")
logoDarkBusinesses Business[] @relation("BusinessLogoDark")
@@ -1220,6 +1222,34 @@ model StoreSpecial {
@@map("store_specials")
}
model StoreLoanMethod {
id BigInt @id @default(autoincrement())
businessId BigInt @map("business_id")
nameFa String @map("name") @db.VarChar(255)
nameEn String @map("name_en") @db.VarChar(255)
description String?
imageMediaId BigInt? @map("image_media_id")
imageAspectRatio String @default("1:1") @map("image_aspect_ratio") @db.VarChar(10)
minShoppingAmount Decimal @map("min_shopping_amount") @db.Decimal(12, 2)
minAmount Decimal @map("min_amount") @db.Decimal(12, 2)
maxAmount Decimal @map("max_amount") @db.Decimal(12, 2)
interest Decimal @db.Decimal(8, 4)
returnMonthsMin Int @map("return_months_min")
returnMonthsMax Int @map("return_months_max")
returnMonthsStep Int @default(3) @map("return_months_step")
sortOrder Int @default(0) @map("sort_order")
isActive Boolean @default(true) @map("is_active")
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(6)
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz(6)
business Business @relation(fields: [businessId], references: [id], onDelete: Cascade, onUpdate: NoAction)
imageMedia Media? @relation(fields: [imageMediaId], references: [id], onUpdate: NoAction)
@@index([businessId], map: "idx_store_loan_methods_business_id")
@@index([imageMediaId], map: "idx_store_loan_methods_image_media_id")
@@index([businessId, sortOrder], map: "idx_store_loan_methods_business_sort_order")
@@map("store_loan_methods")
}
model website_brand_group_items {
id BigInt @id @default(autoincrement())
group_id BigInt