fix(booking): store the services and duration a public booking was made with
POST /api/v1/appointment resolved the selected services, summed their minutes, used that to compute slot_end — and then dropped the result. It never called replaceServiceItems() or setServiceDuration(), so an appointment booked from the public site kept no record of what it was booked for: - the patient panel showed neither the service nor the duration - reports counted the appointment as having no services - a later reschedule had no duration to preserve The management path did all of this correctly; only the public path did not. Found by booking through the real endpoint and looking at the panel, which is the one thing no test did. The duration was also computed as a naive sum of duration_minutes, ignoring the solo/additional split. That made a multi-service booking's length disagree with the slots appointment-service-slots had just offered the patient — the booking would occupy a different span than the one shown. Both paths now go through ServiceBookingCalculator, which is what builds those slots. For data that only sets duration_minutes, the calculator returns the same total as the old sum, so existing services are unaffected. assertServicesMatchContext() is gone: the calculator performs the identical ownership check with the same error code and message, and the tenant-lookup inventory is updated to match. Tests: PublicBookingServicePersistenceTest starts at the endpoint rather than building an appointment in memory — the gap that let this ship. Verified it fails (4 of 8) with the fix disabled. Full suite 1433 green, slot-mode-frozen green, phpstan at its 14-error baseline. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -35,9 +35,9 @@ class TenantLookupInventoryTest extends TestCase
|
||||
* @var array<string, int>
|
||||
*/
|
||||
private const REVIEWED = [
|
||||
// assertServicesMatchContext (مسیر ثبت نوبت) + خودِ گارد. جستوجوی مسیرِ اسلاتِ
|
||||
// سرویسی به ServiceBookingCalculator منتقل شد و همانجا شمرده میشود.
|
||||
'src/Appointment/Controller/AppointmentController.php' => 2,
|
||||
// AppointmentController دیگر جستوجوی بازبینینشده ندارد: assertServicesMatchContext
|
||||
// حذف شد و مسیر ثبت نوبت هم مثل مسیر اسلات از ServiceBookingCalculator رد میشود،
|
||||
// که خودش مالکیت محیط را میسنجد و پایینتر شمرده میشود.
|
||||
// TenantOwnershipChecker::belongsToPair() روی هر uuid، پیش از هر بررسی دیگر
|
||||
'src/Appointment/Service/ServiceBookingCalculator.php' => 2,
|
||||
// TenantOwnershipChecker روی بخش/سرویس/پرسنل و فهرست سرویسها
|
||||
|
||||
Reference in New Issue
Block a user