Rename Castle Accounting extension to Libra
Full identifier rename: module path lnbits.extensions.castle →
lnbits.extensions.libra, DB ext_castle → ext_libra, URL prefix
/castle/ → /libra/, manifest id castle → libra, fava ledger slug
default castle-ledger → libra-ledger, Beancount source metadata
castle-api → libra-api and link prefixes castle-{entry,tx}- →
libra-{entry,tx}-, column castle_wallet_id → libra_wallet_id, all
Python/JS/HTML identifiers (castle_ext, CastleSettings,
castle_reference, castleWalletConfigured, etc.).
Display name "Castle Accounting" → "Libra" (the scales/balance
metaphor — fits double-entry bookkeeping).
No backward compat: production hosts will be force-updated. Old
castle-prefixed Beancount metadata in existing Fava ledgers is
historical; new entries use libra-* prefixes going forward.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9c577c740c
commit
c174cda48d
44 changed files with 953 additions and 953 deletions
24
models.py
24
models.py
|
|
@ -87,7 +87,7 @@ class CreateJournalEntry(BaseModel):
|
|||
|
||||
class UserBalance(BaseModel):
|
||||
user_id: str
|
||||
balance: int # positive = castle owes user, negative = user owes castle
|
||||
balance: int # positive = libra owes user, negative = user owes libra
|
||||
accounts: list[Account] = []
|
||||
fiat_balances: dict[str, Decimal] = {} # e.g. {"EUR": Decimal("250.0"), "USD": Decimal("100.0")}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ class ExpenseEntry(BaseModel):
|
|||
description: str
|
||||
amount: Decimal # Amount in the specified currency (or satoshis if currency is None)
|
||||
expense_account: str # account name or ID
|
||||
is_equity: bool = False # True = equity contribution, False = liability (castle owes user)
|
||||
is_equity: bool = False # True = equity contribution, False = liability (libra owes user)
|
||||
user_wallet: str
|
||||
reference: Optional[str] = None
|
||||
currency: Optional[str] = None # If None, amount is in satoshis. Otherwise, fiat currency code (EUR, USD, etc.)
|
||||
|
|
@ -111,7 +111,7 @@ class ReceivableEntry(BaseModel):
|
|||
description: str
|
||||
amount: Decimal # Amount in the specified currency (or satoshis if currency is None)
|
||||
revenue_account: str # account name or ID
|
||||
user_id: str # The user_id (not wallet_id) of the user who owes the castle
|
||||
user_id: str # The user_id (not wallet_id) of the user who owes the libra
|
||||
reference: Optional[str] = None
|
||||
currency: Optional[str] = None # If None, amount is in satoshis. Otherwise, fiat currency code
|
||||
|
||||
|
|
@ -127,14 +127,14 @@ class RevenueEntry(BaseModel):
|
|||
currency: Optional[str] = None # If None, amount is in satoshis. Otherwise, fiat currency code
|
||||
|
||||
|
||||
class CastleSettings(BaseModel):
|
||||
"""Settings for the Castle extension"""
|
||||
class LibraSettings(BaseModel):
|
||||
"""Settings for the Libra extension"""
|
||||
|
||||
castle_wallet_id: Optional[str] = None # The wallet ID that represents the Castle
|
||||
libra_wallet_id: Optional[str] = None # The wallet ID that represents the Libra
|
||||
|
||||
# Fava/Beancount integration - ALL accounting is done via Fava
|
||||
fava_url: str = "http://localhost:3333" # Base URL of Fava server
|
||||
fava_ledger_slug: str = "castle-ledger" # Ledger identifier in Fava URL
|
||||
fava_ledger_slug: str = "libra-ledger" # Ledger identifier in Fava URL
|
||||
fava_timeout: float = 10.0 # Request timeout in seconds
|
||||
|
||||
updated_at: datetime = Field(default_factory=lambda: datetime.now())
|
||||
|
|
@ -144,7 +144,7 @@ class CastleSettings(BaseModel):
|
|||
return True
|
||||
|
||||
|
||||
class UserCastleSettings(CastleSettings):
|
||||
class UserLibraSettings(LibraSettings):
|
||||
"""User-specific settings (stored with user_id)"""
|
||||
|
||||
id: str
|
||||
|
|
@ -164,7 +164,7 @@ class StoredUserWalletSettings(UserWalletSettings):
|
|||
|
||||
|
||||
class ManualPaymentRequest(BaseModel):
|
||||
"""Manual payment request from user to castle"""
|
||||
"""Manual payment request from user to libra"""
|
||||
|
||||
id: str
|
||||
user_id: str
|
||||
|
|
@ -173,7 +173,7 @@ class ManualPaymentRequest(BaseModel):
|
|||
status: str = "pending" # pending, approved, rejected
|
||||
created_at: datetime
|
||||
reviewed_at: Optional[datetime] = None
|
||||
reviewed_by: Optional[str] = None # user_id of castle admin who reviewed
|
||||
reviewed_by: Optional[str] = None # user_id of libra admin who reviewed
|
||||
journal_entry_id: Optional[str] = None # set when approved
|
||||
|
||||
|
||||
|
|
@ -198,7 +198,7 @@ class RecordPayment(BaseModel):
|
|||
|
||||
|
||||
class SettleReceivable(BaseModel):
|
||||
"""Manually settle a receivable (user pays castle in person)"""
|
||||
"""Manually settle a receivable (user pays libra in person)"""
|
||||
|
||||
user_id: str
|
||||
amount: Decimal # Amount in the specified currency (or satoshis if currency is None)
|
||||
|
|
@ -213,7 +213,7 @@ class SettleReceivable(BaseModel):
|
|||
|
||||
|
||||
class PayUser(BaseModel):
|
||||
"""Pay a user (castle pays user for expense/liability)"""
|
||||
"""Pay a user (libra pays user for expense/liability)"""
|
||||
|
||||
user_id: str
|
||||
amount: Decimal # Amount in the specified currency (or satoshis if currency is None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue