feat(pdf): cache the PO PDF per vendor email (reuse copy, refresh 7-day link) #128
No reviewers
Labels
No labels
bug
claude-failed
claude-pr
claude-queue
claude-working
epic
feature
interactive
portal
triaged
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: shad0w/pelagia-portal#128
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/po-pdf-cache"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds caching to "Email PO to vendor" so the same PO reuses its exported PDF and only refreshes the download-link timer.
Before
Every send re-rendered the PO via PdfService and re-uploaded to R2 under a timestamped key — wasteful (full Chromium render each click) and it orphaned a fresh object every time.
Now
buildPoPdfKey→po-pdf/<poId>/<slug>.pdf(no timestamp).statObject(key)does a lightweight HEAD/stat (no body transfer):po.updatedAt→ reuse it, no re-render / no re-upload, and mint a fresh presigned URL → the 7-day timer restarts.So repeat sends for the same unchanged PO are cheap and always hand out a link valid for another 7 days; a changed PO regenerates.
Verification
tscclean.email-vendorintegration suite 8 passed, including two new cases:Independent of the middleware fix (#127) — different files; both are needed for "Email to vendor" to work well on prod.
🤖 Generated with Claude Code