From 82e5b2cd85a88e94ab20acec234386dd35e8a2fe Mon Sep 17 00:00:00 2001 From: Ulas Date: Tue, 31 Mar 2026 10:13:37 +0200 Subject: [PATCH] feat(budget): auto-generate recurring entry instances per month MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds schema migration v3 (recurrence_parent_id column + budget_recurrence_skipped table). On every GET /api/v1/budget, the server checks all recurring originals (is_recurring=1, no parent) and creates missing instances for the requested month using the same day-of-month (clamped to the last day). Deleted instances are recorded in budget_recurrence_skipped so they are not recreated on the next visit. Generated instances are shown with a ↩ indicator in the transaction list. Closes BL-05. Co-Authored-By: Claude Sonnet 4.6 --- BACKLOG.md | 2 +- CHANGELOG.md | 1 + public/pages/budget.js | 3 +- server/db.js | 16 ++++++++++ server/routes/budget.js | 70 ++++++++++++++++++++++++++++++++++++++--- 5 files changed, 86 insertions(+), 6 deletions(-) diff --git a/BACKLOG.md b/BACKLOG.md index 1ca7fca..52768e8 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -70,7 +70,7 @@ Die Sync-Services `server/services/google-calendar.js` und `server/services/appl ### BL-05 — Budget: Wiederkehrende Buchungen automatisch generieren -**Status:** Offen +**Status:** Erledigt (v0.3.0) **Aufwand:** S (1–2 Tage) Das Budget-Formular hat eine „Wiederkehrend"-Checkbox und speichert `is_recurring = 1`. Es fehlt jedoch die automatische Generierung der Folgebuchungen. Derzeit muss der Nutzer jede Buchung manuell eintragen. diff --git a/CHANGELOG.md b/CHANGELOG.md index ce8ed2b..85bc318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Budget: recurring entries auto-generate instances for each viewed month; instances deleted by the user are skipped permanently via `budget_recurrence_skipped` table; generated instances are marked with ↩ in the transaction list - Budget: month-over-month comparison in summary cards — each card (Einnahmen, Ausgaben, Saldo) shows a trend line (▲/▼ + delta amount vs. previous month); previous month summary is fetched in parallel with current month ## [0.2.1] - 2026-03-30 diff --git a/public/pages/budget.js b/public/pages/budget.js index 0d677ee..301a209 100644 --- a/public/pages/budget.js +++ b/public/pages/budget.js @@ -267,13 +267,14 @@ function renderEntries() { const indClass = isIncome ? 'budget-entry__indicator--income' : 'budget-entry__indicator--expenses'; const sign = isIncome ? '+' : ''; const date = formatEntryDate(e.date); + const recurTag = e.is_recurring ? ' 🔁' : (e.recurrence_parent_id ? ' ↩' : ''); return `
${escHtml(e.title)}
- +
${sign}${formatAmount(e.amount)}