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:
@@ -86,14 +86,19 @@ export const availabilityRepository = {
|
||||
return mapException(normalizeItem(await response.json()))
|
||||
},
|
||||
|
||||
async getAvailableSlots({ date, doctorId }) {
|
||||
async getAvailableSlots({ appointmentType, date, doctorId }) {
|
||||
const payload = {
|
||||
doctor_id: doctorId,
|
||||
date,
|
||||
start_date: date,
|
||||
end_date: date,
|
||||
appointment_type: normalizeAppointmentType(appointmentType),
|
||||
}
|
||||
|
||||
const response = await fetch(`${apiConfig.functionsUrl.replace(/\/+$/, '')}/get-available-slots`, {
|
||||
method: 'POST',
|
||||
headers: getAuthenticatedHeaders(),
|
||||
body: JSON.stringify({
|
||||
doctor_id: doctorId,
|
||||
date,
|
||||
}),
|
||||
body: JSON.stringify(payload),
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -174,11 +179,19 @@ function mapException(item) {
|
||||
|
||||
function mapSlot(slot) {
|
||||
return {
|
||||
date: slot.date,
|
||||
datetime: slot.datetime,
|
||||
time: slot.time,
|
||||
available: Boolean(slot.available),
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeAppointmentType(type) {
|
||||
// API enum documented for availability currently accepts "presencial".
|
||||
void type
|
||||
return 'presencial'
|
||||
}
|
||||
|
||||
function cleanPayload(payload) {
|
||||
return Object.fromEntries(
|
||||
Object.entries(payload).filter(([, value]) => value !== undefined),
|
||||
|
||||
Reference in New Issue
Block a user