feat(areas): Fase 2 — catálogo por área + filtro de área no marketplace

- catálogo (Especialidades/Procedimentos): seletor de área no form + badge colorido na lista
- marketplace de profissionais: filtro por área (via usuario_areas)
- backend: GET/PUT /api/me/areas e /api/clinicas/:id/areas (multi-área de perfil/clínica)
- HybridBackend: getAreas/getMyAreas/setMyAreas
- (Fase 2c pendente: UI multi-área no perfil/configurações da clínica)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
VPS 4 Builder
2026-06-14 07:03:52 +02:00
parent 123234895d
commit cf86be6f6d
5 changed files with 101 additions and 5 deletions
+14
View File
@@ -725,6 +725,20 @@ export const HybridBackend = {
return await res.json();
},
// --- ÁREAS DE ATUAÇÃO (odontologia/biomedicina/prótese) ---
getAreas: async (): Promise<{ slug: string; nome: string; cor: string; icone: string }[]> => {
try { const r = await apiFetch(`${API_URL}/areas`); return r.ok ? await r.json() : []; } catch { return []; }
},
getMyAreas: async (): Promise<string[]> => {
try { const r = await apiFetch(`${API_URL}/me/areas`); const d = r.ok ? await r.json() : {}; return Array.isArray(d?.areas) ? d.areas : []; } catch { return []; }
},
setMyAreas: async (areas: string[]): Promise<boolean> => {
try {
const r = await apiFetch(`${API_URL}/me/areas`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ areas }) });
return r.ok;
} catch { return false; }
},
// Semeia o catálogo de biomedicina estética no workspace ativo (idempotente).
seedBiomedicina: async (): Promise<boolean> => {
const clinicaId = HybridBackend.getActiveWorkspace()?.id || '';