Relationships
Entity relationships in the Fangate database schema.
User → Products
users (1) ----< (*) products- One user (creator) has many products
products.user_id→users.id
User → Wallet
users (1) ---- (1) wallets- One user has one wallet
wallets.user_id→users.id
User → Currency
users (*) ---- (1) currencies- Many users can share a currency
users.currency_id→currencies.id
Product → Media
products (1) ----< (*) media- One product has many media files (e.g. multiple photos, video)
media.product_id→products.id
Product → Currency
products (*) ---- (1) currenciesproducts.currency_id→currencies.id
Collections
users (1) ---- (1) collections
collections (*) ----< (*) products (via pivot)- One user has one collection (current design)
- Collection has many products; product can be in one collection
- Pivot:
collection_productor similar
Affiliate / Referral
users (master) ----< (*) users (invited)usersmay havemaster_idor equivalent linking to referring user- Referral relationships tracked for affiliate earnings
Transactions
wallets (1) ----< (*) transactions- Wallet has many transactions
- Transaction types: product_earning, affiliate_earning, withdrawal, fee, refund, hold, release_hold, pending
Consent
products (1) ----< (*) consents (or consent_requests)- Product may have associated consent documents
- Consent linked to product and/or media
Diagram (Simplified)
users
├── products (1:N)
│ ├── media (1:N)
│ ├── consents
│ └── currency
├── wallet (1:1)
│ └── transactions
├── collection (1:1)
│ └── products (N:M)
└── currency