pelagia-portal/App/tests
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
..
e2e chore: rename e2e folder to catalogue + drop /inventory redirects 2026-06-24 05:06:44 +05:30
fixtures test(integration): repair stale integration suite (wip: 97/108) 2026-06-21 02:34:07 +05:30
integration feat(pdf): cache the PO PDF per vendor email, refresh only the link timer 2026-06-24 15:01:25 +05:30
staging test(staging): feature-level verification of closed issues + seeded test users 2026-06-24 11:49:48 +05:30
unit Merge pull request 'feat(reports): Purchasing spend analytics (Cost Centres + Accounting Codes)' (#117) from feat/reports into master 2026-06-24 06:03:28 +00:00
setup.ts chore: restructure repo — flatten App/pelagia-portal to App, rename Prototype→Wireframe and Spec→Design 2026-05-18 23:18:58 +05:30