Add Guests module: API integration + passport identification
- Migration 009: add passport_series, passport_number, rating to guests table - Backend route /api/hotels/:slug/guests: list, get (with history), create/upsert by passport, update, delete - Frontend GuestsPage: loads from API, passport tab in modal, add guest form, search by passport - api.ts: add guests API methods and GuestApiType Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
12
backend/migrations/009_guests.sql
Normal file
12
backend/migrations/009_guests.sql
Normal file
@@ -0,0 +1,12 @@
|
||||
-- Migration 009 — Add passport_series, passport_number and rating to guests
|
||||
|
||||
ALTER TABLE guests
|
||||
ADD COLUMN IF NOT EXISTS passport_series VARCHAR(20),
|
||||
ADD COLUMN IF NOT EXISTS passport_number VARCHAR(20),
|
||||
ADD COLUMN IF NOT EXISTS rating INTEGER NOT NULL DEFAULT 3
|
||||
CHECK (rating BETWEEN 1 AND 5);
|
||||
|
||||
-- Unique index: one profile per passport (series+number) per hotel
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_guests_passport_unique
|
||||
ON guests(hotel_id, passport_series, passport_number)
|
||||
WHERE passport_series IS NOT NULL AND passport_number IS NOT NULL;
|
||||
Reference in New Issue
Block a user