feat: Buchungen serverseitig nach Spalte sortierbar (A11-T5)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-28 19:29:25 +02:00
co-authored by Claude Opus 5.5
parent 2a5cd141f2
commit b1e007ed15
4 changed files with 150 additions and 14 deletions
+8 -1
View File
@@ -25,7 +25,7 @@ from app.routers.planning import list_planned as _list_planned
from app.routers.planning import list_recurring as _list_recurring
from app.routers.planning import recurring_suggestions as _recurring_suggestions
from app.routers.scenarios import list_scenarios as _list_scenarios
from app.routers.transactions import count_transactions, list_transactions
from app.routers.transactions import count_transactions, list_transactions, normalize_sort
from app.services.balances import account_balance, total_balance
from app.services.planning_chart import refresh_planning_chart
from app.services.projection_service import refresh_stale_projections
@@ -168,6 +168,8 @@ def buchungen(
q: str | None = None,
status: str = "confirmed",
page: int = 1,
sort: str = "datum",
dir: str = "asc",
session: Session = Depends(get_session),
):
# HTML-Filterformular sendet leere Strings fuer nicht ausgefuellte Felder -
@@ -179,6 +181,7 @@ def buchungen(
date_to = _opt_date(date_to)
category_id = _opt_int(category_id)
page = max(1, page)
sort, dir = normalize_sort(sort, dir)
total = count_transactions(
account_id=account_id,
date_from=date_from,
@@ -197,6 +200,8 @@ def buchungen(
category_id=category_id,
q=q,
status=status,
sort=sort,
dir=dir,
limit=PAGE_SIZE,
offset=(page - 1) * PAGE_SIZE,
session=session,
@@ -217,6 +222,8 @@ def buchungen(
},
"page": page,
"total_pages": total_pages,
"sort": sort,
"dir": dir,
})