docs: PDF middleware svc-bypass + per-PO caching (merged #127/#128)

shad0w 2026-06-24 10:20:47 +00:00
parent 2bf044404e
commit 09d9fb9f76

@ -63,7 +63,11 @@ defaults (GST/EPFO stay stub-capable; PdfService skips token checks).
renders the app's `/api/po/<id>/export?…&svc=<token>` page (the token lets it
fetch without a user session), uploads the PDF to R2, and the app returns a
`mailto:` with a **7-day** presigned link. `APP_INTERNAL_URL` is the URL
PdfService uses to reach the app (defaults to `NEXTAUTH_URL`).
PdfService uses to reach the app (defaults to `NEXTAUTH_URL`). The auth
middleware lets the `svc`-token export request through (`lib/pdf-export-auth.ts`
— without it the unauthenticated render is bounced to `/login`), and the rendered
PDF is **cached per PO** at a deterministic key: repeat sends reuse the stored
copy and only mint a fresh 7-day link, re-rendering only when the PO changed.
## Release & deploy flow