Data model

This page shows the foreign-key relationships between the records you can sync via Endear's bulkUpsert* mutations. Each line connects a foreign-key field on one record to the primary key of the record it references.

erDiagram
  Customer {
    ID id PK
    string email_address
    string phone_number
  }
  Location {
    ID id PK
  }
  User {
    ID id PK
  }
  Product {
    ID id PK
  }
  ProductVariant {
    ID id PK
    ID product_id FK
  }
  Order {
    ID id PK
    ID customer_id FK
    ID location_id FK
    ID processed_by_user_id FK
    list assisted_by_user_ids FK
  }
  OrderItem {
    ID id PK
    ID order_id FK
    ID product_id FK
    ID product_variant_id FK
  }
  Refund {
    ID id PK
    ID original_order_id FK
    ID original_order_item_id FK
    ID product_id FK
    ID product_variant_id FK
  }
  MarketingEvent {
    ID id PK
    ID customer_id FK
    string email_address
    string phone_number
  }
  MarketingSubscription {
    string email_address
    string phone_number
  }

  Customer ||--o{ Order : "customer_id"
  Location ||--o{ Order : "location_id"
  User ||--o{ Order : "processed_by_user_id"
  User }o--o{ Order : "assisted_by_user_ids"
  Product ||--o{ ProductVariant : "product_id"
  Product ||--o{ OrderItem : "product_id"
  ProductVariant ||--o{ OrderItem : "product_variant_id"
  Order ||--o{ OrderItem : "order_id"
  Order ||--o{ Refund : "original_order_id"
  OrderItem ||--o{ Refund : "original_order_item_id"
  Product ||--o{ Refund : "product_id"
  ProductVariant ||--o{ Refund : "product_variant_id"
  Customer ||--o{ MarketingEvent : "email_address or phone_number"
  Customer ||--o{ MarketingSubscription : "email_address or phone_number"

What’s Next