+ Entity Relationship Diagram

Scroll to zoom Drag to pan Double-click to fit 100%
erDiagram AccountGameBatch { string id PK datetime created string game int account FK string status } AccountGameBatch }o--|| Account : account AccountGameEntry { string id PK datetime created datetime expiration string game int account FK } AccountGameEntry }o--|| Account : account AccountGameEntry ||--|| AccountGameReward : account_game_reward AccountGameEntry }o--|| AccountGameBatch : batch AccountGameReward { string id PK string api_id int account FK string game string reward } AccountGameReward }o--|| Account : account AccountGameReward ||--|| AccountGameRewardCreated : created AccountGameReward }o--o{ AccountGameEntry : extra_spin_entries AccountGameRewardCreated { string id PK } AccountGameRewardEvent { string id PK int account_game_reward FK } AccountGameRewardEvent }o--|| AccountGameReward : account_game_reward CategoryBoost { string id PK string category_name string icon string mcc int reward_percentage } MerchantBoost { string id PK string offer_id string merchant_id string merchant_name int user_commission } MerchantBoost }o--|| CategoryBoost : category_boost SpinWheel { string id PK string name string game_name datetime start_date datetime end_date } SpinWheel }o--|| SpinWheelDesignConfig : design_config SpinWheelDesignConfig { string id PK string name int background_image FK string background_color string eyebrow_text } SpinWheelDesignConfig }o--|| SpinWheelImage : background_image SpinWheelDesignConfig }o--|| SpinWheelImage : title_image SpinWheelDesignConfig }o--|| SpinWheelImage : wheel_border_image SpinWheelDesignConfig }o--|| SpinWheelImage : center_pointer_image SpinWheelDesignConfig }o--|| SpinWheelImage : about_this_wheel_image SpinWheelImage { string id PK string image string name string type } SpinWheelPrize { string id PK int spin_wheel FK string name int weight int value } SpinWheelPrize }o--|| SpinWheel : spin_wheel SpinWheelPrize }o--|| SpinWheelImage : icon

AccountGameBatch

Table: fold_account_game_batch
Field Type Constraints
id UUIDField PK default=uuid4
created DateTimeField default=now()
game TextField choicesGames
account FK → Account
status TextField default=value choicesAccountGameBatchStatus

Relationships

.account N:1 Account

Referenced By (1 tables)

AccountGameEntry N:1 .batch

Sample Queries (click to expand)

Get all records
AccountGameBatch.objects.all()
Get by ID
AccountGameBatch.objects.get(id=1)
With related Account
AccountGameBatch.objects.select_related("account")
Filter by account
AccountGameBatch.objects.filter(account_id=123)
Filter by created (last 7 days)
AccountGameBatch.objects.filter(created__gte=datetime.now()-timedelta(days=7))

AccountGameEntry

Table: fold_account_game_entry
Field Type Constraints
id UUIDField PK default=uuid4
created DateTimeField default=now() indexed
expiration DateTimeField indexed
game TextField choicesGames
account FK → Account
source TextField choices nullableAccountGameRewardSources
account_game_reward OneToOne → AccountGameReward nullable
fold_card_transaction FK → FoldCardTransaction nullable
batch FK → AccountGameBatch nullable
rewards_exchange_rate DecimalField(80,40) nullable
is_replaced BooleanField default=False
is_extra_spin BooleanField default=False indexed
is_extra_bomb_spin BooleanField default=False

Relationships

.account N:1 Account
.account_game_reward 1:1 AccountGameReward
.fold_card_transaction N:1 FoldCardTransaction
.batch N:1 AccountGameBatch

Referenced By (2 tables)

AccountGameReward N:M .extra_spin_entries
WalletQuote N:M .extra_spin_entries

Sample Queries (click to expand)

Get all records
AccountGameEntry.objects.all()
Get by ID
AccountGameEntry.objects.get(id=1)
With related Account
AccountGameEntry.objects.select_related("account")
Filter by account
AccountGameEntry.objects.filter(account_id=123)
Filter by created (last 7 days)
AccountGameEntry.objects.filter(created__gte=datetime.now()-timedelta(days=7))

AccountGameReward

