Filter inactive accounts from default queries

- Updated get_all_accounts() to add include_inactive parameter (default False)
- Updated get_accounts_by_type() to add include_inactive parameter (default False)
- Modified account_sync to use include_inactive=True (needs to see all accounts)
- Default behavior now hides inactive accounts from user-facing API endpoints

This ensures inactive accounts are automatically hidden from users while
still allowing internal operations (like sync) to access all accounts.
This commit is contained in:
padreug 2025-11-11 01:57:42 +01:00
parent cb62cbb0a2
commit 657e3d54da
2 changed files with 37 additions and 13 deletions

View file

@ -135,8 +135,8 @@ async def sync_accounts_from_beancount(force_full_sync: bool = False) -> dict:
"errors": [str(e)],
}
# Get all accounts from Castle DB
castle_accounts = await get_all_accounts()
# Get all accounts from Castle DB (including inactive ones for sync)
castle_accounts = await get_all_accounts(include_inactive=True)
# Build lookup maps
beancount_account_names = {acc["account"] for acc in beancount_accounts}