Accounts, sessions, OTPs, audit logs and deletion flows
Table 01 / Auth & Users
1) Table Name: User
Stores login identity, role, verification status and account lifecycle state for buyers, sellers and admins.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | String | UQIDX | No | seller@example.com | User email address used for authentication and communication. @unique |
|
| 3 | phone | String? | UQIDX | Yes | +91 9876543210 | Mobile phone number used for verification and contact. @unique |
| 4 | profileName | String? | - | Yes | Sample Name | Stores profile name. - |
| 5 | passwordHash | String? | - | Yes | text | Hashed password value. Plaintext password is never stored. - |
| 6 | role | Role | IDX | No | BUYER | Enum value from Role (BUYER, SELLER, ADMIN). - |
| 7 | accountSetupPhase | AccountSetupPhase | - | No | PENDING | Enum value from AccountSetupPhase (PENDING, EMAIL_VERIFIED, PHONE_VERIFIED, KYC_VERIFIED, BANK_VERIFIED, TRADEMARK_SUBMITTED...). @default(PENDING) |
| 8 | userProfileStatus | UserProfileStatus | IDX | No | PENDING | Enum value from UserProfileStatus (PENDING, ACTIVE, SUSPENDED, DELETED). @default(PENDING) |
| 9 | isEmailVerified | Boolean | - | No | false | Boolean flag for is email verified. @default(false) |
| 10 | isPhoneVerified | Boolean | - | No | false | Boolean flag for is phone verified. @default(false) |
| 11 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 12 | roleId | String? | - | Yes | uuid | To store the current role ID (e.g., buyer role ID, seller role ID, or admin role ID) - |
| 13 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 14 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 15 | loginSessions | LoginSessions[] | REL | No | LoginSessions[] | Virtual Prisma back-relation containing related LoginSessions records. - |
| 16 | otps | Otp[] | REL | No | Otp[] | Virtual Prisma back-relation containing related Otp records. - |
| 17 | auditLogs | AuditLog[] | REL | No | AuditLog[] | Virtual Prisma back-relation containing related AuditLog records. - |
| 18 | buyerProfile | BuyerProfile? | REL | Yes | BuyerProfile | Virtual Prisma relation to BuyerProfile. - |
| 19 | cartItems | CartItem[] | REL | No | CartItem[] | Virtual Prisma back-relation containing related CartItem records. @relation("CartItemBuyer") |
| 20 | wishlistItems | WishlistItem[] | REL | No | WishlistItem[] | Virtual Prisma back-relation containing related WishlistItem records. @relation("WishlistItemBuyer") |
| 21 | addresses | Address[] | REL | No | Address[] | Virtual Prisma back-relation containing related Address records. @relation("BuyerAddresses") |
| 22 | sellerProfile | SellerProfile? | REL | Yes | SellerProfile | Virtual Prisma relation to SellerProfile. - |
| 23 | deletionRequest | DeletionRequest? | REL | Yes | DeletionRequest | Virtual Prisma relation to DeletionRequest. - |
| 24 | tradeMarks | TradMark[] | REL | No | TradMark[] | Virtual Prisma back-relation containing related TradMark records. - |
| 25 | buyerOrders | Order[] | REL | No | Order[] | Virtual Prisma back-relation containing related Order records. @relation("BuyerOrders") |
| 26 | returnRequests | ReturnRequest[] | REL | No | ReturnRequest[] | Virtual Prisma back-relation containing related ReturnRequest records. @relation("ReturnRequestBuyer") |
| 27 | sellerRatingsGiven | SellerRating[] | REL | No | SellerRating[] | Virtual Prisma back-relation containing related SellerRating records. @relation("SellerRatingBuyer") |
| 28 | productReviews | ProductReview[] | REL | No | ProductReview[] | Virtual Prisma back-relation containing related ProductReview records. @relation("ProductReviewBuyer") |
| 29 | reviewHelpfulVotes | ReviewHelpfulVote[] | REL | No | ReviewHelpfulVote[] | Virtual Prisma back-relation containing related ReviewHelpfulVote records. @relation("ReviewHelpfulVoteBuyer") |
| 30 | productQuestions | ProductQuestion[] | REL | No | ProductQuestion[] | Virtual Prisma back-relation containing related ProductQuestion records. @relation("ProductQuestionBuyer") |
| 31 | stockBackAlerts | StockBackAlert[] | REL | No | StockBackAlert[] | Virtual Prisma back-relation containing related StockBackAlert records. @relation("StockBackAlertBuyer") |
| 32 | productViews | ProductView[] | REL | No | ProductView[] | Virtual Prisma back-relation containing related ProductView records. @relation("ProductViewBuyer") |
| 33 | notifications | Notification[] | REL | No | Notification[] | Virtual Prisma back-relation containing related Notification records. @relation("NotificationRecipient") |
| 34 | sentMessages | Message[] | REL | No | Message[] | Virtual Prisma back-relation containing related Message records. @relation("MessageSender") |
| 35 | receivedMessages | Message[] | REL | No | Message[] | Virtual Prisma back-relation containing related Message records. @relation("MessageReceiver") |
| 36 | buyerConversationThreads | ConversationThread[] | REL | No | ConversationThread[] | Virtual Prisma back-relation containing related ConversationThread records. @relation("BuyerConversationThreads") |
| 37 | couponClips | CouponClip[] | REL | No | CouponClip[] | Virtual Prisma back-relation containing related CouponClip records. @relation("CouponClipBuyer") |
| 38 | couponRedemptions | CouponRedemption[] | REL | No | CouponRedemption[] | Virtual Prisma back-relation containing related CouponRedemption records. @relation("CouponRedemptionBuyer") |
Table 02 / Auth & Users
2) Table Name: LoginSessions
Stores refresh-token sessions, expiry, device and IP metadata for secure authentication.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | userId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 3 | refreshTokenHash | String | IDX | No | text | SHA-256 — plaintext never stored - |
| 4 | expiresAt | DateTime | IDX | No | now() | Date/time value for expires at. - |
| 5 | ipAddress | String? | - | Yes | text | Stores ip address. - |
| 6 | userAgent | String? | - | Yes | text | Stores user agent. - |
| 7 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 8 | deletedAt | DateTime? | - | Yes | now() | Timestamp when the record was soft-deleted. - |
| 9 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 10 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 11 | user | User | REL | No | User | Virtual Prisma relation to User. @relation(fields: [userId], references: [id]) |
Table 03 / Auth & Users
3) Table Name: Otp
Stores hashed OTPs for verification, login, password reset and account deletion workflows.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | identity | String | UQ* | No | text | email or phone - |
| 3 | channel | OtpChannel | UQ* | No | Enum value from OtpChannel (email, phone). - |
|
| 4 | purpose | OtpPurpose | UQ* | No | VERIFICATION_OTP | Enum value from OtpPurpose (VERIFICATION_OTP, LOGIN_OTP, PASSWORD_RESET_OTP, ACCOUNT_DELETION_OTP). - |
| 5 | hash | String | - | No | text | SHA-256 of plaintext OTP - |
| 6 | expiresAt | DateTime | IDX | No | now() | Date/time value for expires at. - |
| 7 | attempts | Int | - | No | 0 | Stores attempts. @default(0) |
| 8 | userId | String? | FK | Yes | uuid | Foreign key reference to User.id. - |
| 9 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 10 | user | User? | REL | Yes | User | Virtual Prisma relation to User. @relation(fields: [userId], references: [id]) |
Table 04 / Auth & Users
4) Table Name: PermenentDeletedCredentials
Keeps blocked credentials from permanently deleted accounts to prevent reuse where required.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | String? | UQ* | Yes | seller@example.com | User email address used for authentication and communication. - |
|
| 3 | phone | String? | UQ* | Yes | +91 9876543210 | Mobile phone number used for verification and contact. - |
| 4 | brandName | String? | UQ* | Yes | Sample Name | Stores brand name. - |
| 5 | deletedAt | DateTime | - | No | now() | Timestamp when the record was soft-deleted. @default(now()) |
Table 05 / Auth & Users
5) Table Name: BuyerProfile
Extends a user account with buyer-specific profile data.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | userId | String | UQFK | No | uuid | Foreign key reference to User.id. @unique |
| 3 | user | User | REL | No | User | Virtual Prisma relation to User. @relation(fields: [userId], references: [id]) |
Table 06 / Auth & Users
6) Table Name: AuditLog
Tracks security and account events with optional metadata for admin review and compliance.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | userId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 3 | event | AuditEvent | IDX | No | BUYER_SIGNUP | Enum value from AuditEvent (BUYER_SIGNUP, BUYER_LOGIN, SELLER_SIGNUP, SELLER_LOGIN, PASSWORD_RESET, ACCOUNT_DELETION...). - |
| 4 | resourceId | String? | IDX | Yes | uuid | ID of the resource affected - |
| 5 | resourceType | String? | IDX | Yes | text | Type of the resource - |
| 6 | ipAddress | String? | - | Yes | text | Stores ip address. - |
| 7 | userAgent | String? | - | Yes | text | Stores user agent. - |
| 8 | metadata | Json? | - | Yes | {} | Flexible JSON metadata for extra provider or audit information. - |
| 9 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 10 | user | User | REL | No | User | Virtual Prisma relation to User. @relation(fields: [userId], references: [id]) |
Table 07 / Auth & Users
7) Table Name: DeletionRequest
Stores account deletion requests, approval status, cooling-off period and seller final-settlement payout link.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | userId | String | UQFK | No | uuid | Foreign key reference to User.id. @unique |
| 3 | reason | String | - | No | text | Stores reason. - |
| 4 | reasonDetail | String? | - | Yes | text | Stores reason detail. - |
| 5 | status | String | - | No | "PENDING_ADMIN_APPROVAL" | Current workflow or lifecycle status. @default("PENDING_ADMIN_APPROVAL") |
| 6 | adminNote | String? | - | Yes | text | Stores admin note. - |
| 7 | requestedAt | DateTime | - | No | now() | Date/time value for requested at. @default(now()) |
| 8 | resolvedAt | DateTime? | - | Yes | now() | Date/time value for resolved at. - |
| 9 | coolingOffUntil | DateTime? | - | Yes | now() | Stores cooling off until. - |
| 10 | sellerExitSettlementAmount | Decimal?Decimal(14, 2) | - | Yes | 0.00 | Monetary/decimal value for seller exit settlement amount. @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 11 | sellerExitPayoutId | String? | UQFK | Yes | uuid | Foreign key reference to PayoutRequest.id. @unique |
| 12 | user | User | REL | No | User | Virtual Prisma relation to User. @relation(fields: [userId], references: [id]) |
| 13 | sellerExitPayout | PayoutRequest? | REL | Yes | PayoutRequest | Virtual Prisma relation to PayoutRequest. @relation(fields: [sellerExitPayoutId], references: [id]) |
Table 08 / Buyer
8) Table Name: CartItem
Stores active and soft-deleted cart items selected by a buyer.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 3 | productId | String | FKIDX | No | uuid | Foreign key reference to Product.id. - |
| 4 | variantId | String? | FKIDX | Yes | uuid | Foreign key reference to ProductVariant.id. - |
| 5 | qty | Int | - | No | 0 | Quantity selected by the buyer. - |
| 6 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 7 | deletedAt | DateTime? | - | Yes | now() | Timestamp when the record was soft-deleted. - |
| 8 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 9 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 10 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("CartItemBuyer", fields: [buyerId], references: [id]) |
| 11 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id]) |
| 12 | variant | ProductVariant? | REL | Yes | ProductVariant | Virtual Prisma relation to ProductVariant. @relation(fields: [variantId], references: [id]) |
Table 09 / Buyer
9) Table Name: WishlistItem
Stores buyer wishlist entries for products and variants.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 3 | productId | String | FKIDX | No | uuid | Foreign key reference to Product.id. - |
| 4 | variantId | String? | FKIDX | Yes | uuid | Foreign key reference to ProductVariant.id. - |
| 5 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 6 | deletedAt | DateTime? | - | Yes | now() | Timestamp when the record was soft-deleted. - |
| 7 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 8 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 9 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("WishlistItemBuyer", fields: [buyerId], references: [id]) |
| 10 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id]) |
| 11 | variant | ProductVariant? | REL | Yes | ProductVariant | Virtual Prisma relation to ProductVariant. @relation(fields: [variantId], references: [id]) |
Table 10 / Buyer
10) Table Name: Address
Stores buyer delivery and billing addresses with default address support.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 3 | fullName | String | - | No | Sample Name | Stores full name. - |
| 4 | phone | String | - | No | +91 9876543210 | Mobile phone number used for verification and contact. - |
| 5 | addressLine1 | String | - | No | text | Stores address line1. - |
| 6 | addressLine2 | String? | - | Yes | text | Stores address line2. - |
| 7 | city | String | - | No | text | Stores city. - |
| 8 | state | String | - | No | text | Stores state. - |
| 9 | pinCode | String | - | No | CODE123 | Stores pin code. - |
| 10 | type | String | - | No | text | Stores type. - |
| 11 | isDefault | Boolean | IDX | No | false | Marks this record as the default option. @default(false) |
| 12 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 13 | deletedAt | DateTime? | - | Yes | now() | Timestamp when the record was soft-deleted. - |
| 14 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 15 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 16 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("BuyerAddresses", fields: [buyerId], references: [id]) |
Table 11 / Deals & Coupons
11) Table Name: Deal
Defines seller deal campaigns such as lightning deals and best deals.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 3 | title | String | - | No | text | Display title. - |
| 4 | dealType | DealType | - | No | LIGHTNING | Enum value from DealType (LIGHTNING, BEST_DEAL). - |
| 5 | status | PromotionStatus | IDX | No | DRAFT | Current workflow or lifecycle status. @default(DRAFT) |
| 6 | minDiscountPercent | DecimalDecimal(5, 2) | - | No | 15 | Monetary/decimal value for min discount percent. @default(15) @db.Decimal(5, 2) | DB: Decimal(5, 2) |
| 7 | startAt | DateTime | IDX | No | now() | Date/time value for start at. - |
| 8 | endAt | DateTime | IDX | No | now() | Date/time value for end at. - |
| 9 | isDeleted | Boolean | - | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 10 | deletedAt | DateTime? | - | Yes | now() | Timestamp when the record was soft-deleted. - |
| 11 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 12 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 13 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 14 | products | DealProduct[] | REL | No | DealProduct[] | Virtual Prisma back-relation containing related DealProduct records. - |
Table 12 / Deals & Coupons
12) Table Name: DealProduct
Links deal campaigns to products/variants with deal pricing and sale limits.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | dealId | String | FKUQ* | No | uuid | Foreign key reference to Deal.id. - |
| 3 | productId | String | FKUQ*IDX | No | uuid | Foreign key reference to Product.id. - |
| 4 | variantId | String? | FKUQ* | Yes | uuid | Foreign key reference to ProductVariant.id. - |
| 5 | originalPrice | DecimalDecimal(12, 2) | - | No | 0.00 | Monetary/decimal value for original price. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 6 | dealPrice | DecimalDecimal(12, 2) | - | No | 0.00 | Monetary/decimal value for deal price. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 7 | discountPercent | DecimalDecimal(5, 2) | - | No | 0.00 | Monetary/decimal value for discount percent. @db.Decimal(5, 2) | DB: Decimal(5, 2) |
| 8 | quantityLimit | Int? | - | Yes | 0 | Stores quantity limit. - |
| 9 | unitsSold | Int | - | No | 0 | Stores units sold. @default(0) |
| 10 | revenueAmount | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for revenue amount. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 11 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 12 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 13 | deal | Deal | REL | No | Deal | Virtual Prisma relation to Deal. @relation(fields: [dealId], references: [id], onDelete: Cascade) |
| 14 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id]) |
| 15 | variant | ProductVariant? | REL | Yes | ProductVariant | Virtual Prisma relation to ProductVariant. @relation(fields: [variantId], references: [id]) |
Table 13 / Deals & Coupons
13) Table Name: Coupon
Defines seller coupon rules, discount amounts, usage limits and validity dates.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 3 | code | String | UQ | No | CODE123 | Stores code. @unique |
| 4 | normalizedCode | String | UQ | No | CODE123 | Stores normalized code. @unique |
| 5 | status | PromotionStatus | IDX | No | DRAFT | Current workflow or lifecycle status. @default(DRAFT) |
| 6 | isActive | Boolean | - | No | false | Active/inactive flag. @default(false) |
| 7 | discountType | DiscountType | - | No | PERCENTAGE | Enum value from DiscountType (PERCENTAGE, FIXED_AMOUNT). - |
| 8 | discountValue | DecimalDecimal(12, 2) | - | No | 0.00 | Monetary/decimal value for discount value. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 9 | maxDiscountAmount | Decimal?Decimal(12, 2) | - | Yes | 0.00 | Monetary/decimal value for max discount amount. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 10 | minOrderValue | Decimal?Decimal(12, 2) | - | Yes | 0.00 | Monetary/decimal value for min order value. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 11 | applicability | CouponApplicability | - | No | ALL_SELLER_PRODUCTS | Enum value from CouponApplicability (ALL_SELLER_PRODUCTS, SPECIFIC_PRODUCTS, CATEGORY). @default(ALL_SELLER_PRODUCTS) |
| 12 | categoryId | String? | FKIDX | Yes | uuid | Foreign key reference to Category.id. - |
| 13 | startAt | DateTime | IDX | No | now() | Date/time value for start at. - |
| 14 | endAt | DateTime | - | No | now() | Date/time value for end at. - |
| 15 | maxRedemptions | Int? | - | Yes | 0 | Stores max redemptions. - |
| 16 | maxRedemptionsPerBuyer | Int? | - | Yes | 0 | Stores max redemptions per buyer. - |
| 17 | totalRedemptions | Int | - | No | 0 | Stores total redemptions. @default(0) |
| 18 | totalDiscountAmount | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for total discount amount. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 19 | isDeleted | Boolean | - | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 20 | deletedAt | DateTime? | - | Yes | now() | Timestamp when the record was soft-deleted. - |
| 21 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 22 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 23 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 24 | category | Category? | REL | Yes | Category | Virtual Prisma relation to Category. @relation(fields: [categoryId], references: [id]) |
| 25 | products | CouponProduct[] | REL | No | CouponProduct[] | Virtual Prisma back-relation containing related CouponProduct records. - |
| 26 | clips | CouponClip[] | REL | No | CouponClip[] | Virtual Prisma back-relation containing related CouponClip records. - |
| 27 | redemptions | CouponRedemption[] | REL | No | CouponRedemption[] | Virtual Prisma back-relation containing related CouponRedemption records. - |
Table 14 / Deals & Coupons
14) Table Name: CouponProduct
Links coupons to specific products or variants when coupon applicability is specific-products based.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | couponId | String | FKUQ* | No | uuid | Foreign key reference to Coupon.id. - |
| 3 | productId | String | FKUQ*IDX | No | uuid | Foreign key reference to Product.id. - |
| 4 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 5 | coupon | Coupon | REL | No | Coupon | Virtual Prisma relation to Coupon. @relation(fields: [couponId], references: [id], onDelete: Cascade) |
| 6 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id]) |
Table 15 / Deals & Coupons
15) Table Name: CouponClip
Tracks buyers who saved or clipped a coupon before checkout.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | couponId | String | FKUQ* | No | uuid | Foreign key reference to Coupon.id. - |
| 3 | buyerId | String | FKUQ*IDX | No | uuid | Foreign key reference to User.id. - |
| 4 | productId | String? | FK | Yes | uuid | Foreign key reference to Product.id. - |
| 5 | isActive | Boolean | - | No | true | Active/inactive flag. @default(true) |
| 6 | clippedAt | DateTime | IDX | No | now() | Date/time value for clipped at. @default(now()) |
| 7 | coupon | Coupon | REL | No | Coupon | Virtual Prisma relation to Coupon. @relation(fields: [couponId], references: [id], onDelete: Cascade) |
| 8 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("CouponClipBuyer", fields: [buyerId], references: [id]) |
| 9 | product | Product? | REL | Yes | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id]) |
Table 16 / Deals & Coupons
16) Table Name: CouponRedemption
Tracks reserved, applied, released or cancelled coupon usage on orders.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | couponId | String | FKIDX | No | uuid | Foreign key reference to Coupon.id. - |
| 3 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 4 | orderId | String? | FKIDX | Yes | uuid | Foreign key reference to Order.id. - |
| 5 | sellerOrderId | String? | FKIDX | Yes | uuid | Foreign key reference to SellerOrder.id. - |
| 6 | status | CouponRedemptionStatus | IDX | No | RESERVED | Current workflow or lifecycle status. @default(RESERVED) |
| 7 | reservationKey | String? | UQ | Yes | text | Stores reservation key. @unique |
| 8 | discountAmount | DecimalDecimal(12, 2) | - | No | 0.00 | Monetary/decimal value for discount amount. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 9 | reservedAt | DateTime | - | No | now() | Date/time value for reserved at. @default(now()) |
| 10 | redeemedAt | DateTime? | - | Yes | now() | Date/time value for redeemed at. - |
| 11 | releasedAt | DateTime? | - | Yes | now() | Date/time value for released at. - |
| 12 | coupon | Coupon | REL | No | Coupon | Virtual Prisma relation to Coupon. @relation(fields: [couponId], references: [id]) |
| 13 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("CouponRedemptionBuyer", fields: [buyerId], references: [id]) |
| 14 | order | Order? | REL | Yes | Order | Virtual Prisma relation to Order. @relation(fields: [orderId], references: [id]) |
| 15 | sellerOrder | SellerOrder? | REL | Yes | SellerOrder | Virtual Prisma relation to SellerOrder. @relation(fields: [sellerOrderId], references: [id]) |
Table 17 / Countries
17) Table Name: Country
Master table for active countries and sorting order.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | name | String | IDX | No | Sample Name | Display name. - |
| 3 | code | String | UQ | No | CODE123 | Stores code. @unique |
| 4 | isActive | Boolean | IDX | No | true | Active/inactive flag. @default(true) |
| 5 | sortOrder | Int | - | No | 0 | Stores sort order. @default(0) |
| 6 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 7 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
Table 18 / Engagement & Messaging
18) Table Name: SellerRating
Stores buyer ratings for sellers after order completion.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 3 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 4 | sellerOrderId | String | UQFK | No | uuid | Foreign key reference to SellerOrder.id. @unique |
| 5 | stars | Int | - | No | 0 | Stores stars. - |
| 6 | feedback | String? | - | Yes | text | Monetary/decimal value for feedback. - |
| 7 | replyText | String? | - | Yes | text | Stores reply text. - |
| 8 | repliedAt | DateTime? | - | Yes | now() | Date/time value for replied at. - |
| 9 | status | ReviewStatus | IDX | No | PUBLISHED | Current workflow or lifecycle status. @default(PUBLISHED) |
| 10 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 11 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 12 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 13 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("SellerRatingBuyer", fields: [buyerId], references: [id]) |
| 14 | sellerOrder | SellerOrder | REL | No | SellerOrder | Virtual Prisma relation to SellerOrder. @relation(fields: [sellerOrderId], references: [id]) |
Table 19 / Engagement & Messaging
19) Table Name: ProductReview
Stores buyer product reviews, moderation status and seller replies.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | productId | String | FKIDX | No | uuid | Foreign key reference to Product.id. - |
| 3 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 4 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 5 | sellerOrderId | String? | FK | Yes | uuid | Foreign key reference to SellerOrder.id. - |
| 6 | orderItemId | String? | FKIDX | Yes | uuid | Foreign key reference to OrderItem.id. - |
| 7 | stars | Int | - | No | 0 | Stores stars. - |
| 8 | title | String? | - | Yes | text | Display title. - |
| 9 | comment | String? | - | Yes | text | Stores comment. - |
| 10 | mediaPublicIds | String[] | - | No | text | Stores media public ids. - |
| 11 | sellerReplyText | String? | - | Yes | text | Stores seller reply text. - |
| 12 | sellerRepliedAt | DateTime? | - | Yes | now() | Date/time value for seller replied at. - |
| 13 | isVerifiedPurchase | Boolean | - | No | false | Boolean flag for is verified purchase. @default(false) |
| 14 | status | ReviewStatus | IDX | No | PUBLISHED | Current workflow or lifecycle status. @default(PUBLISHED) |
| 15 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 16 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 17 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 18 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id]) |
| 19 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 20 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("ProductReviewBuyer", fields: [buyerId], references: [id]) |
| 21 | sellerOrder | SellerOrder? | REL | Yes | SellerOrder | Virtual Prisma relation to SellerOrder. @relation(fields: [sellerOrderId], references: [id]) |
| 22 | orderItem | OrderItem? | REL | Yes | OrderItem | Virtual Prisma relation to OrderItem. @relation(fields: [orderItemId], references: [id]) |
| 23 | helpfulVotes | ReviewHelpfulVote[] | REL | No | ReviewHelpfulVote[] | Virtual Prisma back-relation containing related ReviewHelpfulVote records. - |
Table 20 / Engagement & Messaging
20) Table Name: ReviewHelpfulVote
Tracks helpful/not-helpful votes on product reviews.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | reviewId | String | FKUQ* | No | uuid | Foreign key reference to ProductReview.id. - |
| 3 | buyerId | String | FKUQ*IDX | No | uuid | Foreign key reference to User.id. - |
| 4 | helpful | Boolean | - | No | false | Stores helpful. - |
| 5 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 6 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 7 | review | ProductReview | REL | No | ProductReview | Virtual Prisma relation to ProductReview. @relation(fields: [reviewId], references: [id], onDelete: Cascade) |
| 8 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("ReviewHelpfulVoteBuyer", fields: [buyerId], references: [id]) |
Table 21 / Engagement & Messaging
21) Table Name: ProductQuestion
Stores buyer questions asked on product detail pages.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | productId | String | FKIDX | No | uuid | Foreign key reference to Product.id. - |
| 3 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 4 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 5 | questionText | String | - | No | text | Stores question text. - |
| 6 | status | QuestionStatus | IDX | No | UNANSWERED | Current workflow or lifecycle status. @default(UNANSWERED) |
| 7 | isPublic | Boolean | IDX | No | false | Boolean flag for is public. @default(false) |
| 8 | reportedAt | DateTime? | - | Yes | now() | Date/time value for reported at. - |
| 9 | reportReason | String? | - | Yes | text | Stores report reason. - |
| 10 | isDeleted | Boolean | - | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 11 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 12 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 13 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id]) |
| 14 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 15 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("ProductQuestionBuyer", fields: [buyerId], references: [id]) |
| 16 | answer | ProductAnswer? | REL | Yes | ProductAnswer | Virtual Prisma relation to ProductAnswer. - |
Table 22 / Engagement & Messaging
22) Table Name: ProductAnswer
Stores seller answers against product questions.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | questionId | String | UQFK | No | uuid | Foreign key reference to ProductQuestion.id. @unique |
| 3 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 4 | answerText | String | - | No | text | Stores answer text. - |
| 5 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 6 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 7 | question | ProductQuestion | REL | No | ProductQuestion | Virtual Prisma relation to ProductQuestion. @relation(fields: [questionId], references: [id], onDelete: Cascade) |
| 8 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
Table 23 / Engagement & Messaging
23) Table Name: ConversationThread
Represents a chat thread between seller and buyer around a product/order context.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerOrderId | String | UQFK | No | uuid | Foreign key reference to SellerOrder.id. @unique |
| 3 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 4 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 5 | lastMessagePreview | String? | - | Yes | text | Stores last message preview. - |
| 6 | lastMessageAt | DateTime? | IDX | Yes | now() | Date/time value for last message at. - |
| 7 | hasUnreadBySeller | Boolean | - | No | false | Stores has unread by seller. @default(false) |
| 8 | hasUnreadByBuyer | Boolean | - | No | false | Stores has unread by buyer. @default(false) |
| 9 | unreadSellerCount | Int | - | No | 0 | Stores unread seller count. @default(0) |
| 10 | unreadBuyerCount | Int | - | No | 0 | Stores unread buyer count. @default(0) |
| 11 | isClosed | Boolean | - | No | false | Boolean flag for is closed. @default(false) |
| 12 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 13 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 14 | sellerOrder | SellerOrder | REL | No | SellerOrder | Virtual Prisma relation to SellerOrder. @relation(fields: [sellerOrderId], references: [id]) |
| 15 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("BuyerConversationThreads", fields: [buyerId], references: [id]) |
| 16 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 17 | messages | Message[] | REL | No | Message[] | Virtual Prisma back-relation containing related Message records. - |
Table 24 / Engagement & Messaging
24) Table Name: Message
Stores individual chat messages, including text or image messages.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | threadId | String | FKIDX | No | uuid | Foreign key reference to ConversationThread.id. - |
| 3 | senderId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 4 | receiverId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 5 | messageType | MessageType | - | No | TEXT | Enum value from MessageType (TEXT, IMAGE). @default(TEXT) |
| 6 | text | String? | - | Yes | text | Stores text. - |
| 7 | imagePublicId | String? | - | Yes | uuid | Identifier reference for image public. - |
| 8 | cloudinaryUrl | String? | - | Yes | https://... | Stores cloudinary url. - |
| 9 | readAt | DateTime? | IDX | Yes | now() | Date/time value for read at. - |
| 10 | isDeleted | Boolean | - | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 11 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 12 | thread | ConversationThread | REL | No | ConversationThread | Virtual Prisma relation to ConversationThread. @relation(fields: [threadId], references: [id], onDelete: Cascade) |
| 13 | sender | User | REL | No | User | Virtual Prisma relation to User. @relation("MessageSender", fields: [senderId], references: [id]) |
| 14 | receiver | User | REL | No | User | Virtual Prisma relation to User. @relation("MessageReceiver", fields: [receiverId], references: [id]) |
Table 25 / Notifications
25) Table Name: Notification
Stores in-app notifications for account, order, payout and engagement events.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | recipientId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 3 | type | NotificationType | IDX | No | ORDER_CREATED | Enum value from NotificationType (ORDER_CREATED, ORDER_STATUS_CHANGED, WALLET_CREDITED, PAYOUT_SUCCEEDED, PAYOUT_FAILED, BRAND_APPROVED...). - |
| 4 | title | String | - | No | text | Display title. - |
| 5 | body | String? | - | Yes | text | Stores body. - |
| 6 | data | Json? | - | Yes | {} | Flexible JSON payload for notification/event data. - |
| 7 | readAt | DateTime? | IDX | Yes | now() | Date/time value for read at. - |
| 8 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 9 | recipient | User | REL | No | User | Virtual Prisma relation to User. @relation("NotificationRecipient", fields: [recipientId], references: [id]) |
Table 26 / Notifications
26) Table Name: ProcessedWebhook
Keeps webhook event ids to make external provider callbacks idempotent.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | eventId | String | UQ | No | uuid | Identifier reference for event. @unique |
| 3 | source | String | IDX | No | text | Stores source. - |
| 4 | eventType | String | - | No | text | Stores event type. - |
| 5 | entityId | String? | - | Yes | uuid | Identifier reference for entity. - |
| 6 | payload | Json? | - | Yes | {} | Raw or structured external provider/webhook payload. - |
| 7 | processedAt | DateTime | IDX | No | now() | Date/time value for processed at. @default(now()) |
Table 27 / Orders & Returns
27) Table Name: Order
Parent buyer order with payment, totals, addresses and coupon discount summary.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | orderNumber | String | UQ | No | text | Stores order number. @unique |
| 3 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 4 | buyerNameSnapshot | String? | - | Yes | Sample Name | Stores buyer name snapshot. - |
| 5 | paymentStatus | PaymentStatus | IDX | No | PENDING | Enum value from PaymentStatus (PENDING, CAPTURED, FAILED, REFUND_INITIATED, REFUNDED, PARTIALLY_REFUNDED). @default(PENDING) |
| 6 | razorpayOrderId | String? | UQ* | Yes | uuid | Identifier reference for razorpay order. - |
| 7 | razorpayPaymentId | String? | - | Yes | uuid | Identifier reference for razorpay payment. - |
| 8 | paymentFailureReason | String? | - | Yes | text | Stores payment failure reason. - |
| 9 | paidAt | DateTime? | - | Yes | now() | Date/time value for paid at. - |
| 10 | currency | String | - | No | "INR" | Currency code for monetary values. @default("INR") |
| 11 | subtotalAmount | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for subtotal amount. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 12 | discountAmount | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for discount amount. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 13 | shippingAmount | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for shipping amount. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 14 | taxAmount | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for tax amount. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 15 | payableAmount | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for payable amount. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 16 | shippingAddress | Json? | - | Yes | {} | Stores shipping address. - |
| 17 | billingAddress | Json? | - | Yes | {} | Stores billing address. - |
| 18 | isDeleted | Boolean | - | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 19 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 20 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 21 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("BuyerOrders", fields: [buyerId], references: [id]) |
| 22 | sellerOrders | SellerOrder[] | REL | No | SellerOrder[] | Virtual Prisma back-relation containing related SellerOrder records. - |
| 23 | couponRedemptions | CouponRedemption[] | REL | No | CouponRedemption[] | Virtual Prisma back-relation containing related CouponRedemption records. - |
Table 28 / Orders & Returns
28) Table Name: SellerOrder
Seller-level split of an order, including fulfillment, commission and wallet settlement state.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | orderId | String | FKUQ* | No | uuid | Foreign key reference to Order.id. - |
| 3 | sellerId | String | FKUQ*IDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 4 | sellerOrderNumber | String | UQ | No | text | Stores seller order number. @unique |
| 5 | status | OrderStatus | IDX | No | PENDING_SELLER_APPROVAL | Current workflow or lifecycle status. @default(PENDING_SELLER_APPROVAL) |
| 6 | rejectionReason | String? | - | Yes | text | Stores rejection reason. - |
| 7 | autoAcceptDeadlineAt | DateTime? | - | Yes | now() | Date/time value for auto accept deadline at. - |
| 8 | trackingNumber | String? | - | Yes | text | Stores tracking number. - |
| 9 | courierName | String? | - | Yes | Sample Name | Stores courier name. - |
| 10 | courierTrackingUrl | String? | - | Yes | https://... | Stores courier tracking url. - |
| 11 | sellerSubtotal | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for seller subtotal. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 12 | sellerDiscount | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for seller discount. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 13 | platformFeeRate | DecimalDecimal(5, 2) | - | No | 0 | Monetary/decimal value for platform fee rate. @default(0) @db.Decimal(5, 2) | DB: Decimal(5, 2) |
| 14 | platformFeeAmount | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for platform fee amount. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 15 | sellerProceeds | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for seller proceeds. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 16 | acceptedAt | DateTime? | - | Yes | now() | Date/time value for accepted at. - |
| 17 | autoAcceptedAt | DateTime? | - | Yes | now() | Date/time value for auto accepted at. - |
| 18 | shippedAt | DateTime? | - | Yes | now() | Date/time value for shipped at. - |
| 19 | outForDeliveryAt | DateTime? | - | Yes | now() | Date/time value for out for delivery at. - |
| 20 | deliveredAt | DateTime? | - | Yes | now() | Date/time value for delivered at. - |
| 21 | closedAt | DateTime? | - | Yes | now() | Date/time value for closed at. - |
| 22 | cancelledAt | DateTime? | - | Yes | now() | Date/time value for cancelled at. - |
| 23 | refundId | String? | - | Yes | uuid | Identifier reference for refund. - |
| 24 | refundStatus | PaymentStatus? | - | Yes | PENDING | Enum value from PaymentStatus (PENDING, CAPTURED, FAILED, REFUND_INITIATED, REFUNDED, PARTIALLY_REFUNDED). - |
| 25 | refundInitiatedAt | DateTime? | - | Yes | now() | Date/time value for refund initiated at. - |
| 26 | refundCompletedAt | DateTime? | - | Yes | now() | Date/time value for refund completed at. - |
| 27 | creditedAt | DateTime? | - | Yes | now() | Date/time value for credited at. - |
| 28 | isDeleted | Boolean | - | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 29 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 30 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 31 | order | Order | REL | No | Order | Virtual Prisma relation to Order. @relation(fields: [orderId], references: [id]) |
| 32 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 33 | items | OrderItem[] | REL | No | OrderItem[] | Virtual Prisma back-relation containing related OrderItem records. - |
| 34 | statusHistory | OrderStatusHistory[] | REL | No | OrderStatusHistory[] | Virtual Prisma back-relation containing related OrderStatusHistory records. - |
| 35 | returnRequests | ReturnRequest[] | REL | No | ReturnRequest[] | Virtual Prisma back-relation containing related ReturnRequest records. - |
| 36 | walletTransactions | WalletTransaction[] | REL | No | WalletTransaction[] | Virtual Prisma back-relation containing related WalletTransaction records. - |
| 37 | walletDebts | SellerWalletDebt[] | REL | No | SellerWalletDebt[] | Virtual Prisma back-relation containing related SellerWalletDebt records. - |
| 38 | sellerRating | SellerRating? | REL | Yes | SellerRating | Virtual Prisma relation to SellerRating. - |
| 39 | productReviews | ProductReview[] | REL | No | ProductReview[] | Virtual Prisma back-relation containing related ProductReview records. - |
| 40 | conversationThread | ConversationThread? | REL | Yes | ConversationThread | Virtual Prisma relation to ConversationThread. - |
| 41 | couponRedemptions | CouponRedemption[] | REL | No | CouponRedemption[] | Virtual Prisma back-relation containing related CouponRedemption records. - |
Table 29 / Orders & Returns
29) Table Name: OrderItem
Line items inside seller orders, with product/variant snapshots, tax, discount and return flags.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerOrderId | String | FKIDX | No | uuid | Foreign key reference to SellerOrder.id. - |
| 3 | productId | String | FKIDX | No | uuid | Foreign key reference to Product.id. - |
| 4 | variantId | String? | FKIDX | Yes | uuid | Foreign key reference to ProductVariant.id. - |
| 5 | productName | String | - | No | Sample Name | Stores product name. - |
| 6 | sku | String | - | No | text | Seller stock keeping unit for inventory tracking. - |
| 7 | variantLabel | String? | - | Yes | text | Stores variant label. - |
| 8 | imagePublicId | String? | - | Yes | uuid | Identifier reference for image public. - |
| 9 | unitPrice | DecimalDecimal(12, 2) | - | No | 0.00 | Monetary/decimal value for unit price. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 10 | mrp | DecimalDecimal(12, 2) | - | No | 0.00 | Maximum retail price. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 11 | quantity | Int | - | No | 0 | Quantity/stock count. - |
| 12 | gstRate | Decimal?Decimal(5, 2) | - | Yes | 0.00 | Monetary/decimal value for gst rate. @db.Decimal(5, 2) | DB: Decimal(5, 2) |
| 13 | taxAmount | DecimalDecimal(12, 2) | - | No | 0 | Monetary/decimal value for tax amount. @default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 14 | discountAmount | DecimalDecimal(12, 2) | - | No | 0 | Monetary/decimal value for discount amount. @default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 15 | lineTotal | DecimalDecimal(14, 2) | - | No | 0.00 | Monetary/decimal value for line total. @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 16 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 17 | sellerOrder | SellerOrder | REL | No | SellerOrder | Virtual Prisma relation to SellerOrder. @relation(fields: [sellerOrderId], references: [id], onDelete: Cascade) |
| 18 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id]) |
| 19 | variant | ProductVariant? | REL | Yes | ProductVariant | Virtual Prisma relation to ProductVariant. @relation(fields: [variantId], references: [id]) |
| 20 | returnRequests | ReturnRequest[] | REL | No | ReturnRequest[] | Virtual Prisma back-relation containing related ReturnRequest records. - |
| 21 | productReviews | ProductReview[] | REL | No | ProductReview[] | Virtual Prisma back-relation containing related ProductReview records. - |
| 22 | walletTransactions | WalletTransaction[] | REL | No | WalletTransaction[] | Virtual Prisma back-relation containing related WalletTransaction records. - |
Table 30 / Orders & Returns
30) Table Name: OrderStatusHistory
Timeline table for order status changes with actor and optional notes.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerOrderId | String | FKIDX | No | uuid | Foreign key reference to SellerOrder.id. - |
| 3 | fromStatus | OrderStatus? | - | Yes | PENDING_SELLER_APPROVAL | Enum value from OrderStatus (PENDING_SELLER_APPROVAL, PROCESSING, SHIPPED, OUT_FOR_DELIVERY, DELIVERED, RETURN_INITIATED...). - |
| 4 | toStatus | OrderStatus | IDX | No | PENDING_SELLER_APPROVAL | Enum value from OrderStatus (PENDING_SELLER_APPROVAL, PROCESSING, SHIPPED, OUT_FOR_DELIVERY, DELIVERED, RETURN_INITIATED...). - |
| 5 | actorUserId | String? | - | Yes | uuid | Identifier reference for actor user. - |
| 6 | note | String? | - | Yes | text | Stores note. - |
| 7 | metadata | Json? | - | Yes | {} | Flexible JSON metadata for extra provider or audit information. - |
| 8 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 9 | sellerOrder | SellerOrder | REL | No | SellerOrder | Virtual Prisma relation to SellerOrder. @relation(fields: [sellerOrderId], references: [id], onDelete: Cascade) |
Table 31 / Orders & Returns
31) Table Name: ReturnRequest
Stores return/refund workflow, pickup, inspection, refund and wallet recovery details.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerOrderId | String | FKIDX | No | uuid | Foreign key reference to SellerOrder.id. - |
| 3 | orderItemId | String? | FK | Yes | uuid | Foreign key reference to OrderItem.id. - |
| 4 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 5 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 6 | status | ReturnRequestStatus | IDX | No | REQUESTED | Current workflow or lifecycle status. @default(REQUESTED) |
| 7 | reason | String | - | No | text | Stores reason. - |
| 8 | reasonDetail | String? | - | Yes | text | Stores reason detail. - |
| 9 | imageUrls | String[] | - | No | [] | Stores image urls. @default([]) |
| 10 | returnTrackingNumber | String? | - | Yes | text | Stores return tracking number. - |
| 11 | returnCourierName | String? | - | Yes | Sample Name | Stores return courier name. - |
| 12 | refundAmount | Decimal?Decimal(12, 2) | - | Yes | 0.00 | Monetary/decimal value for refund amount. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 13 | razorpayRefundId | String? | - | Yes | uuid | Identifier reference for razorpay refund. - |
| 14 | adminNote | String? | - | Yes | text | Stores admin note. - |
| 15 | rejectionReason | String? | - | Yes | text | Stores rejection reason. - |
| 16 | investigationEndsAt | DateTime? | - | Yes | now() | Date/time value for investigation ends at. - |
| 17 | isDeleted | Boolean | - | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 18 | requestedAt | DateTime | IDX | No | now() | Date/time value for requested at. @default(now()) |
| 19 | resolvedAt | DateTime? | - | Yes | now() | Date/time value for resolved at. - |
| 20 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 21 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 22 | sellerOrder | SellerOrder | REL | No | SellerOrder | Virtual Prisma relation to SellerOrder. @relation(fields: [sellerOrderId], references: [id]) |
| 23 | orderItem | OrderItem? | REL | Yes | OrderItem | Virtual Prisma relation to OrderItem. @relation(fields: [orderItemId], references: [id]) |
| 24 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("ReturnRequestBuyer", fields: [buyerId], references: [id]) |
| 25 | seller | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 26 | walletDebts | SellerWalletDebt[] | REL | No | SellerWalletDebt[] | Virtual Prisma back-relation containing related SellerWalletDebt records. - |
Table 32 / Catalog & Inventory
32) Table Name: Category
Hierarchical product category tree with seller-proposed category support.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | parentId | String? | FKIDX | Yes | uuid | Foreign key reference to Category.id. - |
| 3 | name | String | - | No | Sample Name | Display name. - |
| 4 | slug | String | UQ | No | sample-slug | SEO-friendly unique URL identifier. @unique |
| 5 | description | String? | - | Yes | text | Longer display/SEO description. - |
| 6 | status | CategoryStatus | IDX | No | ACTIVE | Current workflow or lifecycle status. @default(ACTIVE) |
| 7 | isAdminManaged | Boolean | - | No | true | Boolean flag for is admin managed. @default(true) |
| 8 | proposedBySellerId | String? | FKIDX | Yes | uuid | Foreign key reference to SellerProfile.id. - |
| 9 | rejectMessage | String? | - | Yes | text | Stores reject message. - |
| 10 | sortOrder | Int | - | No | 0 | Stores sort order. @default(0) |
| 11 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 12 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 13 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 14 | parent | Category? | REL | Yes | Category | Virtual Prisma relation to Category. @relation("CategoryTree", fields: [parentId], references: [id]) |
| 15 | children | Category[] | REL | No | Category[] | Virtual Prisma back-relation containing related Category records. @relation("CategoryTree") |
| 16 | proposedBySeller | SellerProfile? | REL | Yes | SellerProfile | Virtual Prisma relation to SellerProfile. @relation("CategoryProposedBySeller", fields: [proposedBySellerId], references: [id]) |
| 17 | products | Product[] | REL | No | Product[] | Virtual Prisma back-relation containing related Product records. - |
| 18 | tradeMarks | TradMark[] | REL | No | TradMark[] | Virtual Prisma back-relation containing related TradMark records. - |
| 19 | hsnCodes | HsnCode[] | REL | No | HsnCode[] | Virtual Prisma back-relation containing related HsnCode records. - |
| 20 | coupons | Coupon[] | REL | No | Coupon[] | Virtual Prisma back-relation containing related Coupon records. - |
Table 33 / Catalog & Inventory
33) Table Name: HsnCode
Stores HSN/GST code data attached to categories and products.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | code | String | UQ | No | CODE123 | Stores code. @unique |
| 3 | description | String? | - | Yes | text | Longer display/SEO description. - |
| 4 | gstRate | DecimalDecimal(5, 2) | - | No | 0.00 | Monetary/decimal value for gst rate. @db.Decimal(5, 2) | DB: Decimal(5, 2) |
| 5 | categoryId | String? | FKIDX | Yes | uuid | Foreign key reference to Category.id. - |
| 6 | isActive | Boolean | IDX | No | true | Active/inactive flag. @default(true) |
| 7 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 8 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 9 | category | Category? | REL | Yes | Category | Virtual Prisma relation to Category. @relation(fields: [categoryId], references: [id]) |
| 10 | products | Product[] | REL | No | Product[] | Virtual Prisma back-relation containing related Product records. - |
Table 34 / Catalog & Inventory
34) Table Name: Product
Core product listing table with seller, category, pricing, SEO, delivery and status metadata.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 3 | categoryId | String | FKIDX | No | uuid | Foreign key reference to Category.id. - |
| 4 | tradeMarkId | String? | FKIDX | Yes | uuid | Foreign key reference to TradMark.id. - |
| 5 | hsnCodeId | String? | FKIDX | Yes | uuid | Foreign key reference to HsnCode.id. - |
| 6 | itemName | String | - | No | Sample Name | Stores item name. - |
| 7 | slug | String | UQ | No | sample-slug | SEO-friendly unique URL identifier. @unique |
| 8 | descriptionHtml | String | - | No | text | Stores description html. - |
| 9 | bulletPoints | String[] | - | No | text | Stores bullet points. - |
| 10 | targetGender | TargetGender | - | No | MALE | Enum value from TargetGender (MALE, FEMALE, UNISEX). - |
| 11 | itemCondition | ProductCondition | - | No | NEW | Enum value from ProductCondition (NEW, REPLACE, REUSE). @default(NEW) |
| 12 | material | String? | - | Yes | text | Stores material. - |
| 13 | manufacturer | String? | - | Yes | text | Stores manufacturer. - |
| 14 | countryOfOrigin | String? | - | Yes | text | Stores country of origin. - |
| 15 | numberOfItemsPerOrder | Int | - | No | 1 | Stores number of items per order. @default(1) |
| 16 | weightKg | Decimal?Decimal(10, 3) | - | Yes | 0.00 | Monetary/decimal value for weight kg. @db.Decimal(10, 3) | DB: Decimal(10, 3) |
| 17 | lengthCm | Decimal?Decimal(10, 2) | - | Yes | 0.00 | Monetary/decimal value for length cm. @db.Decimal(10, 2) | DB: Decimal(10, 2) |
| 18 | widthCm | Decimal?Decimal(10, 2) | - | Yes | 0.00 | Monetary/decimal value for width cm. @db.Decimal(10, 2) | DB: Decimal(10, 2) |
| 19 | heightCm | Decimal?Decimal(10, 2) | - | Yes | 0.00 | Monetary/decimal value for height cm. @db.Decimal(10, 2) | DB: Decimal(10, 2) |
| 20 | sku | String | UQ | No | text | Seller stock keeping unit for inventory tracking. @unique |
| 21 | status | ProductStatus | IDX | No | DRAFT | Current workflow or lifecycle status. @default(DRAFT) |
| 22 | actualStock | Int | - | No | 0 | Stores actual stock. @default(0) |
| 23 | effectiveStock | Int | - | No | 0 | Stores effective stock. @default(0) |
| 24 | price | DecimalDecimal(12, 2) | - | No | 0.00 | Price amount. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 25 | mrp | DecimalDecimal(12, 2) | - | No | 0.00 | Maximum retail price. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 26 | gstRateSnapshot | Decimal?Decimal(5, 2) | - | Yes | 0.00 | Monetary/decimal value for gst rate snapshot. @db.Decimal(5, 2) | DB: Decimal(5, 2) |
| 27 | seoTitle | String? | - | Yes | text | Stores seo title. - |
| 28 | seoDescription | String? | - | Yes | text | Stores seo description. - |
| 29 | seoKeywords | String[] | - | No | text | Stores seo keywords. - |
| 30 | videoPublicId | String? | - | Yes | uuid | Identifier reference for video public. - |
| 31 | videoUrl | String? | - | Yes | https://... | Stores video url. - |
| 32 | viewCount | Int | - | No | 0 | Stores view count. @default(0) |
| 33 | unitsSold | Int | - | No | 0 | Stores units sold. @default(0) |
| 34 | salesAmount | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for sales amount. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 35 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 36 | deletedAt | DateTime? | - | Yes | now() | Timestamp when the record was soft-deleted. - |
| 37 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 38 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 39 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 40 | category | Category | REL | No | Category | Virtual Prisma relation to Category. @relation(fields: [categoryId], references: [id]) |
| 41 | tradeMark | TradMark? | REL | Yes | TradMark | Virtual Prisma relation to TradMark. @relation(fields: [tradeMarkId], references: [id]) |
| 42 | hsnCode | HsnCode? | REL | Yes | HsnCode | Virtual Prisma relation to HsnCode. @relation(fields: [hsnCodeId], references: [id]) |
| 43 | variants | ProductVariant[] | REL | No | ProductVariant[] | Virtual Prisma back-relation containing related ProductVariant records. - |
| 44 | images | ProductImage[] | REL | No | ProductImage[] | Virtual Prisma back-relation containing related ProductImage records. - |
| 45 | aplusContents | AplusContent[] | REL | No | AplusContent[] | Virtual Prisma back-relation containing related AplusContent records. - |
| 46 | views | ProductView[] | REL | No | ProductView[] | Virtual Prisma back-relation containing related ProductView records. - |
| 47 | inventoryTransactions | InventoryTransaction[] | REL | No | InventoryTransaction[] | Virtual Prisma back-relation containing related InventoryTransaction records. - |
| 48 | stockBackAlerts | StockBackAlert[] | REL | No | StockBackAlert[] | Virtual Prisma back-relation containing related StockBackAlert records. - |
| 49 | cartItems | CartItem[] | REL | No | CartItem[] | Virtual Prisma back-relation containing related CartItem records. - |
| 50 | wishlistItems | WishlistItem[] | REL | No | WishlistItem[] | Virtual Prisma back-relation containing related WishlistItem records. - |
| 51 | orderItems | OrderItem[] | REL | No | OrderItem[] | Virtual Prisma back-relation containing related OrderItem records. - |
| 52 | dealProducts | DealProduct[] | REL | No | DealProduct[] | Virtual Prisma back-relation containing related DealProduct records. - |
| 53 | couponProducts | CouponProduct[] | REL | No | CouponProduct[] | Virtual Prisma back-relation containing related CouponProduct records. - |
| 54 | couponClips | CouponClip[] | REL | No | CouponClip[] | Virtual Prisma back-relation containing related CouponClip records. - |
| 55 | productReviews | ProductReview[] | REL | No | ProductReview[] | Virtual Prisma back-relation containing related ProductReview records. - |
| 56 | questions | ProductQuestion[] | REL | No | ProductQuestion[] | Virtual Prisma back-relation containing related ProductQuestion records. - |
Table 35 / Catalog & Inventory
35) Table Name: ProductVariant
Stores SKU-level variation data such as color, size, price and stock.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | productId | String | FKIDX | No | uuid | Foreign key reference to Product.id. - |
| 3 | sku | String? | UQ | Yes | text | Seller stock keeping unit for inventory tracking. @unique |
| 4 | size | String? | - | Yes | text | Stores size. - |
| 5 | color | String? | - | Yes | text | Stores color. - |
| 6 | material | String? | - | Yes | text | Stores material. - |
| 7 | actualStock | Int | - | No | 0 | Stores actual stock. @default(0) |
| 8 | effectiveStock | Int | - | No | 0 | Stores effective stock. @default(0) |
| 9 | price | DecimalDecimal(12, 2) | - | No | 0.00 | Price amount. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 10 | mrp | DecimalDecimal(12, 2) | - | No | 0.00 | Maximum retail price. @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 11 | isDefault | Boolean | - | No | false | Marks this record as the default option. @default(false) |
| 12 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 13 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 14 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 15 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id], onDelete: Cascade) |
| 16 | orderItems | OrderItem[] | REL | No | OrderItem[] | Virtual Prisma back-relation containing related OrderItem records. - |
| 17 | dealProducts | DealProduct[] | REL | No | DealProduct[] | Virtual Prisma back-relation containing related DealProduct records. - |
| 18 | inventoryTransactions | InventoryTransaction[] | REL | No | InventoryTransaction[] | Virtual Prisma back-relation containing related InventoryTransaction records. - |
| 19 | stockBackAlerts | StockBackAlert[] | REL | No | StockBackAlert[] | Virtual Prisma back-relation containing related StockBackAlert records. - |
| 20 | cartItems | CartItem[] | REL | No | CartItem[] | Virtual Prisma back-relation containing related CartItem records. - |
| 21 | wishlistItems | WishlistItem[] | REL | No | WishlistItem[] | Virtual Prisma back-relation containing related WishlistItem records. - |
Table 36 / Catalog & Inventory
36) Table Name: ProductImage
Stores product/variant images, Cloudinary public ids, ordering and primary image flag.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | productId | String | FKUQ*IDX | No | uuid | Foreign key reference to Product.id. - |
| 3 | publicId | String | UQ* | No | uuid | Identifier reference for public. - |
| 4 | url | String? | - | Yes | https://... | Stores url. - |
| 5 | altText | String? | - | Yes | text | Stores alt text. - |
| 6 | sortOrder | Int | UQ* | No | 0 | Stores sort order. - |
| 7 | isMain | Boolean | IDX | No | false | Boolean flag for is main. @default(false) |
| 8 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 9 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 10 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id], onDelete: Cascade) |
Table 37 / Catalog & Inventory
37) Table Name: ProductView
Tracks buyer/product view analytics for engagement and reporting.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | productId | String | FKIDX | No | uuid | Foreign key reference to Product.id. - |
| 3 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 4 | buyerId | String? | FKIDX | Yes | uuid | Foreign key reference to User.id. - |
| 5 | sessionId | String? | - | Yes | uuid | Identifier reference for session. - |
| 6 | ipHash | String? | - | Yes | text | Security-sensitive stored value; use hashing/encryption as indicated by the field name. - |
| 7 | source | String? | - | Yes | text | Stores source. - |
| 8 | viewedAt | DateTime | IDX | No | now() | Date/time value for viewed at. @default(now()) |
| 9 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id], onDelete: Cascade) |
| 10 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 11 | buyer | User? | REL | Yes | User | Virtual Prisma relation to User. @relation("ProductViewBuyer", fields: [buyerId], references: [id]) |
Table 38 / Catalog & Inventory
38) Table Name: AplusContent
Stores seller A+ content page status and language for product detail enhancement.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 3 | productId | String | FKUQ* | No | uuid | Foreign key reference to Product.id. - |
| 4 | contentName | String | - | No | Sample Name | Stores content name. - |
| 5 | language | AplusContentLanguage | UQ* | No | EN | Enum value from AplusContentLanguage (EN, HI, GU). @default(EN) |
| 6 | status | AplusContentStatus | IDX | No | DRAFT | Current workflow or lifecycle status. @default(DRAFT) |
| 7 | publishedAt | DateTime? | - | Yes | now() | Date/time value for published at. - |
| 8 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 9 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 10 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 11 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 12 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id], onDelete: Cascade) |
| 13 | blocks | AplusContentBlock[] | REL | No | AplusContentBlock[] | Virtual Prisma back-relation containing related AplusContentBlock records. - |
Table 39 / Catalog & Inventory
39) Table Name: AplusContentBlock
Stores individual A+ content blocks such as image, heading, text or video.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | contentId | String | FKUQ* | No | uuid | Foreign key reference to AplusContent.id. - |
| 3 | blockType | AplusBlockType | - | No | IMAGE | Enum value from AplusBlockType (IMAGE, HEADING, TEXT, VIDEO). - |
| 4 | sortOrder | Int | UQ* | No | 0 | Stores sort order. - |
| 5 | headingLevel | Int? | - | Yes | 0 | Stores heading level. - |
| 6 | textHtml | String? | - | Yes | text | Stores text html. - |
| 7 | mediaPublicId | String? | - | Yes | uuid | Identifier reference for media public. - |
| 8 | mediaUrl | String? | - | Yes | https://... | Stores media url. - |
| 9 | caption | String? | - | Yes | text | Stores caption. - |
| 10 | layout | String? | - | Yes | text | Stores layout. - |
| 11 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 12 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 13 | content | AplusContent | REL | No | AplusContent | Virtual Prisma relation to AplusContent. @relation(fields: [contentId], references: [id], onDelete: Cascade) |
Table 40 / Catalog & Inventory
40) Table Name: StockBackAlert
Stores buyer requests to be notified when a product/variant comes back in stock.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | productId | String | FKIDX | No | uuid | Foreign key reference to Product.id. - |
| 3 | variantId | String? | FKIDX | Yes | uuid | Foreign key reference to ProductVariant.id. - |
| 4 | buyerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 5 | notified | Boolean | IDX | No | false | Stores notified. @default(false) |
| 6 | notifiedAt | DateTime? | - | Yes | now() | Date/time value for notified at. - |
| 7 | isDeleted | Boolean | IDX | No | false | Soft-delete flag. Deleted records remain in the database for audit/history. @default(false) |
| 8 | deletedAt | DateTime? | - | Yes | now() | Timestamp when the record was soft-deleted. - |
| 9 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 10 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id], onDelete: Cascade) |
| 11 | variant | ProductVariant? | REL | Yes | ProductVariant | Virtual Prisma relation to ProductVariant. @relation(fields: [variantId], references: [id]) |
| 12 | buyer | User | REL | No | User | Virtual Prisma relation to User. @relation("StockBackAlertBuyer", fields: [buyerId], references: [id]) |
Table 41 / Catalog & Inventory
41) Table Name: InventoryTransaction
Stores immutable inventory movement history for adjustments, reservations, fulfillment and returns.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 3 | productId | String | FKIDX | No | uuid | Foreign key reference to Product.id. - |
| 4 | variantId | String? | FKIDX | Yes | uuid | Foreign key reference to ProductVariant.id. - |
| 5 | type | InventoryTransactionType | - | No | STOCK_ADJUSTMENT | Enum value from InventoryTransactionType (STOCK_ADJUSTMENT, ORDER_RESERVED, ORDER_RELEASED, ORDER_FULFILLED, RETURN_RESTOCK, PAUSE_LISTING...). - |
| 6 | quantityDelta | Int | - | No | 0 | Stores quantity delta. - |
| 7 | actualStockAfter | Int | - | No | 0 | Stores actual stock after. - |
| 8 | effectiveStockAfter | Int | - | No | 0 | Stores effective stock after. - |
| 9 | reason | String? | - | Yes | text | Stores reason. - |
| 10 | referenceType | String? | IDX | Yes | text | Stores reference type. - |
| 11 | referenceId | String? | IDX | Yes | uuid | Identifier reference for reference. - |
| 12 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 13 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 14 | product | Product | REL | No | Product | Virtual Prisma relation to Product. @relation(fields: [productId], references: [id]) |
| 15 | variant | ProductVariant? | REL | Yes | ProductVariant | Virtual Prisma relation to ProductVariant. @relation(fields: [variantId], references: [id]) |
Table 42 / Seller, Wallet & Payouts
42) Table Name: SellerProfile
Extends a user with seller KYC, bank verification, rating and business profile data.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | userId | String | UQFK | No | uuid | Foreign key reference to User.id. @unique |
| 3 | shopAddress | String? | - | Yes | text | Stores shop address. - |
| 4 | bankVerificationStatus | BankVerificationStatus | - | No | PENDING | Enum value from BankVerificationStatus (PENDING, KYC_VERIFIED, CONTACT_CREATED, FUND_ACCOUNT_CREATED, VALIDATION_INITIATED, REVERSE_PENNY_DROP_PENDING...). @default(PENDING) |
| 5 | kycRegisterName | String? | - | Yes | Sample Name | Stores kyc register name. - |
| 6 | upiRegisterName | String? | - | Yes | Sample Name | Stores upi register name. - |
| 7 | bankRegisterName | String? | - | Yes | Sample Name | Stores bank register name. - |
| 8 | cashfreeBeneficiaryId | String? | - | Yes | uuid | Identifier reference for cashfree beneficiary. - |
| 9 | technicalErrorMessage | String? | - | Yes | text | Stores technical error message. - |
| 10 | verificationFeeOwedPaise | Int | - | No | 0 | Monetary/decimal value for verification fee owed paise. @default(0) |
| 11 | encryptedPanNumber | String? | - | Yes | text | Security-sensitive stored value; use hashing/encryption as indicated by the field name. - |
| 12 | panNumberHash | String? | UQ | Yes | text | Security-sensitive stored value; use hashing/encryption as indicated by the field name. @unique |
| 13 | averageRating | DecimalDecimal(3, 2) | - | No | 0 | Monetary/decimal value for average rating. @default(0) @db.Decimal(3, 2) | DB: Decimal(3, 2) |
| 14 | ratingCount | Int | - | No | 0 | Stores rating count. @default(0) |
| 15 | reviewCount | Int | - | No | 0 | Stores review count. @default(0) |
| 16 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 17 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 18 | user | User | REL | No | User | Virtual Prisma relation to User. @relation(fields: [userId], references: [id]) |
| 19 | bankAccountDetails | SellerBankAccountDetails? | REL | Yes | SellerBankAccountDetails | Virtual Prisma relation to SellerBankAccountDetails. - |
| 20 | bankVerificationAttempts | SellerBankVerificationAttempt[] | REL | No | SellerBankVerificationAttempt[] | Virtual Prisma back-relation containing related SellerBankVerificationAttempt records. - |
| 21 | digitalWallet | SellerDigitalWallet? | REL | Yes | SellerDigitalWallet | Virtual Prisma relation to SellerDigitalWallet. - |
| 22 | products | Product[] | REL | No | Product[] | Virtual Prisma back-relation containing related Product records. - |
| 23 | productViews | ProductView[] | REL | No | ProductView[] | Virtual Prisma back-relation containing related ProductView records. - |
| 24 | proposedCategories | Category[] | REL | No | Category[] | Virtual Prisma back-relation containing related Category records. @relation("CategoryProposedBySeller") |
| 25 | sellerOrders | SellerOrder[] | REL | No | SellerOrder[] | Virtual Prisma back-relation containing related SellerOrder records. - |
| 26 | returnRequests | ReturnRequest[] | REL | No | ReturnRequest[] | Virtual Prisma back-relation containing related ReturnRequest records. - |
| 27 | sellerRatings | SellerRating[] | REL | No | SellerRating[] | Virtual Prisma back-relation containing related SellerRating records. - |
| 28 | productReviews | ProductReview[] | REL | No | ProductReview[] | Virtual Prisma back-relation containing related ProductReview records. - |
| 29 | productQuestions | ProductQuestion[] | REL | No | ProductQuestion[] | Virtual Prisma back-relation containing related ProductQuestion records. - |
| 30 | productAnswers | ProductAnswer[] | REL | No | ProductAnswer[] | Virtual Prisma back-relation containing related ProductAnswer records. - |
| 31 | payoutRequests | PayoutRequest[] | REL | No | PayoutRequest[] | Virtual Prisma back-relation containing related PayoutRequest records. - |
| 32 | walletTransactions | WalletTransaction[] | REL | No | WalletTransaction[] | Virtual Prisma back-relation containing related WalletTransaction records. - |
| 33 | walletDebts | SellerWalletDebt[] | REL | No | SellerWalletDebt[] | Virtual Prisma back-relation containing related SellerWalletDebt records. - |
| 34 | inventoryTransactions | InventoryTransaction[] | REL | No | InventoryTransaction[] | Virtual Prisma back-relation containing related InventoryTransaction records. - |
| 35 | deals | Deal[] | REL | No | Deal[] | Virtual Prisma back-relation containing related Deal records. - |
| 36 | coupons | Coupon[] | REL | No | Coupon[] | Virtual Prisma back-relation containing related Coupon records. - |
| 37 | conversationThreads | ConversationThread[] | REL | No | ConversationThread[] | Virtual Prisma back-relation containing related ConversationThread records. - |
| 38 | aplusContents | AplusContent[] | REL | No | AplusContent[] | Virtual Prisma back-relation containing related AplusContent records. - |
Table 43 / Seller, Wallet & Payouts
43) Table Name: SellerDigitalWallet
Stores seller wallet totals such as sales, withdrawn, available and reserve balance.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | UQFK | No | uuid | Foreign key reference to SellerProfile.id. @unique |
| 3 | totalSales | DecimalDecimal(12, 2) | - | No | 0 | Monetary/decimal value for total sales. @default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 4 | withdrawn | DecimalDecimal(12, 2) | - | No | 0 | Monetary/decimal value for withdrawn. @default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 5 | available | DecimalDecimal(12, 2) | - | No | 0 | Monetary/decimal value for available. @default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 6 | reserve | DecimalDecimal(12, 2) | - | No | 0 | Monetary/decimal value for reserve. @default(0) @db.Decimal(12, 2) | DB: Decimal(12, 2) |
| 7 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 8 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 9 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 10 | transactions | WalletTransaction[] | REL | No | WalletTransaction[] | Virtual Prisma back-relation containing related WalletTransaction records. - |
Table 44 / Seller, Wallet & Payouts
44) Table Name: SellerBankAccountDetails
Stores seller bank/UPI verification details and Cashfree provider references.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | UQFK | No | uuid | Foreign key reference to SellerProfile.id. @unique |
| 3 | method | BankVerificationMethod? | - | Yes | UPI | Enum value from BankVerificationMethod (UPI, BANK_DETAILS). - |
| 4 | accountHolderName | String? | - | Yes | Sample Name | Stores account holder name. - |
| 5 | encryptedAccountNumber | String? | - | Yes | text | AES-256-GCM - |
| 6 | accountFingerprint | String? | UQ | Yes | text | Security-sensitive stored value; use hashing/encryption as indicated by the field name. @unique |
| 7 | ifscCode | String? | - | Yes | CODE123 | Stores ifsc code. - |
| 8 | bankName | String? | - | Yes | Sample Name | Stores bank name. - |
| 9 | upiId | String? | - | Yes | uuid | Identifier reference for upi. - |
| 10 | isVerified | Boolean | - | No | false | Boolean flag for is verified. @default(false) |
| 11 | cashfreeBeneficiaryId | String? | - | Yes | uuid | Identifier reference for cashfree beneficiary. - |
| 12 | cashfreeUpiRefId | String? | IDX | Yes | uuid | Identifier reference for cashfree upi ref. - |
| 13 | cashfreeVerificationId | String? | IDX | Yes | uuid | Identifier reference for cashfree verification. - |
| 14 | cashfreeBankReferenceId | String? | IDX | Yes | uuid | Identifier reference for cashfree bank reference. - |
| 15 | cashfreeBankUserId | String? | IDX | Yes | uuid | Identifier reference for cashfree bank user. - |
| 16 | cashfreeUpiValidUpto | DateTime? | - | Yes | now() | Stores cashfree upi valid upto. - |
| 17 | cashfreeUpiLink | String? | - | Yes | https://... | Stores cashfree upi link. - |
| 18 | cashfreeGpayLink | String? | - | Yes | https://... | Stores cashfree gpay link. - |
| 19 | cashfreeBhimLink | String? | - | Yes | https://... | Stores cashfree bhim link. - |
| 20 | cashfreePaytmLink | String? | - | Yes | https://... | Stores cashfree paytm link. - |
| 21 | cashfreePhonepeLink | String? | - | Yes | +91 9876543210 | Stores cashfree phonepe link. - |
| 22 | cashfreeQrCode | String? | - | Yes | CODE123 | Stores cashfree qr code. - |
| 23 | providerStatus | String? | - | Yes | text | Stores provider status. - |
| 24 | providerStatusCode | String? | - | Yes | CODE123 | Stores provider status code. - |
| 25 | providerResponse | Json? | - | Yes | {} | Stores provider response. - |
| 26 | failureReason | String? | - | Yes | text | Stores failure reason. - |
| 27 | verifiedAt | DateTime? | - | Yes | now() | Date/time value for verified at. - |
| 28 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 29 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 30 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 31 | payoutRequests | PayoutRequest[] | REL | No | PayoutRequest[] | Virtual Prisma back-relation containing related PayoutRequest records. - |
| 32 | verificationAttempts | SellerBankVerificationAttempt[] | REL | No | SellerBankVerificationAttempt[] | Virtual Prisma back-relation containing related SellerBankVerificationAttempt records. - |
Table 45 / Seller, Wallet & Payouts
45) Table Name: SellerBankVerificationAttempt
Stores each bank or UPI verification attempt with provider request/response payloads.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 3 | bankAccountId | String? | FK | Yes | uuid | Foreign key reference to SellerBankAccountDetails.id. - |
| 4 | method | BankVerificationMethod | IDX | No | UPI | Enum value from BankVerificationMethod (UPI, BANK_DETAILS). - |
| 5 | accountFingerprint | String? | UQ | Yes | text | Security-sensitive stored value; use hashing/encryption as indicated by the field name. @unique |
| 6 | cashfreeUpiRefId | String? | IDX | Yes | uuid | Identifier reference for cashfree upi ref. - |
| 7 | cashfreeVerificationId | String? | IDX | Yes | uuid | Identifier reference for cashfree verification. - |
| 8 | cashfreeBankReferenceId | String? | IDX | Yes | uuid | Identifier reference for cashfree bank reference. - |
| 9 | cashfreeBankUserId | String? | IDX | Yes | uuid | Identifier reference for cashfree bank user. - |
| 10 | providerStatus | String? | - | Yes | text | Stores provider status. - |
| 11 | providerStatusCode | String? | - | Yes | CODE123 | Stores provider status code. - |
| 12 | requestPayload | Json? | - | Yes | {} | Stores request payload. - |
| 13 | responsePayload | Json? | - | Yes | {} | Stores response payload. - |
| 14 | failureReason | String? | - | Yes | text | Stores failure reason. - |
| 15 | completedAt | DateTime? | - | Yes | now() | Date/time value for completed at. - |
| 16 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 17 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 18 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 19 | bankAccount | SellerBankAccountDetails? | REL | Yes | SellerBankAccountDetails | Virtual Prisma relation to SellerBankAccountDetails. @relation(fields: [bankAccountId], references: [id]) |
Table 46 / Seller, Wallet & Payouts
46) Table Name: TradMark
Stores seller brand/trademark registration details, approval status and logo information.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | FKIDX | No | uuid | Foreign key reference to User.id. - |
| 3 | name | String | UQ | No | Sample Name | Display name. @unique |
| 4 | normalizedName | String? | UQ | Yes | Sample Name | Stores normalized name. @unique |
| 5 | tradeMarkStatus | TradeMarkStatus | IDX | No | PENDING | Enum value from TradeMarkStatus (PENDING, PENDING_APPROVAL, ACTIVE, REJECTED). @default(PENDING) |
| 6 | rejectMessage | String? | - | Yes | text | Stores reject message. - |
| 7 | slug | String? | UQ | Yes | sample-slug | SEO-friendly unique URL identifier. @unique |
| 8 | logoPublicId | String? | - | Yes | uuid | Identifier reference for logo public. - |
| 9 | logoUrl | String? | - | Yes | https://... | Stores logo url. - |
| 10 | description | String? | - | Yes | text | Longer display/SEO description. - |
| 11 | websiteUrl | String? | - | Yes | https://... | Stores website url. - |
| 12 | categoryId | String? | FKIDX | Yes | uuid | Foreign key reference to Category.id. - |
| 13 | isLocked | Boolean | - | No | false | Boolean flag for is locked. @default(false) |
| 14 | submittedAt | DateTime? | - | Yes | now() | Date/time value for submitted at. - |
| 15 | reviewDueAt | DateTime? | - | Yes | now() | Date/time value for review due at. - |
| 16 | approvedAt | DateTime? | - | Yes | now() | Date/time value for approved at. - |
| 17 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 18 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 19 | seller | User | REL | No | User | Virtual Prisma relation to User. @relation(fields: [sellerId], references: [id]) |
| 20 | category | Category? | REL | Yes | Category | Virtual Prisma relation to Category. @relation(fields: [categoryId], references: [id]) |
| 21 | products | Product[] | REL | No | Product[] | Virtual Prisma back-relation containing related Product records. - |
Table 47 / Seller, Wallet & Payouts
47) Table Name: WalletTransaction
Stores seller wallet ledger entries for credits, withdrawals, refunds, reserves and adjustments.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | walletId | String | FKIDX | No | uuid | Foreign key reference to SellerDigitalWallet.id. - |
| 3 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 4 | type | WalletTransactionType | - | No | ORDER_CREDIT | Enum value from WalletTransactionType (ORDER_CREDIT, WITHDRAWAL_INITIATED, WITHDRAWAL_COMPLETE, WITHDRAWAL_FAILED, REFUND_DEBIT, RESERVE_RELEASE...). - |
| 5 | amount | DecimalDecimal(14, 2) | - | No | 0.00 | Monetary amount. @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 6 | balanceAvailableAfter | DecimalDecimal(14, 2) | - | No | 0.00 | Monetary/decimal value for balance available after. @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 7 | balanceReserveAfter | DecimalDecimal(14, 2) | - | No | 0.00 | Monetary/decimal value for balance reserve after. @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 8 | balanceWithdrawnAfter | DecimalDecimal(14, 2) | - | No | 0.00 | Monetary/decimal value for balance withdrawn after. @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 9 | sellerOrderId | String? | FKIDX | Yes | uuid | Foreign key reference to SellerOrder.id. - |
| 10 | orderItemId | String? | FK | Yes | uuid | Foreign key reference to OrderItem.id. - |
| 11 | payoutRequestId | String? | FKIDX | Yes | uuid | Foreign key reference to PayoutRequest.id. - |
| 12 | walletDebtId | String? | FKIDX | Yes | uuid | Foreign key reference to SellerWalletDebt.id. - |
| 13 | metadata | Json? | - | Yes | {} | Flexible JSON metadata for extra provider or audit information. - |
| 14 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 15 | wallet | SellerDigitalWallet | REL | No | SellerDigitalWallet | Virtual Prisma relation to SellerDigitalWallet. @relation(fields: [walletId], references: [id]) |
| 16 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 17 | sellerOrder | SellerOrder? | REL | Yes | SellerOrder | Virtual Prisma relation to SellerOrder. @relation(fields: [sellerOrderId], references: [id]) |
| 18 | orderItem | OrderItem? | REL | Yes | OrderItem | Virtual Prisma relation to OrderItem. @relation(fields: [orderItemId], references: [id]) |
| 19 | payoutRequest | PayoutRequest? | REL | Yes | PayoutRequest | Virtual Prisma relation to PayoutRequest. @relation(fields: [payoutRequestId], references: [id]) |
| 20 | walletDebt | SellerWalletDebt? | REL | Yes | SellerWalletDebt | Virtual Prisma relation to SellerWalletDebt. @relation(fields: [walletDebtId], references: [id]) |
Table 48 / Seller, Wallet & Payouts
48) Table Name: PayoutRequest
Stores seller withdrawal requests and provider payout status/UTR details.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 3 | bankAccountId | String | FKIDX | No | uuid | Foreign key reference to SellerBankAccountDetails.id. - |
| 4 | amount | DecimalDecimal(14, 2) | - | No | 0.00 | Monetary amount. @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 5 | netAmount | Decimal?Decimal(14, 2) | - | Yes | 0.00 | Monetary/decimal value for net amount. @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 6 | verificationFeeDeducted | DecimalDecimal(14, 2) | - | No | 0 | Monetary/decimal value for verification fee deducted. @default(0) @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 7 | currency | String | - | No | "INR" | Currency code for monetary values. @default("INR") |
| 8 | mode | PayoutMode | - | No | IMPS | Enum value from PayoutMode (IMPS, RTGS, NEFT, UPI). @default(IMPS) |
| 9 | status | PayoutRequestStatus | IDX | No | PENDING | Current workflow or lifecycle status. @default(PENDING) |
| 10 | idempotencyKey | String | UQ | No | text | Stores idempotency key. @unique |
| 11 | cashfreeTransferId | String? | IDX | Yes | uuid | Identifier reference for cashfree transfer. - |
| 12 | cashfreeCfTransferId | String? | IDX | Yes | uuid | Identifier reference for cashfree cf transfer. - |
| 13 | cashfreeStatusCode | String? | - | Yes | CODE123 | Stores cashfree status code. - |
| 14 | cashfreeStatusDescription | String? | - | Yes | text | Stores cashfree status description. - |
| 15 | utr | String? | - | Yes | text | Stores utr. - |
| 16 | failureReason | String? | - | Yes | text | Stores failure reason. - |
| 17 | requestedAt | DateTime | IDX | No | now() | Date/time value for requested at. @default(now()) |
| 18 | processingStartedAt | DateTime? | - | Yes | now() | Date/time value for processing started at. - |
| 19 | processedAt | DateTime? | - | Yes | now() | Date/time value for processed at. - |
| 20 | failedAt | DateTime? | - | Yes | now() | Date/time value for failed at. - |
| 21 | cancelledAt | DateTime? | - | Yes | now() | Date/time value for cancelled at. - |
| 22 | createdAt | DateTime | - | No | now() | Record creation timestamp. @default(now()) |
| 23 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 24 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 25 | bankAccount | SellerBankAccountDetails | REL | No | SellerBankAccountDetails | Virtual Prisma relation to SellerBankAccountDetails. @relation(fields: [bankAccountId], references: [id]) |
| 26 | deletionRequest | DeletionRequest? | REL | Yes | DeletionRequest | Virtual Prisma relation to DeletionRequest. - |
| 27 | walletTransactions | WalletTransaction[] | REL | No | WalletTransaction[] | Virtual Prisma back-relation containing related WalletTransaction records. - |
Table 49 / Seller, Wallet & Payouts
49) Table Name: SellerWalletDebt
Stores seller negative wallet/debt recovery records created by returns or adjustments.
| No. | Field | Type | Key | Nullable | Default / Example | Description / Attributes |
|---|---|---|---|---|---|---|
| 1 | id | String | PK | No | uuid() | Primary UUID identifier for the record. @id @default(uuid()) |
| 2 | sellerId | String | FKIDX | No | uuid | Foreign key reference to SellerProfile.id. - |
| 3 | sellerOrderId | String? | FKIDX | Yes | uuid | Foreign key reference to SellerOrder.id. - |
| 4 | returnRequestId | String? | FKIDX | Yes | uuid | Foreign key reference to ReturnRequest.id. - |
| 5 | initialAmount | DecimalDecimal(14, 2) | - | No | 0.00 | Monetary/decimal value for initial amount. @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 6 | remainingAmount | DecimalDecimal(14, 2) | - | No | 0.00 | Monetary/decimal value for remaining amount. @db.Decimal(14, 2) | DB: Decimal(14, 2) |
| 7 | status | WalletDebtStatus | IDX | No | OPEN | Current workflow or lifecycle status. @default(OPEN) |
| 8 | reason | String? | - | Yes | text | Stores reason. - |
| 9 | createdAt | DateTime | IDX | No | now() | Record creation timestamp. @default(now()) |
| 10 | updatedAt | DateTime | - | No | now() | Record last update timestamp. @updatedAt |
| 11 | recoveredAt | DateTime? | - | Yes | now() | Date/time value for recovered at. - |
| 12 | sellerProfile | SellerProfile | REL | No | SellerProfile | Virtual Prisma relation to SellerProfile. @relation(fields: [sellerId], references: [id]) |
| 13 | sellerOrder | SellerOrder? | REL | Yes | SellerOrder | Virtual Prisma relation to SellerOrder. @relation(fields: [sellerOrderId], references: [id]) |
| 14 | returnRequest | ReturnRequest? | REL | Yes | ReturnRequest | Virtual Prisma relation to ReturnRequest. @relation(fields: [returnRequestId], references: [id]) |
| 15 | walletTransactions | WalletTransaction[] | REL | No | WalletTransaction[] | Virtual Prisma back-relation containing related WalletTransaction records. - |