Table: fold_account_game_reward
Field Type Constraints
id BigAutoField PK
api_id TextField
account FK → Account
game TextField choicesGames
reward TextField
value DecimalField(30,8) nullable
created OneToOne → AccountGameRewardCreated nullable
created_time DateTimeField default=now()
balance_change OneToOne → BalanceChange nullable
extra_spin_entries M2M → AccountGameEntry
title TextField nullable
subtext TextField nullable
subtitle TextField nullable
button_text TextField nullable
button_url TextField nullable
wheel_name TextField nullable indexed
icon TextField nullable
details JSONField default=dict()
prize_group UUIDField nullable indexed
prize_rarity CharField(250) choices nullableAccountGameRewardPrizeRarity
prize_rank PositiveIntegerField nullable default=1

Relationships

.account N:1 Account
.balance_change 1:1 BalanceChange
.extra_spin_entries N:M AccountGameEntry

Referenced By (5 tables)

AccountOrderBonus 1:1 .source_game_reward
AccountGameRewardEvent N:1 .account_game_reward
AccountGameEntry 1:1 .account_game_reward
FoldCardTransaction 1:1 .account_game_reward
FoldCardTransactionBoost 1:1 .account_game_reward

Sample Queries (click to expand)

Get all records
AccountGameReward.objects.all()
Get by ID
AccountGameReward.objects.get(id=1)
With related Account
AccountGameReward.objects.select_related("account")
Filter by account
AccountGameReward.objects.filter(account_id=123)
Filter by created_time (last 7 days)
AccountGameReward.objects.filter(created_time__gte=datetime.now()-timedelta(days=7))

AccountGameRewardCreated

Table: fold_account_game_reward_created Extends: AccountGameRewardEvent
Field Type Constraints
id BigAutoField PK

Referenced By (1 tables)

AccountGameReward 1:1 .created

Sample Queries (click to expand)

Get all records
AccountGameRewardCreated.objects.all()
Get by ID
AccountGameRewardCreated.objects.get(id=1)

AccountGameRewardEvent

Table: fold_account_game_reward_event Extends: AccountEvent
Field Type Constraints
id BigAutoField PK
account_game_reward FK → AccountGameReward

Relationships

.account_game_reward N:1 AccountGameReward

Sample Queries (click to expand)

Get all records
AccountGameRewardEvent.objects.all()
Get by ID
AccountGameRewardEvent.objects.get(id=1)
With related AccountGameReward
AccountGameRewardEvent.objects.select_related("account_game_reward")

CategoryBoost

Table: fold_category_boost Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
category_name CharField(100)
icon FileField(255) nullable
mcc JSONField default=list()
reward_percentage DecimalField(5,2)
reward_rates JSONField default=dict() nullable
is_active BooleanField default=False indexed
start_date DateTimeField indexed
is_all_other_categories BooleanField default=False
end_date DateTimeField nullable indexed
index SmallIntegerField nullable
is_qualified_spending_for_ach_reward_rates BooleanField default=False
icon_name FK → Icon nullable

Relationships

.icon_name N:1 Icon

Referenced By (2 tables)

FoldCardTransaction N:1 .category_boost
MerchantBoost N:1 .category_boost

Sample Queries (click to expand)

Get all records
CategoryBoost.objects.all()
Get by ID
CategoryBoost.objects.get(id=1)
With related Icon
CategoryBoost.objects.select_related("icon_name")
Filter by start_date (last 7 days)
CategoryBoost.objects.filter(start_date__gte=datetime.now()-timedelta(days=7))

MerchantBoost

Table: fold_merchant_boost Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
offer_id CharField(100) unique
merchant_id CharField(100) default=""
merchant_name CharField(100)
user_commission DecimalField(7,2)
total_commission DecimalField(7,2) nullable
expiration_date DateTimeField default=now
override BooleanField default=False
index SmallIntegerField nullable
commission_type CharField(18) default=""
max_reward_amount DecimalField(7,2) nullable
min_reward_amount DecimalField(7,2) nullable
redeem_type CharField(18) default=""
start_date DateTimeField default=now
category_boost FK → CategoryBoost nullable

Relationships

.category_boost N:1 CategoryBoost

Referenced By (1 tables)

FoldCardTransaction N:1 .merchant_boost

Sample Queries (click to expand)

Get all records
MerchantBoost.objects.all()
Get by ID
MerchantBoost.objects.get(id=1)
With related CategoryBoost
MerchantBoost.objects.select_related("category_boost")
Filter by expiration_date (last 7 days)
MerchantBoost.objects.filter(expiration_date__gte=datetime.now()-timedelta(days=7))

