pelagia-portal/App/app/(portal)
Hardik a9fd927c1f
All checks were successful
PR checks / checks (pull_request) Successful in 47s
PR checks / integration (pull_request) Successful in 31s
feat(pdf): cache the PO PDF per vendor email, refresh only the link timer
Previously every "Email to vendor" click re-rendered the PO via PdfService and
re-uploaded to R2 under a timestamped key — wasteful, and it orphaned a new
object each time.

Now the PDF is stored at a deterministic per-PO key (buildPoPdfKey →
po-pdf/<poId>/<slug>.pdf). On each send, statObject() checks for an existing
copy: if it exists and is at least as new as the PO's updatedAt, it's reused
(no re-render, no re-upload) and only a fresh presigned URL is minted —
refreshing the 7-day download timer. It re-renders only when there's no copy
yet or the PO changed since the cached one (so an edited PO never emails a
stale PDF).

- lib/storage.ts: buildPoPdfKey (deterministic) + statObject (HEAD/stat, no
  body transfer; null when absent).
- email-actions.ts: reuse-or-render decision keyed on updatedAt; always
  re-presign.
- Tests: +2 (reuse-on-second-send-only-refreshes-link, re-render-when-changed).
  email-vendor suite 8 green; tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 15:01:25 +05:30
..
admin fix(vendors): move GSTIN CAPTCHA into a popup 2026-06-24 06:37:29 +05:30
approvals Merge pull request 'fix: On new PO screen Vendors should have search' (#110) from claude/issue-109 into master 2026-06-23 23:52:47 +00:00
catalogue refactor(routes): move /inventory/{items,vendors} → /catalogue/{items,vendors} 2026-06-24 05:04:29 +05:30
crewing fix(crewing): make rank-held universal, ex-hand an admin-only flag 2026-06-23 21:33:50 +05:30
dashboard feat(dashboard): compact INR formatting for Total Approved Spend card 2026-06-21 02:02:41 +05:30
history feat(history): paginate PO history with items-per-page control 2026-06-24 03:26:47 +05:30
inventory/cart refactor(routes): move /inventory/{items,vendors} → /catalogue/{items,vendors} 2026-06-24 05:04:29 +05:30
my-orders fix(my-orders): correct closed PO filters for manager and submitter 2026-06-19 03:34:21 +05:30
payments feat(po): register line items in the product catalogue on approval 2026-06-24 04:59:47 +05:30
po feat(pdf): cache the PO PDF per vendor email, refresh only the link timer 2026-06-24 15:01:25 +05:30
profile feat(crewing): foundations — SITE_STAFF role, ranks reference data + admin (flagged) 2026-06-22 13:26:04 +05:30
reports fix(reports): chart series all rendered one colour (RSC boundary bug) 2026-06-24 12:31:40 +05:30
layout.tsx chore: restructure repo — flatten App/pelagia-portal to App, rename Prototype→Wireframe and Spec→Design 2026-05-18 23:18:58 +05:30