diff --git a/zmscitizenapi/src/Zmscitizenapi/Services/Core/ZmsApiFacadeService.php b/zmscitizenapi/src/Zmscitizenapi/Services/Core/ZmsApiFacadeService.php index 773e60149..27898fde0 100644 --- a/zmscitizenapi/src/Zmscitizenapi/Services/Core/ZmsApiFacadeService.php +++ b/zmscitizenapi/src/Zmscitizenapi/Services/Core/ZmsApiFacadeService.php @@ -480,15 +480,16 @@ public static function getAvailableAppointments(string $date, array $officeIds, return new AvailableAppointments(array_values($timestamps)[0]); } - private static function processFreeSlots(ProcessList $freeSlots): array { + private static function processFreeSlots(ProcessList $freeSlots): array + { $errors = ValidationService::validateGetProcessFreeSlots($freeSlots); if (is_array($errors) && !empty($errors['errors'])) { return $errors; } - + $currentTimestamp = time(); $allTimestamps = []; - + // Collect all timestamps foreach ($freeSlots as $slot) { if (isset($slot->appointments) && is_iterable($slot->appointments)) { @@ -502,16 +503,16 @@ private static function processFreeSlots(ProcessList $freeSlots): array { } } } - + // Final deduplication and sorting $uniqueTimestamps = array_values(array_unique($allTimestamps)); sort($uniqueTimestamps); - + $errors = ValidationService::validateGetProcessByIdTimestamps($uniqueTimestamps); if (is_array($errors) && !empty($errors['errors'])) { return $errors; } - + return ['appointmentTimestamps' => $uniqueTimestamps]; }