Repository navigation
Service reports with customer signature (PDF) - #33
Merged
Merged
Conversation
Technicians fill a service report on a work order, the customer signs on a canvas pad (PNG, 64 kB cap, magic-byte and dimension checks), and a PDF is generated with pdfkit, downloadable or attached to the client's documents. Access is limited to admins, the assignee and the creator of the work order. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StC4huMbM6BRB9r4XFXvXv
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StC4huMbM6BRB9r4XFXvXv
Download and attach re-saved the report first; with an empty signature pad that PUT dropped the signature that had just been saved, so the PDF came out "Non signé" and attach failed. Skip the save when nothing changed. Also associate the form labels with their fields. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StC4huMbM6BRB9r4XFXvXv
- Validate the PNG for real: chunk walk, no trailing bytes after IEND, no interlacing, IDAT inflated with an output cap (8 MB) that must match the IHDR geometry, so bombs and corrupt streams are refused at save time instead of breaking every later PDF render. - Replace characters Helvetica cannot draw (CJK, Cyrillic, emoji) with "?" instead of printing unrelated glyphs; keep all French accents, oe and euro. - Keep a very long COMPANY_NAME on one line in the header band. - Attach: swap the document link atomically (row lock) so concurrent attaches leave one document, and remove the new file and row if a step fails. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StC4huMbM6BRB9r4XFXvXv
On the CI's Node 20 the decoder maps 0x80-0x9F to control characters, which turned oe, euro and OE into '?'. The character set is now spelled out. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01StC4huMbM6BRB9r4XFXvXv
# Conflicts: # CHANGELOG.md # backend/src/app.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
service_reports(in bothbackend/src/db/schema.jsandbackend/db/init.sql, idempotent). The signature is stored as PNG in a BYTEA column.pdfkit(pure JS, no system libs, fine on node:alpine). Attached PDFs are stored in the uploads dir and listed as ordinary documents; re-attaching replaces the previous one. Header name viaCOMPANY_NAME(default TechIBase).functions-bundle-checkesbuild command passes locally.touch-action: noneon a white surface, so it works on phones.Tests
service-reports.test.js(valid%PDFbuffer, signature validation, authz, create/sign/download/attach/replace).serviceReport.mjs;vite buildOK.Not verified
Generated by Claude Code