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.
This commit is contained in:
padreug 2025-10-22 16:27:16 +02:00
parent 2a14dd2e62
commit eb9a3c1600
3 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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
}

View file

@ -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(