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

@@ -222,6 +222,12 @@ export const api = {
delete: (slug: string, id: string) =>
req<void>('DELETE', `/api/hotels/${slug}/housekeeping/${id}`),
getSettings: (slug: string) =>
req<HkSettings>('GET', `/api/hotels/${slug}/housekeeping-settings`),
saveSettings: (slug: string, data: Partial<HkSettings>) =>
req<HkSettings>('PATCH', `/api/hotels/${slug}/housekeeping-settings`, data),
},
// ── Channels ──────────────────────────────────────────────────────────────
@@ -526,6 +532,12 @@ export interface HkPayload {
status?: string; assignee_id?: string; notes?: string; due_date?: string
}
export interface HkSettings {
checkout_auto: boolean
checkout_priority: string
inspection_after_clean: boolean
}
export interface HotelPayload {
name?: string; address?: string; phone?: string
timezone?: string; currency?: string