Add NetUP IPTV integration module (TV Welcome settings page)
- DB: migrations/002_netup.sql — netup_settings + netup_room_mapping tables - Backend: routes/netup.ts — GET/PATCH settings, POST test, GET/POST room mappings, POST send TV message; notifyNetupCheckin/Checkout helpers - Backend: bookings PATCH — fire-and-forget NetUP check-in/out on status change - Frontend: TvWelcomePage — connection settings tab + room mapping tab - Frontend: sidebarItem added to tv-welcome module (shows in sidebar menu) - Frontend: ModulesPage Settings button navigates to /tv-welcome - Frontend: BookingModal — "Сообщение гостю на TV" panel for existing bookings Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { FastifyPluginAsync } from 'fastify'
|
||||
import { db } from '../db'
|
||||
import { notifyNetupCheckin, notifyNetupCheckout } from './netup'
|
||||
|
||||
type SlugParam = { Params: { slug: string } }
|
||||
type SlugIdParam = { Params: { slug: string; id: string } }
|
||||
@@ -167,7 +168,16 @@ const bookings: FastifyPluginAsync = async (fastify) => {
|
||||
values,
|
||||
)
|
||||
if (!rows[0]) return reply.code(404).send({ error: 'Booking not found' })
|
||||
return rows[0]
|
||||
|
||||
// NetUP IPTV: fire-and-forget при заселении/выселении
|
||||
const updated = rows[0]
|
||||
if (request.body.status === 'checked_in') {
|
||||
notifyNetupCheckin(hotelId, updated.room_id, updated.guest_name, updated.id).catch(() => {})
|
||||
} else if (request.body.status === 'checked_out') {
|
||||
notifyNetupCheckout(hotelId, updated.room_id).catch(() => {})
|
||||
}
|
||||
|
||||
return updated
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user