feat: export PDF Playwright headless + buildCvHtml serveur (THI-125 — 3/3) - #9
Conversation
|
Warning Review limit reached
More reviews will be available in 16 minutes and 58 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Free Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
Route Nitro POST /api/cv/export-pdf : - Validation Zod du RenderableCv entrant. - assertValidCv (garde-fou provenance, défense en profondeur). - buildCvHtml : HTML auto-suffisant avec CSS A4 inline, echappement XSS, synchronisé avec CvTemplate.vue. - renderHtmlToPdf : Playwright-core + Chrome local (CHROMIUM_EXECUTABLE_PATH pour Docker/CI), @page A4, printBackground, marges 12/14mm. - 7 tests unitaires buildCvHtml (dont XSS, tokens CSS, pagination). Co-Authored-By: Paperclip <noreply@paperclip.ing>
b6178de to
c0a9a8a
Compare
Objet — THI-125 (3/3), export PDF
Dernière brique : route Nitro
POST /api/cv/export-pdfqui génère un PDF A4 à partir d'unRenderableCv, et les utilitaires serveur associés.Ce qui est livré
server/utils/cv-html.ts—buildCvHtml(cv)HTML complet auto-suffisant : tokens inline (synchronisés avec
main.css), CSS A4/print, XSS-escape systématique sur toutes les données entrantes. Aucune dépendance externe (pas de CDN) — prêt pour Chromium headless.server/utils/pdf.ts—renderHtmlToPdf(html)playwright-core+ Chrome système (CHROMIUM_EXECUTABLE_PATHpour Docker/CI, fallback macOS dev).page.pdf({ format: 'A4', printBackground: true, margin: ... }).--no-sandboxpour les containers.server/api/cv/export-pdf.post.tsdiscriminatedUnionsurkind).assertValidCv(garde-fou provenance, défense en profondeur — le moteur THI-124 l'aura déjà fait avant stockage, mais on revalide ici aussi).application/pdf+Content-Disposition: attachment; filename="cv.pdf".7 tests unitaires
buildCvHtmlStructure HTML, nom/accroche, contacts, toutes les sections, puces d'expérience, échappement XSS, tokens CSS.
Variables d'environnement (optionnelles)
CHROMIUM_EXECUTABLE_PATHVérifications locales
pnpm --filter @cvo/app test✅ 13/13 (7 cv-html + 6 health) ·pnpm lint✅DoD final THI-125 ✅
🤖 Generated with Claude Code