modified: index.html
modified: src/App.jsx modified: src/components/AppShell.jsx modified: src/components/featureStateStyles.js modified: src/config/permissions.js modified: src/hooks/useAgenda.js modified: src/mappers/reportMapper.js modified: src/pages/AgendaPage.jsx modified: src/pages/AnalyticsPage.jsx modified: src/pages/AuthPages.jsx modified: src/pages/HomePage.jsx modified: src/pages/MedicalRecordsPage.jsx modified: src/pages/MessagesPage.jsx modified: src/pages/PatientsPage.jsx modified: src/pages/ReportsPage.jsx modified: src/pages/SettingsPage.jsx deleted: src/pages/TeamPage.jsx modified: src/pages/UsersPage.jsx modified: src/repositories/availabilityRepository.js modified: src/repositories/patientRepository.js modified: src/repositories/professionalRepository.js modified: src/repositories/reportRepository.js modified: src/repositories/settingsRepository.js
This commit is contained in:
@@ -18,6 +18,20 @@ export const professionalRepository = {
|
||||
weekdays: ['Seg', 'Ter', 'Qua', 'Qui', 'Sex'],
|
||||
}
|
||||
},
|
||||
|
||||
resolveCurrentProfessional(profile, professionals = []) {
|
||||
const doctorId = normalizeValue(profile?.doctorId)
|
||||
const userId = normalizeValue(profile?.id)
|
||||
const email = normalizeValue(profile?.email)
|
||||
|
||||
return (
|
||||
professionals.find((professional) => normalizeValue(professional.id) === doctorId) ||
|
||||
professionals.find((professional) => normalizeValue(professional.userId) === userId) ||
|
||||
professionals.find((professional) => normalizeValue(professional.id) === userId) ||
|
||||
professionals.find((professional) => normalizeValue(professional.email) === email) ||
|
||||
null
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
function mapProfessional(doctor) {
|
||||
@@ -26,6 +40,7 @@ function mapProfessional(doctor) {
|
||||
userId: doctor.user_id || doctor.userId || doctor.usuario_id || doctor.auth_user_id || null,
|
||||
name: doctor.name || doctor.nome || doctor.full_name || 'Médico(a)',
|
||||
email: doctor.email || doctor.user_email || doctor.usuario_email || '',
|
||||
unit: doctor.unit || doctor.unidade || doctor.clinic_unit || doctor.clinica || doctor.location || '',
|
||||
role: doctor.specialty || doctor.speciality || doctor.especialidade || doctor.role || 'Médico(a)',
|
||||
schedule: doctor.schedule || doctor.agenda || doctor.disponibilidade || 'Seg a Sex, 08h as 18h',
|
||||
nextSlot: doctor.nextSlot || doctor.proximo_horario || doctor.next_slot || 'Consulta pendente',
|
||||
@@ -33,3 +48,7 @@ function mapProfessional(doctor) {
|
||||
status: doctor.status || doctor.situacao || 'Disponivel',
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeValue(value) {
|
||||
return String(value || '').trim().toLowerCase()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user