fix(scheduling): fix schedule save endpoint, time format, and calendar load
Critical fixes for the scheduling flow:
- ScheduleEntity: add toScheduleDto() with snake_case keys, day_of_week,
and HH:MM zero-padded format required by the backend DTO @Matches validator
- Schedules: add toSchedulesArray() converting the day-keyed object to the
array format expected by PATCH /professionals/me/schedules
- ProfessionalFormProvider: updateProfesionalProfileScheduleInfo now calls
the correct endpoint (/professionals/me/schedules) instead of /professionals/me
which was stripping the schedules field via ValidationPipe whitelist
- Service.formatTimeOfDay: zero-pad hours and minutes so POST /services passes
the @Matches(/^\d{2}:\d{2}$/) DTO validation
- ProfessionalProvider: add getProfessionalById() calling /professionals/:id
(public endpoint) to load any professional's data, not the viewer's own
- CalendarServicesProvider: add getPublicServicesForProfessional() calling
/services/public-calendar/:id so the user calendar shows the target
professional's booked slots, not the viewer's own services
- CalendarView: use getProfessionalById + getPublicServicesForProfessional
so the calendar correctly reflects the selected professional's schedule
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
360f88777b
commit
498481cab0
@@ -45,12 +45,14 @@ class _CalendarViewState extends State<CalendarView> {
|
||||
final proProvider =
|
||||
Provider.of<ProfessionalProvider>(context, listen: false);
|
||||
|
||||
// Use public endpoint so we get THIS professional's schedule, not the viewer's own
|
||||
final professional =
|
||||
await proProvider.getProfessional(widget.professionalId);
|
||||
await proProvider.getProfessionalById(widget.professionalId);
|
||||
professionalFormProvider.setProfesional(professional);
|
||||
|
||||
// Use public calendar endpoint to get services for this specific professional
|
||||
final services =
|
||||
await servicesProvider.getServicesForProfessional(professional.id);
|
||||
await servicesProvider.getPublicServicesForProfessional(professional.id);
|
||||
setState(() {
|
||||
_services = services;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user