TidyLinker.com
TypeScript
Pull Request Merged
PR #162 merged: feat: same-day bookings
Summary
Lets a client book a cleaner for today when the cleaner has opted in
and is available. Implements the plan in
scratch/plans/plan-same-day-bookings.md.
- New
cleaner_profiles.accepts_same_dayboolean (default off) plus anavailableToday()scope that filters opted-in cleaners with a recurring slot for today's day-of-week DirectBookingRequestnow allowspreferred_date = today, enforces a 1-hour lead-time, and rejects same-day bookings against cleaners who haven't opted in (per-field friendly errors, not the genericafterrule)?available_today=1on/cleanersfilters the search results; the new checkbox inFilterPanelkeeps URL state in sync and counts as an active filter- Cleaners can opt in during onboarding step 4 (rates) and toggle the
flag from
/cleaner/profile(newToggleAcceptsSameDayaction and route) - The booking dialog now allows today as the earliest date for opted-in cleaners (was hard-floored at tomorrow)
- Cleaner request notification flags same-day urgency in subject + in-app heading
- New
bookings:close-lapsed-same-dayscheduled command (every 5 minutes) cancels pending same-day jobs whose 1-hour cutoff has passed and emails the client aDirectBookingLapsedNotificationpointing back at/cleaners?available_today=1
Deviations from the plan
- The plan suggested putting the opt-in toggle on onboarding step 5;
step 5 in this codebase is a no-form completion screen, so the toggle
lives on step 4 alongside the other rate/preference inputs. The
data is persisted via the existing
SaveCleanerRatesaction. - Tests for the new request validation live under
tests/Feature/DirectBooking/(matches existing convention) rather thantests/Feature/Client/as the plan suggested.
Deferred (open questions §10 in the plan)
- Reposting/"ending soon" surfacing to other cleaners — out of scope, needs its own design pass.
- Per-cleaner same-day notification volume cap — deferring until real volume gives us data; flagged for pre-launch.
- Did NOT auto-flip existing cleaners with today-availability to
accepts_same_day = true. Default off; cleaners must actively opt in. Defer until Stu confirms otherwise. - Auto-close cadence kept at every 5 minutes (acceptable lag is up to ~5min after the 1h window crosses).
Test plan
-
tests/Feature/DirectBooking/SameDayBookingTest.php— 5 tests covering the opt-in gate, lead-time gate, past-date rejection, and future-booking regression -
tests/Feature/CleanerSearch/AvailableTodayFilterTest.php— 3 tests for the filter (opt-in + slot, missing slot, omitting filter) -
tests/Feature/Cleaner/Onboarding/AcceptsSameDayOptInTest.php— 3 tests for step-4 opt-in and the profile-settings toggle -
tests/Feature/Console/CloseLapsedSameDayBookingsTest.php— 4 tests covering the close + notify path, untouched far-future and outside-window jobs, and untouched in-progress jobs - Existing
tests/Feature/Cleaner/SearchTest.php(17), all oftests/Feature/DirectBooking/(37), and existing onboarding tests pass with no regressions
+853
additions
-27
deletions
27
files changed