276 Commits

Author SHA1 Message Date
VPS 4 Builder 2f3c0420e3 feat(routing): switch from hash routing to HTML5 History API
Remove all window.location.hash assignments and hashchange events.
Navigate with history.pushState; listen on popstate. Fix base href to
'/' so assets resolve correctly on deep paths. Update magic link URL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 04:44:53 +02:00
VPS 4 Builder edf04c9735 Merge branch 'claude/youthful-mendel-0c569f' 2026-05-14 04:26:07 +02:00
VPS 4 Builder 435176c0c3 fix(backend): add camelCase response mapping for all GET endpoints
PG stores columns lowercase but frontend expects camelCase. Each GET endpoint
now maps the response to include camelCase aliases alongside the lowercase fields.

- agendamentos: dentistaId, pacienteNome, pacienteCelular
- dentistas: corAgenda
- procedimentos: especialidadeId, especialidadeNome, valorParticular, codigoInterno;
  fix valoresPlanos filter (v.procedimentoid) and map planoId, planoNome, codigoPlano
- guias: full camelCase map (dataSolicitacao, beneficiarioNome, tipoTratamento, etc.)
- gto-builder: map items (builderId, procedimentoId, codigoTUSS, valorTotal, etc.)
  and builder fields (pacienteId, dentistaId, credenciadaId)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 04:26:03 +02:00
VPS 4 Builder 18b846d78d Merge branch 'claude/youthful-mendel-0c569f' 2026-05-14 04:18:31 +02:00
VPS 4 Builder 38bbf36735 fix(backend): lowercase all column names in buildInsert/buildUpdate and explicit queries
All PostgreSQL columns are stored lowercase (PG folds unquoted identifiers).
The previous code quoted camelCase keys ("corAgenda", "builderId", etc.) which
caused column-not-found errors.

- buildInsert: k.toLowerCase() for all column names, no more double-quotes
- buildUpdate: k.toLowerCase() for SET clause and WHERE column
- dentistas/register: "corAgenda" → coragenda
- procedimentos PUT: "procedimentoId" → procedimentoid in DELETE
- gto_builders INSERT: "pacienteId"/"dentistaId"/"credenciadaId" → lowercase
- gto_items queries: "builderId" → builderid, "valorTotal" → valortotal
- guias: "dataSolicitacao"/"beneficiarioNome"/etc → lowercase with normalizedSort

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 04:18:29 +02:00
VPS 4 Builder 7c41fa09ed chore(frontend): adiciona @types/react e @types/react-dom 2026-05-14 04:09:41 +02:00
VPS 4 Builder f0f24e8a68 chore: atualiza .gitignore e adiciona package-lock.json do frontend 2026-05-14 04:08:47 +02:00
VPS 4 Builder 3456d26cbc feat(frontend): restore 3s preloader initialization view in LoginView 2026-05-13 23:30:47 +02:00
VPS 4 Builder e61ef6c0ca fix(backend): move procedimentos/reorder before /:id to prevent route shadowing
Express matches routes in registration order. PUT /procedimentos/:id was
registered before /procedimentos/reorder, causing 'reorder' to be captured
as an id param and the reorder endpoint to be unreachable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 23:20:39 +02:00
VPS 4 Builder a0ab095923 refactor(backend): migrate all queries to native PostgreSQL, remove MySQL shim
- Remove translateQuery function, pool.query override, and pool.getConnection mock entirely
- Replace all ? placeholders with $N positional parameters throughout
- Replace INSERT INTO t SET ? with buildInsert() helper across pacientes, dentistas, especialidades, planos, procedimentos, financeiro, leads, gto_items
- Replace UPDATE t SET ? WHERE id = ? with buildUpdate() helper across the same tables
- Replace all pool.getConnection()/beginTransaction/commit/rollback blocks with withTransaction()
- Convert ON DUPLICATE KEY UPDATE to ON CONFLICT DO UPDATE SET in dentistas/register (usuarios, vinculos, dentistas tables)
- Fix dentistas/register to use withTransaction instead of SET FOREIGN_KEY_CHECKS
- Fix all [rows] array destructuring to { rows } object destructuring (PG native result shape)
- Fix guias dynamic WHERE builder to use incrementing $N parameter indices
- Fix double-quoted string literal bug in procedimentos categoria query ("Particular" → 'Particular')
- Quote camelCase column names in gto_items/gto_builders queries ("builderId", "valorTotal", etc.)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 23:13:35 +02:00
VPS 4 Builder 26a10ac4f7 fix(nav): corrige sistema de navegação pós-login e sincronização de URL
Causa raiz do login não navegar: getCurrentRole() retornava null quando
vinculos.role era NULL no banco, fazendo isViewAllowed() retornar false
e handleNavigate() falhar silenciosamente sem nenhum feedback.

