REFACTOR Migrates to single 'amount' field for transactions
Refactors the data model to use a single 'amount' field for journal entry lines, aligning with the Beancount approach. This simplifies the model, enhances compatibility, and eliminates invalid states. Includes a database migration to convert existing debit/credit columns to the new 'amount' field. Updates balance calculation logic to utilize the new amount field for improved accuracy and efficiency.
This commit is contained in:
parent
0b50ba0f82
commit
5cc2630777
7 changed files with 196 additions and 144 deletions
|
|
@ -42,16 +42,14 @@ class EntryLine(BaseModel):
|
|||
id: str
|
||||
journal_entry_id: str
|
||||
account_id: str
|
||||
debit: int = 0 # in satoshis
|
||||
credit: int = 0 # in satoshis
|
||||
amount: int # in satoshis; positive = debit, negative = credit
|
||||
description: Optional[str] = None
|
||||
metadata: dict = {} # Stores currency info: fiat_currency, fiat_amount, fiat_rate, etc.
|
||||
|
||||
|
||||
class CreateEntryLine(BaseModel):
|
||||
account_id: str
|
||||
debit: int = 0
|
||||
credit: int = 0
|
||||
amount: int # in satoshis; positive = debit, negative = credit
|
||||
description: Optional[str] = None
|
||||
metadata: dict = {} # Stores currency info
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue