gohorsejobs/backend/internal/utils
Tiago Yamamoto 3a26af3df5 fix: global document and phone handling — remove Brazil-specific formatting
Frontend (jobs/new):
- Replace isValidCNPJ (checksum algorithm) with isValidDocument: accepts
  any tax document with 5–30 alphanumeric chars (CNPJ, EIN, VAT, etc.)
- Add cleanPhone(): strips formatting chars (dashes, spaces, parens) and
  keeps only digits + optional leading '+'; replaces cleanDigits+prepend
- Phone sent as '+5511999998888' if user typed '+55...', or '11999998888'
  if no country code was provided — no '+' blindly prepended anymore
- Company document sent stripped of all non-alphanumeric before API call
- Update label placeholder from '00.000.000/0000-00' to 'CNPJ, EIN, VAT...'
- Rename error key invalidCnpj → invalidDocument in all 3 locales (pt, en, es)

Backend (create_company use case):
- Add SanitizePhone() to utils/sanitizer.go: strips all non-digit chars
  except a leading '+'; '(11) 99999-8888' → '11999998888'
- Apply SanitizePhone to input.Phone before persisting to DB

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 12:46:54 -06:00
..
uuid refactor: clean up legacy UUID v4, use UUID v7 everywhere 2025-12-24 11:29:55 -03:00
document_validator.go feat: implementar múltiplas features 2025-12-27 11:19:47 -03:00
jwt.go first commit 2025-12-09 19:04:48 -03:00
password.go first commit 2025-12-09 19:04:48 -03:00
sanitizer.go fix: global document and phone handling — remove Brazil-specific formatting 2026-02-22 12:46:54 -06:00
sanitizer_test.go test: increase backend test coverage - sanitizer, middleware, handlers, services 2025-12-28 01:48:12 -03:00