Fixes:
- backend.ts: getCurrentRole usa workspace?.role || 'paciente' para
  garantir que nunca retorne null/undefined
- App.tsx: onLoginSuccess usa setCurrentView+navigate diretamente,
  sem passar pela guarda de permissão (desnecessária pós-autenticação)
- App.tsx: mount effect sempre chama navigate(currentView) para sincronizar
  a URL com a view real — antes só executava com hash vazio, deixando
  /#/login na URL ao recarregar com usuário autenticado
- LoginView.tsx: remove spinner isInitializing de 3s que bloqueava o
  formulário em toda montagem do componente

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 22:56:30 +02:00
VPS 4 Builder 1330147eaf fix: corrige inconsistências críticas de backend e navegação
- Backend: substitui string literals com aspas duplas por aspas simples
  nas queries PostgreSQL (settings, GTO builder, google_tokens delete)
- Backend: corrige alias SQL 'dentistanome' para 'dentistaNome' (quoted)
  e ajusta frontend para usar 'pacientenome' (lowercase do PG)
- Backend: move app.listen() para após todas as rotas registradas
- Backend: ativa generateIntelligentNotifications no startup + intervalo 5min
- Backend: magic link usa process.env.APP_URL em vez de localhost:3000 hardcoded
- Frontend: adiciona 'relatorios' às permissões do role 'funcionario'
- Frontend: adiciona onClick ao botão Relatórios do Dashboard
- Frontend: adiciona Content-Type e JWT token em salvarAgendamento/atualizarAgendamento
- Frontend: MeusTratamentos passa JWT token nas chamadas a /api/guias
- Frontend: ClinicasView passa JWT token no endpoint de atualização de cor
- Frontend: corrige subtítulo 'MYSQL + GOOGLE' para 'POSTGRESQL + GOOGLE'

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 21:43:23 +02:00
VPS 4 Builder 34129d4528 chore: remove base directory from git tracking as requested 2026-05-13 21:28:02 +02:00
VPS 4 Builder 8a138cefac feat(frontend): increase preloader duration to 3s and bump version to V1.0.2 2026-05-13 20:12:35 +02:00
VPS 4 Builder 0f71db2205 fix(backend): correct lowercase column names in dashboard stats query (datavencimento, dentistaid); fix notificacoes routes to use PG syntax; exclude base/ from .gitignore 2026-05-13 15:54:01 +02:00
VPS 4 Builder b9dd79d484 fix(frontend): remove node types from frontend tsconfig to clear IDE warning 2026-05-13 15:41:15 +02:00
VPS 4 Builder 8c02daf666 fix(base): remove node types from backup tsconfig to clear IDE warning 2026-05-13 15:36:42 +02:00
VPS 4 Builder abd56fcc6f fix(frontend): remove duplicated keys in backend.ts 2026-05-13 15:32:57 +02:00
VPS 4 Builder c16ec80780 fix(frontend): remove syntax errors in backend.ts 2026-05-13 15:31:30 +02:00
VPS 4 Builder 3416845c28 feat(frontend): Add V1.0.1 preloader and version string to LoginView 2026-05-13 10:11:33 +02:00
VPS 4 Builder 526495db96 fix(frontend): Resolve login redirection and inject JWT token on requests 2026-05-13 10:04:49 +02:00
VPS 4 Builder e260eed28b fix(backend): Convert legacy queries and add translate wrapper 2026-05-13 09:53:00 +02:00
Antigravity AI Agent 9d10fed38e feat: complete relative api route integration and container build 2026-05-13 07:50:15 +02:00
Antigravity AI Agent 606da6de97 feat: migrate ScoreOdonto CRM to Docker, PostgreSQL, and DragonflyDB 2026-05-13 07:13:41 +02:00
Antigravity AI Agent 4917d03bdf chore: clean up codebase content, keeping only the environment and infrastructure configurations 2026-05-13 05:21:31 +02:00
Antigravity AI Agent 19dbbae8b8 chore: initial setup with PostgreSQL, DragonflyDB, and Nginx routing configs 2026-05-13 05:12:32 +02:00