app.model.wallet_transactions module¶
Wallet transaction ledger model.
The transactionType column is a free-form string. Only two values are
actually written by the engine today:
AssignPoints Assignment of points to the wallet.
ConvertPointsToCoins Conversion of points to coins in the wallet.
The names below are reserved for planned ledger operations (refunds,
transfers, manual adjustments, purchases). Nothing in app/ emits them yet,
so treat them as a roadmap, not as behavior you can rely on:
DepositCoins Deposit of coins into the wallet.
WithdrawCoins Withdrawal of coins from the wallet.
EarnRewards Earning rewards (points or coins) for activities.
RedeemRewards Redemption of points for rewards or services.
PurchaseWithPoints Purchase of items or services using points.
PurchaseWithCoins Purchase of items or services using coins.
RefundTransaction Refund of a previous transaction.
AdjustBalance Manual adjustment of the balance (errors/fixes).
TransferPoints Transfer of points to another user.
TransferCoins Transfer of coins to another user.
ExchangeCoins Exchange of coins for another currency or asset.
FeeDeduction Deduction of fees or commissions from the balance.
BonusPointsAward Awarding of bonus points.
- class app.model.wallet_transactions.WalletTransactions(*, id=<factory>, created_at=<factory>, updated_at=<factory>, apiKey_used, oauth_user_id=None, transactionType, points, coins, data, appliedConversionRate, walletId)[source]¶
Bases:
BaseModelRepresents a transaction in a wallet.
- Parameters:
id (Annotated[str, FieldInfoMetadata(primary_key=PydanticUndefined, nullable=PydanticUndefined, foreign_key=PydanticUndefined, ondelete=PydanticUndefined, unique=PydanticUndefined, index=PydanticUndefined, sa_type=UUID(), sa_column=PydanticUndefined, sa_column_args=PydanticUndefined, sa_column_kwargs={'primary_key': True, 'index': True})])
created_at (Annotated[datetime, FieldInfoMetadata(primary_key=PydanticUndefined, nullable=PydanticUndefined, foreign_key=PydanticUndefined, ondelete=PydanticUndefined, unique=PydanticUndefined, index=PydanticUndefined, sa_type=DateTime(timezone=True), sa_column=PydanticUndefined, sa_column_args=PydanticUndefined, sa_column_kwargs={'server_default': <sqlalchemy.sql.functions.now at 0x7fa82a5671d0; now>})])
updated_at (Annotated[datetime, FieldInfoMetadata(primary_key=PydanticUndefined, nullable=PydanticUndefined, foreign_key=PydanticUndefined, ondelete=PydanticUndefined, unique=PydanticUndefined, index=PydanticUndefined, sa_type=DateTime(timezone=True), sa_column=PydanticUndefined, sa_column_args=PydanticUndefined, sa_column_kwargs={'server_default': <sqlalchemy.sql.functions.now at 0x7fa82a567fb0; now>, 'onupdate': <sqlalchemy.sql.functions.now at 0x7fa82a567710; now>})])
- transactionType¶
The type of transaction.
- Type:
str
- points¶
The number of points involved in the transaction.
- Type:
int
- coins¶
The number of coins involved in the transaction.
- Type:
float
- data¶
Additional data associated with the transaction.
- Type:
dict
- appliedConversionRate¶
The conversion rate applied to the transaction.
- Type:
float
- walletId¶
The ID of the wallet associated with the transaction.
- Type:
str
- model_config: ClassVar[ConfigDict] = {'from_attributes': True, 'read_from_attributes': True, 'read_with_orm_mode': True, 'registry': PydanticUndefined, 'table': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- make_hashable(obj)[source]¶
Recursively convert a nested structure into a hashable form.
Lists/tuples become tuples and dicts become sorted tuples of
(key, value)pairs, so the JSONdatafield can be folded into__hash__. Scalars are returned unchanged.- Parameters:
obj – The value (possibly nested list/dict) to make hashable.
- Returns:
A hashable equivalent of
obj.