refactors
This commit is contained in:
parent
4e1a339432
commit
82c4d0168e
28 changed files with 1042 additions and 782 deletions
59
backend/models/enums.py
Normal file
59
backend/models/enums.py
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
from enum import Enum as PyEnum
|
||||
|
||||
|
||||
class Permission(str, PyEnum):
|
||||
"""All available permissions in the system."""
|
||||
|
||||
# Audit permissions
|
||||
VIEW_AUDIT = "view_audit"
|
||||
FETCH_PRICE = "fetch_price"
|
||||
|
||||
# Profile permissions
|
||||
MANAGE_OWN_PROFILE = "manage_own_profile"
|
||||
|
||||
# Invite permissions
|
||||
MANAGE_INVITES = "manage_invites"
|
||||
VIEW_OWN_INVITES = "view_own_invites"
|
||||
|
||||
# Exchange permissions (regular users)
|
||||
CREATE_EXCHANGE = "create_exchange"
|
||||
VIEW_OWN_EXCHANGES = "view_own_exchanges"
|
||||
CANCEL_OWN_EXCHANGE = "cancel_own_exchange"
|
||||
|
||||
# Availability/Exchange permissions (admin)
|
||||
MANAGE_AVAILABILITY = "manage_availability"
|
||||
VIEW_ALL_EXCHANGES = "view_all_exchanges"
|
||||
CANCEL_ANY_EXCHANGE = "cancel_any_exchange"
|
||||
COMPLETE_EXCHANGE = "complete_exchange"
|
||||
|
||||
|
||||
class InviteStatus(str, PyEnum):
|
||||
"""Status of an invite."""
|
||||
|
||||
READY = "ready"
|
||||
SPENT = "spent"
|
||||
REVOKED = "revoked"
|
||||
|
||||
|
||||
class ExchangeStatus(str, PyEnum):
|
||||
"""Status of an exchange trade."""
|
||||
|
||||
BOOKED = "booked"
|
||||
COMPLETED = "completed"
|
||||
CANCELLED_BY_USER = "cancelled_by_user"
|
||||
CANCELLED_BY_ADMIN = "cancelled_by_admin"
|
||||
NO_SHOW = "no_show"
|
||||
|
||||
|
||||
class TradeDirection(str, PyEnum):
|
||||
"""Direction of a trade from the user's perspective."""
|
||||
|
||||
BUY = "buy" # User buys BTC, gives EUR
|
||||
SELL = "sell" # User sells BTC, gets EUR
|
||||
|
||||
|
||||
class BitcoinTransferMethod(str, PyEnum):
|
||||
"""Bitcoin transfer method for exchange trades."""
|
||||
|
||||
ONCHAIN = "onchain"
|
||||
LIGHTNING = "lightning"
|
||||
Loading…
Add table
Add a link
Reference in a new issue