SpinWheel

Table: fold_spin_wheel Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
name CharField(250) unique
game_name CharField(250) choicesGames
start_date DateTimeField nullable
end_date DateTimeField nullable
entry_expiry_seconds PositiveIntegerField nullable
design_config_legacy JSONField default=dict()
design_config FK → SpinWheelDesignConfig nullable
is_enabled BooleanField default=False
frequency_seconds PositiveIntegerField nullable default=0
spin_streak_length PositiveIntegerField nullable default=0
spin_streak_reward DecimalField(20,12) nullable default=0
deleted BooleanField default=False

Relationships

.design_config N:1 SpinWheelDesignConfig

Referenced By (1 tables)

SpinWheelPrize N:1 .spin_wheel

Sample Queries (click to expand)

Get all records
SpinWheel.objects.all()
Get by ID
SpinWheel.objects.get(id=1)
With related SpinWheelDesignConfig
SpinWheel.objects.select_related("design_config")
Filter by start_date (last 7 days)
SpinWheel.objects.filter(start_date__gte=datetime.now()-timedelta(days=7))

SpinWheelDesignConfig

Table: fold_spin_wheel_design_config Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
name CharField(250) unique
background_image FK → SpinWheelImage nullable
background_color CharField(250)
eyebrow_text TextField nullable
eyebrow_text_color CharField(250)
title_text TextField nullable
title_image FK → SpinWheelImage nullable
title_text_color CharField(250)
body_text TextField nullable
body_text_color CharField(250)
close_icon_color CharField(250)
wheel_border_image FK → SpinWheelImage nullable
wheel_primary_color CharField(250)
wheel_secondary_color CharField(250)
center_pointer_image FK → SpinWheelImage nullable
spinning_for_color CharField(250)
legal_text_color CharField(250)
legal_url CharField(250)
about_this_wheel_image FK → SpinWheelImage nullable
about_this_wheel_url CharField(250)
about_this_wheel_description TextField nullable

Relationships

.background_image N:1 SpinWheelImage
.title_image N:1 SpinWheelImage
.wheel_border_image N:1 SpinWheelImage
.center_pointer_image N:1 SpinWheelImage
.about_this_wheel_image N:1 SpinWheelImage

Referenced By (1 tables)

SpinWheel N:1 .design_config

Sample Queries (click to expand)

Get all records
SpinWheelDesignConfig.objects.all()
Get by ID
SpinWheelDesignConfig.objects.get(id=1)
With related SpinWheelImage
SpinWheelDesignConfig.objects.select_related("background_image")

SpinWheelImage

Table: fold_spin_wheel_image Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
image FileField(255)
name CharField(250) unique
type CharField(250) choicesSpinWheelImageTypes

Referenced By (6 tables)

SpinWheelDesignConfig N:1 .background_image
SpinWheelDesignConfig N:1 .title_image
SpinWheelDesignConfig N:1 .wheel_border_image
SpinWheelDesignConfig N:1 .center_pointer_image
SpinWheelDesignConfig N:1 .about_this_wheel_image
SpinWheelPrize N:1 .icon

Sample Queries (click to expand)

Get all records
SpinWheelImage.objects.all()
Get by ID
SpinWheelImage.objects.get(id=1)

SpinWheelPrize

Table: fold_spin_wheel_prize Extends: BaseModelMixin
Field Type Constraints
id BigAutoField PK
spin_wheel FK → SpinWheel
name CharField(250) choices indexedRewards
weight PositiveIntegerField
value DecimalField(20,12) nullable
icon FK → SpinWheelImage nullable
title CharField(250) nullable
subtext TextField nullable
subtitle TextField nullable
details JSONField default=dict() nullable
button_text TextField nullable
button_url CharField(250) nullable
user_prize_cap PositiveIntegerField nullable
prize_cap PositiveIntegerField nullable
prize_group UUIDField nullable
prize_rarity CharField(250) nullable
is_locked BooleanField default=False
prize_number PositiveIntegerField nullable
prize_rank PositiveIntegerField default=1
wedge_index PositiveIntegerField default=0

Relationships

.spin_wheel N:1 SpinWheel
.icon N:1 SpinWheelImage

Sample Queries (click to expand)

Get all records
SpinWheelPrize.objects.all()
Get by ID
SpinWheelPrize.objects.get(id=1)
With related SpinWheel
SpinWheelPrize.objects.select_related("spin_wheel")