feat(digest): weekly spending digest — APScheduler + HTML email + REST endpoints#1069
Open
Entr0zy wants to merge 1 commit into
Open
feat(digest): weekly spending digest — APScheduler + HTML email + REST endpoints#1069Entr0zy wants to merge 1 commit into
Entr0zy wants to merge 1 commit into
Conversation
…h08#121) Implements the weekly digest feature requested in issue rohitdash08#121. ## What changed ### New: packages/backend/app/services/digest.py - build_weekly_digest(uid, reference_date) - aggregates the past 7 days of EXPENSE transactions: total spend, category breakdown (top 3), week-over-week % change vs the prior 7-day window, and the largest single expense. - render_digest_html(data) - renders digest data into a styled HTML email (inline CSS, no extra template-engine dependency). - send_weekly_digest(user) - builds and emails a digest to one user. - send_all_weekly_digests() - fan-out over all users. - init_digest_scheduler(app) - APScheduler job every Monday at 08:00. ### New: packages/backend/app/routes/digest.py - GET /digest/preview - returns digest JSON for the authenticated user. - POST /digest/send-test - immediately emails the digest (202 if SMTP not configured). ### Modified: routes/__init__.py and app/__init__.py - Registers blueprint and initialises scheduler on startup. ### New: packages/backend/tests/test_digest.py - 14 tests: aggregation, income exclusion, 7-day boundary, WoW change, top-3 cap, send-test, JWT protection, HTML renderer. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
✅ Live Demo — Weekly Digest (
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/claim #121
What this PR adds
A complete weekly digest system for FinMind that aggregates each user's last 7 days of spending and delivers a formatted HTML summary email every Monday morning.
Changes
packages/backend/app/services/digest.py(new)build_weekly_digest(uid, reference_date)render_digest_html(data)send_weekly_digest(user)send_all_weekly_digests(){"sent": N, "failed": M}init_digest_scheduler(app)packages/backend/app/routes/digest.py(new)GET /digest/previewPOST /digest/send-testModified files
app/routes/__init__.py— registersdigestblueprint at/digestapp/__init__.py— callsinit_digest_scheduler(app)on startup (skipped whenTESTING=trueorDISABLE_SCHEDULERis set)packages/backend/tests/test_digest.py(new — 14 tests)send-testendpoint (202 when SMTP unconfigured)Verification