Skip to content

Store Model

The Store model represents a merchant/store account in the LuxMart platform.

Structure

{
  "id": 1,
  "email": "store@example.com",
  "name": "My Store",
  "description": "Store description",
  "logo_url": "https://...",
  "business_address": "123 Main St",
  "preferred_language": "AZERBAIJANI",
  "contact_phone": "+994501234567",
  "percent": 10.5,
  "created": "2025-01-15T10:30:00Z"
}

Fields

Field Type Description Notes
id integer Unique identifier Auto-increment, primary key
email string Store's email address Required, unique, validated
name string Store name Required
description string Store description Optional
logo_url string URL to store logo Stored in S3, optional
business_address string Business address Optional
contact_phone string Contact phone number Optional, validated format
preferred_language string Preferred language code One of: "AZERBAIJANI", "ENGLISH", "SPANISH", "GERMAN"
percent float Commission percentage Used in payment calculations
is_active boolean Account activation status false until OTP verified
is_deleted boolean Soft delete flag Default: false
role string Store role Always "3" (Store)
created datetime Account creation timestamp Auto-generated
updated datetime Last update timestamp Auto-updated

Internal Fields (Not Returned in API)

Field Type Description
password string Hashed password
otp string One-time password for verification

Role Values

  • "3" - Store (merchant)

Preferred Language Values

  • "AZERBAIJANI" - Azerbaijani (az)
  • "ENGLISH" - English (en)
  • "SPANISH" - Spanish (es)
  • "GERMAN" - German (de)

Relationships

  • StoreTokenModel: One-to-many relationship with authentication tokens
  • ProductModel: One-to-many relationship with products
  • OrderModel: One-to-many relationship with orders

Notes

  • Password is hashed using bcrypt before storage
  • Email must be unique across all stores
  • Account must be activated (is_active: true) to login
  • Soft deleted stores cannot login or be retrieved
  • Logo is stored in AWS S3
  • percent represents the commission percentage for the store (e.g., 10.5 = 10.5%)