Store a single saved signature per user, like supplier #12

Merged
odweta merged 1 commits from odweta-single-saved-signature into main 2026-09-10 18:07:42 +02:00
odweta commented 2026-09-10 18:07:08 +02:00 (Migrated from github.com)

Why

The signature feature used a named-preset dropdown, inconsistent with how the supplier profile works (one saved profile, loaded automatically for new invoices). This made saving/reusing a signature more cumbersome than it needed to be.

What changed

  • Replaced the signature_presets (multiple named signatures) model with a single signature_profiles row per user, mirroring supplier_profiles.
  • New /api/signature GET/PUT/DELETE endpoints replace /api/signature-presets.
  • db.js migrates any existing preset data into the new table on startup (keeps the most recently created preset per user), so no signatures are lost.
  • Frontend: removed the "Uložený podpis" dropdown and preset name field; added "Uložit podpis" / "Načíst uloženého" buttons like the supplier section. The saved signature now auto-loads when starting a new invoice.
  • Removed now-unused .signature-save-row CSS.

Notes for reviewers

  • The legacy signature_presets table is left in place (not dropped) purely as the source for the one-time migration into signature_profiles; it's no longer written to going forward.
  • Verified with npm test (4 passing) and a syntax check of the edited JS files.
## Why The signature feature used a named-preset dropdown, inconsistent with how the supplier profile works (one saved profile, loaded automatically for new invoices). This made saving/reusing a signature more cumbersome than it needed to be. ## What changed - Replaced the `signature_presets` (multiple named signatures) model with a single `signature_profiles` row per user, mirroring `supplier_profiles`. - New `/api/signature` GET/PUT/DELETE endpoints replace `/api/signature-presets`. - `db.js` migrates any existing preset data into the new table on startup (keeps the most recently created preset per user), so no signatures are lost. - Frontend: removed the "Uložený podpis" dropdown and preset name field; added "Uložit podpis" / "Načíst uloženého" buttons like the supplier section. The saved signature now auto-loads when starting a new invoice. - Removed now-unused `.signature-save-row` CSS. ## Notes for reviewers - The legacy `signature_presets` table is left in place (not dropped) purely as the source for the one-time migration into `signature_profiles`; it's no longer written to going forward. - Verified with `npm test` (4 passing) and a syntax check of the edited JS files.
Sign in to join this conversation.