feat(backend): implement Phase A database models and controllers for cross-boundary dependencies
Deploy Canina / deploy (push) Failing after 28s
Deploy Canina / deploy (push) Failing after 28s
This commit is contained in:
1 parent
74fcaa6a4e
commit
1ae4c99ffc
26 files changed
+1205
-345
No files matched your search
+232
-120
@@ -9,23 +9,25 @@ datasource db {
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
firstName String @map("first_name") @db.VarChar(100)
|
||||
lastName String @map("last_name") @db.VarChar(100)
|
||||
email String? @unique @db.VarChar(150)
|
||||
mobile String @unique @db.VarChar(15)
|
||||
password String? @db.VarChar(255)
|
||||
role String @default("User_PetOwner") @db.VarChar(30)
|
||||
walletBalance Decimal @default(0.00) @map("wallet_balance") @db.Decimal(15, 2)
|
||||
charityDonationTotal Decimal @default(0.00) @map("charity_donation_total") @db.Decimal(15, 2)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz()
|
||||
|
||||
addresses UserAddress[]
|
||||
walletTransactions WalletTransaction[]
|
||||
pets Pet[]
|
||||
orders Order[]
|
||||
blogs Blog[]
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
firstName String @map("first_name") @db.VarChar(100)
|
||||
lastName String @map("last_name") @db.VarChar(100)
|
||||
email String? @unique @db.VarChar(150)
|
||||
mobile String @unique @db.VarChar(15)
|
||||
password String? @db.VarChar(255)
|
||||
role String @default("User_PetOwner") @db.VarChar(30)
|
||||
walletBalance Decimal @default(0.00) @map("wallet_balance") @db.Decimal(15, 2)
|
||||
charityDonationTotal Decimal @default(0.00) @map("charity_donation_total") @db.Decimal(15, 2)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz()
|
||||
|
||||
addresses UserAddress[]
|
||||
walletTransactions WalletTransaction[]
|
||||
pets Pet[]
|
||||
orders Order[]
|
||||
blogs Blog[]
|
||||
prescriptions Prescription[]
|
||||
partnerAccount PartnerAccount?
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
@@ -43,7 +45,7 @@ model UserAddress {
|
||||
isDefault Boolean @default(false) @map("is_default")
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([userId])
|
||||
@@map("user_addresses")
|
||||
@@ -59,7 +61,7 @@ model WalletTransaction {
|
||||
description String? @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("wallet_transactions")
|
||||
}
|
||||
@@ -91,9 +93,9 @@ model Category {
|
||||
imageUrl String? @map("image_url") @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
parent Category? @relation("SubCategories", fields: [parentId], references: [id])
|
||||
children Category[] @relation("SubCategories")
|
||||
products Product[]
|
||||
parent Category? @relation("SubCategories", fields: [parentId], references: [id])
|
||||
children Category[] @relation("SubCategories")
|
||||
products Product[]
|
||||
|
||||
@@map("categories")
|
||||
}
|
||||
@@ -112,7 +114,7 @@ model Blog {
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @default(now()) @map("updated_at") @db.Timestamptz()
|
||||
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
author User @relation(fields: [authorId], references: [id])
|
||||
|
||||
@@map("blogs")
|
||||
}
|
||||
@@ -139,6 +141,7 @@ model Product {
|
||||
unit String @db.VarChar(50)
|
||||
packageSize Decimal @map("package_size") @db.Decimal(10, 2)
|
||||
dosageLogic String? @map("dosage_logic") @db.Text
|
||||
dosageConfig Json? @map("dosage_config")
|
||||
suitableFor String @map("suitable_for") @db.VarChar(15) // سگ, گربه, هر دو
|
||||
imageUrl String @map("image_url") @db.Text
|
||||
images String[] @default([])
|
||||
@@ -151,12 +154,12 @@ model Product {
|
||||
keywords String? @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
category Category @relation(fields: [categoryId], references: [id])
|
||||
ingredientList ProductIngredient[]
|
||||
symptoms ProductSymptom[]
|
||||
reminders Reminder[]
|
||||
orderItems OrderItem[]
|
||||
advisorRules SmartAdvisorRule[]
|
||||
category Category @relation(fields: [categoryId], references: [id])
|
||||
ingredientList ProductIngredient[]
|
||||
symptoms ProductSymptom[]
|
||||
reminders Reminder[]
|
||||
orderItems OrderItem[]
|
||||
advisorRules SmartAdvisorRule[]
|
||||
|
||||
@@index([categorySlug])
|
||||
@@index([suitableFor])
|
||||
@@ -197,21 +200,22 @@ model ProductSymptom {
|
||||
}
|
||||
|
||||
model Pet {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
userId String @map("user_id") @db.Uuid
|
||||
name String @db.VarChar(100)
|
||||
type String @db.VarChar(10) // سگ, گربه
|
||||
breed String @db.VarChar(100)
|
||||
age Int
|
||||
weight Decimal @db.Decimal(5, 2)
|
||||
activityLevel String @map("activity_level") @db.VarChar(15) // کم, متوسط, زیاد
|
||||
imageUrl String? @map("image_url") @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
userId String @map("user_id") @db.Uuid
|
||||
name String @db.VarChar(100)
|
||||
type String @db.VarChar(10) // سگ, گربه
|
||||
breed String @db.VarChar(100)
|
||||
age Int
|
||||
weight Decimal @db.Decimal(5, 2)
|
||||
activityLevel String @map("activity_level") @db.VarChar(15) // کم, متوسط, زیاد
|
||||
imageUrl String? @map("image_url") @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
medicalConditions PetMedicalCondition[]
|
||||
reminders Reminder[]
|
||||
healthLogs HealthLog[]
|
||||
prescriptions Prescription[]
|
||||
|
||||
@@map("pets")
|
||||
}
|
||||
@@ -226,13 +230,13 @@ model PetMedicalCondition {
|
||||
}
|
||||
|
||||
model Reminder {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
petId String @map("pet_id") @db.Uuid
|
||||
productId String? @map("product_id") @db.Uuid
|
||||
title String @db.VarChar(150)
|
||||
time String @db.VarChar(5) // 08:30
|
||||
frequency String @db.VarChar(20) // روزانه, هفتگی
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
petId String @map("pet_id") @db.Uuid
|
||||
productId String? @map("product_id") @db.Uuid
|
||||
title String @db.VarChar(150)
|
||||
time String @db.VarChar(5) // 08:30
|
||||
frequency String @db.VarChar(20) // روزانه, هفتگی
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
pet Pet @relation(fields: [petId], references: [id], onDelete: Cascade)
|
||||
product Product? @relation(fields: [productId], references: [id], onDelete: SetNull)
|
||||
@@ -248,7 +252,7 @@ model ReminderCompletion {
|
||||
completedDate DateTime @map("completed_date") @db.Date
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
reminder Reminder @relation(fields: [reminderId], references: [id], onDelete: Cascade)
|
||||
reminder Reminder @relation(fields: [reminderId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([reminderId, completedDate])
|
||||
@@index([reminderId, completedDate])
|
||||
@@ -256,68 +260,68 @@ model ReminderCompletion {
|
||||
}
|
||||
|
||||
model HealthLog {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
petId String @map("pet_id") @db.Uuid
|
||||
appetite String @db.VarChar(15)
|
||||
energy String @db.VarChar(15)
|
||||
digestion String @db.VarChar(15)
|
||||
note String? @db.Text
|
||||
loggedDate DateTime @default(now()) @map("logged_date") @db.Date
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
petId String @map("pet_id") @db.Uuid
|
||||
appetite String @db.VarChar(15)
|
||||
energy String @db.VarChar(15)
|
||||
digestion String @db.VarChar(15)
|
||||
note String? @db.Text
|
||||
loggedDate DateTime @default(now()) @map("logged_date") @db.Date
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
pet Pet @relation(fields: [petId], references: [id], onDelete: Cascade)
|
||||
pet Pet @relation(fields: [petId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("health_logs")
|
||||
}
|
||||
|
||||
model Coupon {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
code String @unique @db.VarChar(50)
|
||||
type String @default("percent") @db.VarChar(20) // fixed, percent
|
||||
value Decimal @db.Decimal(15, 2)
|
||||
minCartValue Decimal? @map("min_cart_value") @db.Decimal(15, 2)
|
||||
maxCartValue Decimal? @map("max_cart_value") @db.Decimal(15, 2)
|
||||
maxUses Int? @map("max_uses")
|
||||
usedCount Int @default(0) @map("used_count")
|
||||
expiresAt DateTime? @map("expires_at") @db.Timestamptz()
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
code String @unique @db.VarChar(50)
|
||||
type String @default("percent") @db.VarChar(20) // fixed, percent
|
||||
value Decimal @db.Decimal(15, 2)
|
||||
minCartValue Decimal? @map("min_cart_value") @db.Decimal(15, 2)
|
||||
maxCartValue Decimal? @map("max_cart_value") @db.Decimal(15, 2)
|
||||
maxUses Int? @map("max_uses")
|
||||
usedCount Int @default(0) @map("used_count")
|
||||
expiresAt DateTime? @map("expires_at") @db.Timestamptz()
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
orders Order[]
|
||||
targets CouponTarget[]
|
||||
orders Order[]
|
||||
targets CouponTarget[]
|
||||
|
||||
@@map("coupons")
|
||||
}
|
||||
|
||||
model CouponTarget {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
couponId String @map("coupon_id") @db.Uuid
|
||||
targetType String @map("target_type") @db.VarChar(50) // USER, PET, ROLE, PRODUCT, CATEGORY
|
||||
targetId String @map("target_id") @db.VarChar(100) // UUID or role name
|
||||
modifierType String @default("override") @map("modifier_type") @db.VarChar(20) // override, add, subtract
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
couponId String @map("coupon_id") @db.Uuid
|
||||
targetType String @map("target_type") @db.VarChar(50) // USER, PET, ROLE, PRODUCT, CATEGORY
|
||||
targetId String @map("target_id") @db.VarChar(100) // UUID or role name
|
||||
modifierType String @default("override") @map("modifier_type") @db.VarChar(20) // override, add, subtract
|
||||
modifierValue Decimal? @map("modifier_value") @db.Decimal(15, 2)
|
||||
|
||||
coupon Coupon @relation(fields: [couponId], references: [id], onDelete: Cascade)
|
||||
coupon Coupon @relation(fields: [couponId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([targetType, targetId])
|
||||
@@map("coupon_targets")
|
||||
}
|
||||
|
||||
model Order {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
userId String @map("user_id") @db.Uuid
|
||||
couponId String? @map("coupon_id") @db.Uuid
|
||||
totalAmount Decimal @map("total_amount") @db.Decimal(15, 2)
|
||||
charityDonation Decimal @default(0.00) @map("charity_donation") @db.Decimal(15, 2)
|
||||
isRefill Boolean @default(false) @map("is_refill")
|
||||
refillIntervalDays Int? @map("refill_interval_days")
|
||||
status String @default("processing") @db.VarChar(30) // processing, shipped, delivered
|
||||
trackingNumber String? @unique @map("tracking_number") @db.VarChar(100)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
userId String @map("user_id") @db.Uuid
|
||||
couponId String? @map("coupon_id") @db.Uuid
|
||||
totalAmount Decimal @map("total_amount") @db.Decimal(15, 2)
|
||||
charityDonation Decimal @default(0.00) @map("charity_donation") @db.Decimal(15, 2)
|
||||
isRefill Boolean @default(false) @map("is_refill")
|
||||
refillIntervalDays Int? @map("refill_interval_days")
|
||||
status String @default("processing") @db.VarChar(30) // processing, shipped, delivered
|
||||
trackingNumber String? @unique @map("tracking_number") @db.VarChar(100)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
coupon Coupon? @relation(fields: [couponId], references: [id])
|
||||
orderItems OrderItem[]
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
coupon Coupon? @relation(fields: [couponId], references: [id])
|
||||
orderItems OrderItem[]
|
||||
|
||||
@@map("orders")
|
||||
}
|
||||
@@ -330,8 +334,8 @@ model OrderItem {
|
||||
doseQty Decimal? @map("dose_qty") @db.Decimal(10, 2)
|
||||
doseUnit String? @map("dose_unit") @db.VarChar(50)
|
||||
|
||||
order Order @relation(fields: [orderId], references: [id], onDelete: Cascade)
|
||||
product Product? @relation(fields: [productId], references: [id], onDelete: SetNull)
|
||||
order Order @relation(fields: [orderId], references: [id], onDelete: Cascade)
|
||||
product Product? @relation(fields: [productId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@map("order_items")
|
||||
}
|
||||
@@ -344,8 +348,8 @@ model UiText {
|
||||
}
|
||||
|
||||
model ScientificTerm {
|
||||
key String @id @db.VarChar(100)
|
||||
term String @db.VarChar(150)
|
||||
key String @id @db.VarChar(100)
|
||||
term String @db.VarChar(150)
|
||||
definition String @db.Text
|
||||
wikiId String @map("wiki_id") @db.VarChar(50)
|
||||
metaTitle String? @map("meta_title") @db.VarChar(200)
|
||||
@@ -356,42 +360,42 @@ model ScientificTerm {
|
||||
}
|
||||
|
||||
model HeroBanner {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
title String @db.VarChar(200)
|
||||
subtitle String? @db.Text
|
||||
imageUrl String @map("image_url") @db.Text
|
||||
buttonText String? @map("button_text") @db.VarChar(100)
|
||||
buttonLink String? @map("button_link") @db.Text
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
order Int @default(0)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
title String @db.VarChar(200)
|
||||
subtitle String? @db.Text
|
||||
imageUrl String @map("image_url") @db.Text
|
||||
buttonText String? @map("button_text") @db.VarChar(100)
|
||||
buttonLink String? @map("button_link") @db.Text
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
order Int @default(0)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
@@map("hero_banners")
|
||||
}
|
||||
|
||||
model VetTestimonial {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
vetName String @map("vet_name") @db.VarChar(150)
|
||||
clinicName String? @map("clinic_name") @db.VarChar(150)
|
||||
imageUrl String? @map("image_url") @db.Text
|
||||
quote String @db.Text
|
||||
rating Int @default(5)
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
order Int @default(0)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
vetName String @map("vet_name") @db.VarChar(150)
|
||||
clinicName String? @map("clinic_name") @db.VarChar(150)
|
||||
imageUrl String? @map("image_url") @db.Text
|
||||
quote String @db.Text
|
||||
rating Int @default(5)
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
order Int @default(0)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
@@map("vet_testimonials")
|
||||
}
|
||||
|
||||
model SmartAdvisorRule {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
condition String @db.VarChar(200)
|
||||
targetPetType String? @map("target_pet_type") @db.VarChar(50)
|
||||
condition String @db.VarChar(200)
|
||||
targetPetType String? @map("target_pet_type") @db.VarChar(50)
|
||||
recommendedProduct String @map("recommended_product_id") @db.Uuid
|
||||
reason String @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
|
||||
product Product @relation(fields: [recommendedProduct], references: [id], onDelete: Cascade)
|
||||
product Product @relation(fields: [recommendedProduct], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("smart_advisor_rules")
|
||||
}
|
||||
@@ -427,14 +431,122 @@ model ContactSubmission {
|
||||
}
|
||||
|
||||
model ContactInfo {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
key String @unique @db.VarChar(100)
|
||||
title String @db.VarChar(200)
|
||||
value String @db.Text
|
||||
icon String? @db.VarChar(100)
|
||||
order Int @default(0)
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
key String @unique @db.VarChar(100)
|
||||
title String @db.VarChar(200)
|
||||
value String @db.Text
|
||||
icon String? @db.VarChar(100)
|
||||
order Int @default(0)
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
@@map("contact_info")
|
||||
}
|
||||
|
||||
model Banner {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
title String @db.VarChar(200)
|
||||
subtitle String? @db.Text
|
||||
imageUrl String @map("image_url") @db.Text
|
||||
linkUrl String? @map("link_url") @db.Text
|
||||
position String @default("home_hero") @db.VarChar(50)
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
order Int @default(0)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
@@map("banners")
|
||||
}
|
||||
|
||||
model Testimonial {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
authorName String @map("author_name") @db.VarChar(150)
|
||||
roleTitle String? @map("role_title") @db.VarChar(150)
|
||||
avatarUrl String? @map("avatar_url") @db.Text
|
||||
content String @db.Text
|
||||
rating Int @default(5)
|
||||
isFeatured Boolean @default(false) @map("is_featured")
|
||||
isActive Boolean @default(true) @map("is_active")
|
||||
order Int @default(0)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
@@map("testimonials")
|
||||
}
|
||||
|
||||
model Ingredient {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
nameFa String @map("name_fa") @db.VarChar(150)
|
||||
nameEn String @map("name_en") @db.VarChar(150)
|
||||
slug String @unique @db.VarChar(150)
|
||||
description String? @db.Text
|
||||
scientificName String? @map("scientific_name") @db.VarChar(200)
|
||||
imageUrl String? @map("image_url") @db.Text
|
||||
benefits String[] @default([])
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
@@map("ingredients")
|
||||
}
|
||||
|
||||
model Prescription {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
userId String @map("user_id") @db.Uuid
|
||||
petId String? @map("pet_id") @db.Uuid
|
||||
fileUrl String @map("file_url") @db.Text
|
||||
status String @default("PENDING") @db.VarChar(30)
|
||||
notes String? @db.Text
|
||||
adminNotes String? @map("admin_notes") @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
pet Pet? @relation(fields: [petId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([userId])
|
||||
@@map("prescriptions")
|
||||
}
|
||||
|
||||
model B2BInquiry {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
companyName String @map("company_name") @db.VarChar(200)
|
||||
contactName String @map("contact_name") @db.VarChar(150)
|
||||
email String @db.VarChar(150)
|
||||
phone String @db.VarChar(20)
|
||||
businessType String @map("business_type") @db.VarChar(50)
|
||||
estimatedVolume String? @map("estimated_volume") @db.VarChar(100)
|
||||
message String @db.Text
|
||||
status String @default("PENDING") @db.VarChar(30)
|
||||
adminNotes String? @map("admin_notes") @db.Text
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
@@map("b2b_inquiries")
|
||||
}
|
||||
|
||||
model PartnerAccount {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
userId String @unique @map("user_id") @db.Uuid
|
||||
companyName String @map("company_name") @db.VarChar(200)
|
||||
taxId String? @map("tax_id") @db.VarChar(50)
|
||||
creditLimit Decimal @default(0.00) @map("credit_limit") @db.Decimal(15, 2)
|
||||
discountTier String @default("STANDARD") @map("discount_tier") @db.VarChar(30)
|
||||
status String @default("ACTIVE") @db.VarChar(30)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@map("partner_accounts")
|
||||
}
|
||||
|
||||
model Setting {
|
||||
id String @id @default(uuid()) @db.Uuid
|
||||
category String @db.VarChar(50)
|
||||
key String @unique @db.VarChar(100)
|
||||
value Json
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz()
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz()
|
||||
|
||||
@@index([category])
|
||||
@@map("settings")
|
||||
}
|
||||
Reference in new issue
Block a user