feat: housekeeping automation — auto-task on checkout + room status on done

Backend:
- Migration 023: housekeeping_settings table (checkout_auto, checkout_priority, inspection_after_clean)
- New route: GET/PATCH /api/hotels/:slug/housekeeping-settings
- bookings.ts: on checked_out → auto-create turnover task + mark room dirty + broadcast WS
- housekeeping.ts: on task done → update room status (inspect|clean per setting) + broadcast WS
- ws.ts: export broadcast() for use in other routes

Frontend:
- HousekeepingPage: load/save settings to API, live Loader on save button
- useHotelSocket: add housekeeping WS message types
- HousekeepingPage: subscribe to WS — new tasks appear instantly without refresh
- BookingModal: show total section when room + nights selected (not just when total > 0)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 22:27:18 +03:00
parent ce20c6545d
commit 9af11df1b0
10 changed files with 205 additions and 12 deletions

View File

@@ -7,6 +7,9 @@ export type WsMessage =
| { type: 'booking:created'; booking: Booking }
| { type: 'booking:updated'; booking: Booking }
| { type: 'booking:deleted'; bookingId: string }
| { type: 'housekeeping_task_created'; task: Record<string, unknown> }
| { type: 'housekeeping_updated'; task: Record<string, unknown> }
| { type: 'housekeeping_done'; taskId: string; roomId: string; roomStatus: string }
interface Options {
slug: string