Connect ChannelsPage, FloorMapPage, SettingsPage, UsersPage to real API
- ChannelsPage: load from API, toggle/sync call real endpoints; normalize enabled→isEnabled, lastSyncedAt→lastSyncAt, add displayName/mappings defaults - FloorMapPage: load rooms+bookings from API; create booking via API - SettingsPage: load hotel via GET /api/hotels/:slug; save general section via PATCH (name, address, timezone, currency, check_in/out times) - UsersPage: load users from API; create/update/delete via API; map backend User (name/role) → StaffUser (firstName/lastName/StaffRole) - api.ts: add hotels.get/update, users.delete, channel normalization, HotelPayload/toHotelPayload - types/index.ts: extend Hotel with phone/checkInTime/checkOutTime/optional fields; add User.createdAt/updatedAt - backend/routes/hotels.ts: extend PATCH to allow address/phone/check_in_time/check_out_time - backend/migrations/004_hotels_contacts.sql: add address/phone/check_in/out_time to hotels Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
6
backend/migrations/004_hotels_contacts.sql
Normal file
6
backend/migrations/004_hotels_contacts.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
-- Migration 004 — Add contact/schedule fields to hotels
|
||||
ALTER TABLE hotels
|
||||
ADD COLUMN IF NOT EXISTS address TEXT,
|
||||
ADD COLUMN IF NOT EXISTS phone VARCHAR(50),
|
||||
ADD COLUMN IF NOT EXISTS check_in_time TIME NOT NULL DEFAULT '14:00',
|
||||
ADD COLUMN IF NOT EXISTS check_out_time TIME NOT NULL DEFAULT '12:00';
|
||||
@@ -76,7 +76,7 @@ const hotels: FastifyPluginAsync = async (fastify) => {
|
||||
return reply.code(403).send({ error: 'Forbidden' })
|
||||
}
|
||||
|
||||
const allowed = ['name', 'plan', 'timezone', 'currency']
|
||||
const allowed = ['name', 'plan', 'timezone', 'currency', 'address', 'phone', 'check_in_time', 'check_out_time']
|
||||
const updates: string[] = []
|
||||
const values: unknown[] = []
|
||||
let idx = 1
|
||||
|
||||
Reference in New Issue
Block a user