25 Commits

Author SHA1 Message Date
fb578b2a7a feat(api): add server-side /api/create-user route (user creation not functional yet)
- What was done:
  - Added a server-side Next.js route at `src/app/api/create-user/route.ts` that validates the requester token, checks roles, generates a temporary password and forwards the creation to the Supabase Edge Function using the service role key.
  - Client wired to call the route via `lib/config.ts` (`FUNCTIONS_ENDPOINTS.CREATE_USER` -> `/api/create-user`) and the `criarUsuario()` wrapper in `lib/api.ts`.
- Status / missing work:
  - Important: user creation is NOT working yet (requests to `/api/create-user` return 404 in dev).
  - Next steps: restart dev server, ensure `SUPABASE_SERVICE_ROLE_KEY` is set in the environment, check server logs and run a test POST with a valid admin JWT.
2025-10-14 17:02:26 -03:00
05123e6c8f feat(auth): persist roles and support multi-role in ProtectedRoute
- Persist `roles` array in localStorage on login and session restore.
- Reconcile `userType` from roles returned by the `user-info` function.
- `ProtectedRoute` now accepts `requiredUserType?: UserType[]` and `requiredRoles?: string[]` and evaluates multi-role permission (OR semantics).
- Minor adjustments in `useAuth` and debug logs to ensure consistent `profile` and `roles` restoration.
- Main files changed: `hooks/useAuth.tsx`, `components/ProtectedRoute.tsx`, `types/auth.ts.
2025-10-13 02:18:49 -03:00
João Gustavo
d6cf44b1d4 fixing-user-endpoint 2025-10-11 23:49:16 -03:00
João Gustavo
1a471357b7 add-userID 2025-10-11 22:30:05 -03:00
João Gustavo
8bf953a689 add-assignament-endpoints 2025-10-11 19:20:26 -03:00
5698a5faa9 feat(api): Standardizes CRUD for profiles and derivations
- Standardizes listing/searching/creating/updating/deleting for profiles
- Adds UI for assigning professionals
- Integrates UI into patient listing (menu item)
- Corrects hydration mismatch in ProtectedRoute
2025-10-11 18:50:56 -03:00
25a0df3dca Merge branch 'feature/fix-report-endpoints' into feature/add-duties-enpoints 2025-10-11 12:38:38 -03:00
c62883a5cc chore(api):remove unnecessary comments 2025-10-11 12:24:48 -03:00
João Gustavo
a1b801b068 fix-endpoints 2025-10-10 23:27:43 -03:00
João Gustavo
f934c0f33c add-list-and-edit-report-endpoitns 2025-10-10 19:46:31 -03:00
aeed6f3f0d feat(api): Ajustar fluxo de criação de usuários e mensagens de erro
- Removido fallback Direct Auth no frontend

- Removida tentativa de atribuir role no cliente

- Mensagens de erro aprimoradas para 'failed to assign user role' e email duplicado

- Atualizados formulários de médico e paciente para instruções claras
2025-10-10 16:40:04 -03:00
João Gustavo
2bb0b06375 add-create-report-endpoints 2025-10-10 03:04:10 -03:00
João Gustavo
6951dcec96 add-report-endpoints 2025-10-08 21:40:06 -03:00
João Gustavo
a994a70d90 atualizing-api.ts 2025-10-06 23:24:57 -03:00
João Gustavo
6030263128 add-doctor-edit 2025-10-02 02:51:18 -03:00
João Gustavo
8d1473a148 add-doctor-id 2025-10-02 01:49:54 -03:00
ed6e33890a merge(feature/correc-api): merge branch 'feature/correc-api' into feature/ajustes-form-medico 2025-10-02 01:14:18 -03:00
a032465773 feat(doctor-form): add search doctor by ID button and logic to registration form 2025-10-02 00:54:43 -03:00
João Gustavo
b2ee5987c6 correcting-id-endpoint 2025-10-02 00:44:45 -03:00
ea63a73b43 feat(api): implementações e ajustes nas APIs de médicos e pacientes 2025-10-01 23:40:01 -03:00
84cb4c36eb feat(api): add doctors and patients API integration 2025-09-30 13:57:43 -03:00
João Gustavo
a6ae27876e add-login-and-logout-endpoints 2025-09-28 04:10:40 -03:00
791d31a5a6 feat(api): implementação e integração das APIs de médicos 2025-09-18 13:58:52 -03:00
a7c9c90ebb chore: update components config 2025-09-11 22:09:50 -03:00
b2a9ea047a feat(api): add and wire all mock endpoints
- Patients: list, get by id, create, update, delete
- Photo: upload, remove
- Attachments: list, add, remove
- Validations: validate CPF, lookup CEP
- Hook up env vars and shared fetch wrapper
2025-09-10 22:00:32 -03:00