feat(appointment): store online-booking window in WeeklySchedule meta

Add a reserved meta key inside WeeklySchedule.setting (no migration) holding
online_booking_enabled and a booking_window value+unit (week|month), with
sane defaults. Expose meta separately in toArray() and keep it out of the
day schedule map. setSetting now preserves meta when the day schedule is
replaced; the weekly-schedule POST/PATCH endpoints accept an optional meta.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-15 16:16:30 +03:30
co-authored by Claude Opus 4.8
parent c662eb9b4f
commit 09aba878f8
3 changed files with 229 additions and 2 deletions
@@ -61,6 +61,10 @@ class AppointmentSettingsController extends BaseController
$schedule = new WeeklySchedule($doctor, $data['schedule'] ?? []);
}
if (isset($data['meta']) && is_array($data['meta'])) {
$schedule->setMeta($data['meta']);
}
$this->scheduleRepo->save($schedule);
return $this->success(['data' => $schedule->toArray()], 201);
@@ -88,6 +92,9 @@ class AppointmentSettingsController extends BaseController
if (isset($data['schedule'])) {
$schedule->setSetting($data['schedule']);
}
if (isset($data['meta']) && is_array($data['meta'])) {
$schedule->setMeta($data['meta']);
}
$this->scheduleRepo->save($schedule);