feat(backend): add PDF inheritance audit report endpoint (#825)#880
feat(backend): add PDF inheritance audit report endpoint (#825)#880DammyAji wants to merge 6 commits into
Conversation
Add GET /api/plans/:id/report endpoint that generates and returns a downloadable PDF inheritance audit report. Changes: - backend/Cargo.toml: add printpdf = '0.7' dependency - backend/src/pdf_report.rs: new module; build_pdf_bytes(ReportData) uses printpdf BuiltinFont (no external font files), renders plan overview, owner, activity log, and beneficiary table - backend/src/api.rs: add get_plan_report handler; loads plan + beneficiaries from DB, computes live accrued yield, offloads PDF construction to tokio::task::spawn_blocking to avoid blocking the async executor, returns bytes with Content-Type: application/pdf and Content-Disposition: attachment headers - backend/src/lib.rs: register pdf_report module Security: endpoint is public (plan UUID acts as capability token); no sensitive data beyond what the plan owner already stored is exposed. Async safety: printpdf is synchronous; PDF generation is wrapped in spawn_blocking so it runs on a dedicated thread pool and never blocks the Tokio runtime. Closes Fracverse#825
Add GET /api/plans/:id/report endpoint that generates and returns a downloadable PDF inheritance audit report. Changes: - backend/Cargo.toml: add printpdf = '0.7' dependency - backend/src/pdf_report.rs: new module; build_pdf_bytes(ReportData) uses printpdf BuiltinFont (no external font files), renders plan overview, owner, activity log, and beneficiary table - backend/src/api.rs: add get_plan_report handler; loads plan + beneficiaries from DB, computes live accrued yield, offloads PDF construction to tokio::task::spawn_blocking to avoid blocking the async executor, returns bytes with Content-Type: application/pdf and Content-Disposition: attachment headers - backend/src/lib.rs: register pdf_report module Security: endpoint is public (plan UUID acts as capability token); no sensitive data beyond what the plan owner already stored is exposed. Async safety: printpdf is synchronous; PDF generation is wrapped in spawn_blocking so it runs on a dedicated thread pool and never blocks the Tokio runtime. Closes Fracverse#825
|
@DammyAji |
|
@DammyAji |
|
@DammyAji |
|
@ONEONUORA Thank you for the feedback. i ran this Run cargo fmt --all -- --check and it worked when i pushed PR. i do not know why it keeps failing. Also i have no merge conflicts. |
|
@DammyAji |
|
Run cargo fmt --all -- --check Error writing files: failed to resolve mod |
|
@ONEONUORA ok |
- Resolve unresolved merge conflict markers in backend/src/pdf_report.rs - Remove stray ' master' text from backend/src/api.rs - Add missing get_plan_report handler function signature - Restore chrono import and proper formatting in api.rs - Restore redis dependency in Cargo.toml (still used by cache/config) - Remove unused ApiError/ApiResponse struct from api.rs Fixes cargo fmt 'unclosed delimiter' error reported in CI.
|
@ONEONUORA i merged conflicts alraedy |
|
@DammyAji |
|
@ONEONUORA ok i will do that |
Add GET /api/plans/:id/report endpoint that generates and returns a downloadable PDF inheritance audit report.
Changes:
Security: endpoint is public (plan UUID acts as capability token); no sensitive data beyond what the plan owner already stored is exposed.
Async safety: printpdf is synchronous; PDF generation is wrapped in spawn_blocking so it runs on a dedicated thread pool and never blocks the Tokio runtime.
Closes #825