Domain Model

ER Diagram

Multi-tenant e-commerce platformu icin temel entity'ler ve iliskileri. Tenant bazli izolasyon, kullanici yetkilendirme ve siparis yonetimi.

Auth & Authorization Product Catalog Commerce
erDiagram
    TENANT ||--o{ USER : "has many"
    TENANT ||--o{ EVENT : "has many"
    TENANT ||--o{ PRODUCT : "has many"
    TENANT ||--o{ ORDER : "has many"
    TENANT ||--o{ CUSTOMER : "has many"
    TENANT ||--o{ CAMPAIGN : "has many"

    USER ||--o{ PERMISSION : "has many"

    EVENT ||--o{ PRODUCT : "has many"
    PRODUCT ||--o{ SESSION : "has many"

    CUSTOMER ||--o{ ORDER : "places"
    ORDER ||--o{ ORDER_ITEM : "contains"
    ORDER ||--o{ PAYMENT : "paid by"

    PRODUCT ||--o{ ORDER_ITEM : "in"
    SESSION ||--o{ ORDER_ITEM : "booked for"

    TENANT {
        uuid id PK
        string slug UK
        string name
        string domain
        enum status
    }

    USER {
        uuid id PK
        uuid tenant_id FK
        string phone UK
        string email
        string name
        enum role
    }

    PERMISSION {
        uuid id PK
        uuid user_id FK
        string category
        string action
        boolean granted
    }

    EVENT {
        uuid id PK
        uuid tenant_id FK
        string slug
        json name
        datetime start_date
        datetime end_date
    }

    PRODUCT {
        uuid id PK
        uuid tenant_id FK
        uuid event_id FK
        enum type
        string slug
        decimal price
    }

    SESSION {
        uuid id PK
        uuid product_id FK
        datetime start_time
        datetime end_time
        int capacity
        int booked
    }

    ORDER {
        uuid id PK
        uuid tenant_id FK
        uuid customer_id FK
        string order_number
        enum status
        decimal total
    }

    ORDER_ITEM {
        uuid id PK
        uuid order_id FK
        uuid product_id FK
        uuid session_id FK
        int quantity
        decimal unit_price
    }

    PAYMENT {
        uuid id PK
        uuid order_id FK
        decimal amount
        enum method
        enum status
    }

    CUSTOMER {
        uuid id PK
        uuid tenant_id FK
        string phone
        string email
        string name
        boolean is_guest
    }

    CAMPAIGN {
        uuid id PK
        uuid tenant_id FK
        string code
        enum discount_type
        decimal discount_value
    }
        

Entity Details

Tenant
idUUID
slugString (UK)
nameString
domainString
statusEnum
User
idUUID
tenant_idUUID
phoneString (UK)
emailString
nameString
roleEnum
Order
idUUID
tenant_idUUID
customer_idUUID
order_numberString
statusEnum
totalDecimal
Product
idUUID
tenant_idUUID
event_idUUID
typeEnum
slugString
priceDecimal
Payment
idUUID
order_idUUID
amountDecimal
methodEnum
statusEnum
Customer
idUUID
tenant_idUUID
phoneString
emailString
nameString
is_guestBoolean