// Caminho: services/pacientesApi.ts import api from './api'; export interface Patient { id: any; full_name: string; cpf: string; [key: string]: any; } export const pacientesApi = { list: async (): Promise => { const response = await api.get('/rest/v1/patients?select=*'); return response.data; }, getById: async (id: string): Promise => { const response = await api.get(`/rest/v1/patients?id=eq.${id}&select=*`, { headers: { Accept: 'application/vnd.pgrst.object+json' }, }); return response.data; }, create: async (data: Omit): Promise => { const response = await api.post('/rest/v1/patients', data, { headers: { 'Prefer': 'return=representation' } }); return response.data[0]; }, update: async (id: string, data: Partial): Promise => { const response = await api.patch(`/rest/v1/patients?id=eq.${id}`, data, { headers: { 'Prefer': 'return=representation' } }); return response.data[0]; }, delete: async (id: string): Promise => { await api.delete(`/rest/v1/patients?id=eq.${id}`); }, };