Improve NetUP diagnostics: push event log + test check-in button

- notifyNetupCheckin/Checkout now log every attempt (ok/error/skipped)
  with room number, NetUP room, URL, HTTP status, error message
- Push log exposed via GET /netup/log alongside pull request log
- New POST /netup/test-checkin: manually trigger a test check-in from UI
- Diagnostics tab split into two sections:
  - Outgoing (push): table of check-in/check-out events with status dots
  - Incoming (pull): NetUP poll requests (if TravelLine integration works)
- Test button picks first mapped room and fires a real check-in call

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-19 12:19:48 +03:00
parent 142be49211
commit 44fa9d24f1
3 changed files with 314 additions and 134 deletions

View File

@@ -289,11 +289,16 @@ export const api = {
req<{ ok: boolean }>('POST', `/api/hotels/${slug}/netup/message`, { room_id: roomId, message, guest_name: guestName }),
getLog: (slug: string) =>
req<{ count: number; requests: { ts: string; method: string; url: string; headers: Record<string, unknown>; query: Record<string, unknown>; body: unknown }[] }>(
'GET', `/api/hotels/${slug}/netup/log`),
req<{
pushEvents: { ts: string; action: string; roomNumber: string; netupRoom: string; url: string; status: string; httpStatus?: number; error?: string }[]
pullRequests: { ts: string; method: string; url: string; headers: Record<string, unknown>; query: Record<string, unknown>; body: unknown }[]
}>('GET', `/api/hotels/${slug}/netup/log`),
clearLog: (slug: string) =>
req<{ ok: boolean }>('DELETE', `/api/hotels/${slug}/netup/log`),
testCheckin: (slug: string, roomId: string) =>
req<{ ok: boolean; message: string }>('POST', `/api/hotels/${slug}/netup/test-checkin`, { room_id: roomId }),
},
}