From eb9a3c16006bfc97cd59ee493072d0f5864fd8ee Mon Sep 17 00:00:00 2001 From: padreug Date: Wed, 22 Oct 2025 16:27:16 +0200 Subject: [PATCH] Replaces user wallet ID with user ID Updates the receivable entry model and related API endpoints to use the user's ID instead of the user's wallet ID. This change simplifies user identification and ensures consistency throughout the application. --- models.py | 2 +- static/js/index.js | 4 ++-- views_api.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/models.py b/models.py index f1aa8e6..85e6a1a 100644 --- a/models.py +++ b/models.py @@ -88,7 +88,7 @@ class ReceivableEntry(BaseModel): description: str amount: float # Amount in the specified currency (or satoshis if currency is None) revenue_account: str # account name or ID - user_wallet: str + user_id: str # The user_id (not wallet_id) of the user who owes the castle reference: Optional[str] = None currency: Optional[str] = None # If None, amount is in satoshis. Otherwise, fiat currency code diff --git a/static/js/index.js b/static/js/index.js index 0c1fb09..9a6cbf8 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -87,7 +87,7 @@ window.app = Vue.createApp({ this.users.forEach(user => { options.push({ label: user.username, - value: user.user_wallet_id + value: user.user_id }) }) return options @@ -364,7 +364,7 @@ window.app = Vue.createApp({ description: this.receivableDialog.description, amount: this.receivableDialog.amount, revenue_account: this.receivableDialog.revenueAccount, - user_wallet: this.receivableDialog.selectedUser, + user_id: this.receivableDialog.selectedUser, reference: this.receivableDialog.reference || null, currency: this.receivableDialog.currency || null } diff --git a/views_api.py b/views_api.py index 682bc8f..a11abe6 100644 --- a/views_api.py +++ b/views_api.py @@ -321,7 +321,7 @@ async def api_create_receivable_entry( # Get or create user-specific receivable account user_receivable = await get_or_create_user_account( - data.user_wallet, AccountType.ASSET, "Accounts Receivable" + data.user_id, AccountType.ASSET, "Accounts Receivable" ) # Create journal entry @@ -335,7 +335,7 @@ async def api_create_receivable_entry( account_id=user_receivable.id, debit=amount_sats, credit=0, - description=f"Amount owed by user {data.user_wallet[:8]}", + description=f"Amount owed by user {data.user_id[:8]}", metadata=metadata, ), CreateEntryLine(