Remove pull integration; persist push log to DB (last 50 per hotel)

- Remove TravelLine/netup-pms pull route (travelline.ts unused)
- Remove pull integration section from TvWelcomePage (token field, API URL, etc.)
- Migration 008: netup_push_log table (hotel_id, action, status, request/response body)
- recordPush() now writes to DB in addition to in-memory buffer
- getLog reads from DB so logs survive server restarts
- clearLog deletes from DB
- Limit enforced: 50 rows per hotel (oldest auto-deleted)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-19 12:55:39 +03:00
parent 32115399ee
commit ed397dbcd9
4 changed files with 200 additions and 363 deletions

View File

@@ -0,0 +1,16 @@
CREATE TABLE IF NOT EXISTS netup_push_log (
id BIGSERIAL PRIMARY KEY,
hotel_id UUID NOT NULL REFERENCES hotels(id) ON DELETE CASCADE,
ts TIMESTAMPTZ NOT NULL DEFAULT NOW(),
action TEXT NOT NULL, -- 'check-in' | 'check-out' | 'message'
room_number TEXT NOT NULL DEFAULT '',
netup_room TEXT NOT NULL DEFAULT '',
url TEXT NOT NULL DEFAULT '',
request_body JSONB,
status TEXT NOT NULL, -- 'ok' | 'error' | 'skipped'
http_status INT,
response_body TEXT,
error TEXT
);
CREATE INDEX IF NOT EXISTS idx_netup_push_log_hotel_ts ON netup_push_log(hotel_id, ts DESC);