Skip to content

feat(backend): add PDF inheritance audit report endpoint (#825)#880

Closed
DammyAji wants to merge 6 commits into
Fracverse:masterfrom
DammyAji:feat/pdf-inheritance-audit-reports
Closed

feat(backend): add PDF inheritance audit report endpoint (#825)#880
DammyAji wants to merge 6 commits into
Fracverse:masterfrom
DammyAji:feat/pdf-inheritance-audit-reports

Conversation

@DammyAji

Copy link
Copy Markdown
Contributor

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 #825

DammyAji added 2 commits June 28, 2026 02:02
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
@ONEONUORA

Copy link
Copy Markdown
Contributor

@DammyAji
Run cargo fmt --all -- --check
and clippy

@ONEONUORA

Copy link
Copy Markdown
Contributor

@DammyAji
Update on this Pr
you will be unassign in 6hrs

@ONEONUORA

Copy link
Copy Markdown
Contributor

@DammyAji
Run cargo fmt --all -- --check

@DammyAji

Copy link
Copy Markdown
Contributor Author

@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.

@ONEONUORA

Copy link
Copy Markdown
Contributor

@DammyAji
Pls run it from your terminal again

@ONEONUORA

Copy link
Copy Markdown
Contributor

Run cargo fmt --all -- --check
error: this file contains an unclosed delimiter
--> /home/runner/work/InheritX/InheritX/backend/src/api.rs:1067:3
|
753 | ) -> impl IntoResponse {
| - unclosed delimiter
...
1009 | async fn submit_kyc(Json(_payload): Json) -> impl IntoResponse {
| - unclosed delimiter
...
1067 | }
| ^

Error writing files: failed to resolve mod api: cannot parse /home/runner/work/InheritX/InheritX/backend/src/api.rs
Error: Process completed with exit code 1.

@DammyAji

Copy link
Copy Markdown
Contributor Author

@ONEONUORA ok

DammyAji and others added 2 commits June 29, 2026 05:16
- 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.
@DammyAji

DammyAji commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@ONEONUORA i merged conflicts alraedy

@ONEONUORA

Copy link
Copy Markdown
Contributor

@DammyAji
Git pull
Update your branch
Run cargo fmt --all -- --check
and clippy
Once your implementation passes CI checks
I will review and merge, Then
You earn your point

@DammyAji

DammyAji commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@ONEONUORA ok i will do that

@ONEONUORA ONEONUORA closed this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] Feature: Generate PDF Inheritance Audit Reports

2 participants