rooms table stores hotel room codes used to identify the location of incidents and link guest sessions to specific rooms.
Table Name
rooms
Schema Fields
Primary key, automatically generated
Unique room identifier (e.g., “A-203”, “B-105”)Room codes are typically formatted as building/floor-number but can use any format.
Automatically set when the room is created
Relationships
- incidents: One-to-many relationship (one room can have many incidents)
- guest_sessions: One-to-many relationship (one room can have many sessions)
Query Examples
Create Room
Rooms are typically created on-demand when creating guest sessions:mobile/app/(admin)/createSessions.tsx:45
Find Room by Code
Lookup a room’s ID using its code:Get Room Code from ID
When displaying incident details, fetch the room code:mobile/components/EmpleadoBuzonIncidents.tsx:208
List All Rooms
Retrieve all room codes:Get Room Information
Fetch complete room details from guest session:mobile/components/settings/guest/StayInfoModal.tsx:60
Room Code Format
Room codes are free-form text and can follow any naming convention. Common patterns include:
- Building-Number:
"A-203","B-105" - Floor-Number:
"2-203","1-105" - Simple Numbers:
"203","105"
Usage Pattern
The typical room lifecycle:Example: Room Creation Flow
When an admin creates a guest session:mobile/app/(admin)/createSessions.tsx:37
Data Model
Design Considerations
- Room codes are unique to prevent duplicate entries
- Rooms are created lazily (on-demand) when needed
- Room codes are case-sensitive
- Old room codes persist for historical incident records
Related Tables
Incidents
Incidents linked to room locations
Guest Sessions
Guest access sessions per room