Documentation Index
Fetch the complete documentation index at: https://mintlify.com/IvBanzaga/Refugio/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Room and bed management functions handle room listings, bed availability checks, and bed assignment for the Refugio mountain refuge reservation system.Room Functions
listar_habitaciones
List all rooms with their capacity and bed availability.Database connection object
Array of room objects with:
id- Room IDnumero- Room numbercapacidad- Room capacitytotal_camas- Total number of bedscamas_libres- Number of available beds
SQL Query
Code Example
obtener_todas_habitaciones
Get all rooms with their total bed count.Database connection object
Array of room objects ordered by room number
SQL Query
Bed Availability Functions
obtener_disponibilidad
Get bed availability for a specific date range.Database connection object
Start date (YYYY-MM-DD)
End date (YYYY-MM-DD)
Array of beds with availability status:
id- Bed IDnumero- Bed numberid_habitacion- Room IDhabitacion_numero- Room numberdisponibilidad- ‘libre’ or ‘ocupada’
SQL Query
Code Example
contar_camas_libres_por_fecha
Count available beds for a specific date.Database connection object
Date to check (YYYY-MM-DD)
Number of available beds on the given date
SQL Query
Code Example
contar_total_camas
Count the total number of beds in the refuge.Database connection object
Total number of beds
Code Example
Advanced Availability Functions
obtener_camas_disponibles
Get available beds in a specific room for a date range, with optional reservation exclusion.Database connection object
Room ID
Start date (YYYY-MM-DD)
End date (YYYY-MM-DD)
Reservation ID to exclude from availability check (used when editing reservations)
Array of available beds with id and numero fields, ordered by bed number
SQL Query Structure
Code Example
obtener_habitaciones_disponibles
Get rooms with available beds for a date range, excluding periods when the entire refuge is booked.Database connection object
Start date (YYYY-MM-DD)
End date (YYYY-MM-DD)
Array of available rooms with:
id- Room IDnumero- Room numbercapacidad- Room capacitycamas_totales- Total beds in roomcamas_disponibles- Available beds for the date range Returns empty array if entire refuge is booked.
Special Logic
- First checks if the entire refuge is reserved (id_habitacion IS NULL)
- If so, returns empty array
- Otherwise, calculates available beds per room
- Only returns rooms with at least one available bed
SQL Query
Code Example
This function is crucial for preventing overbooking when the entire refuge is reserved for special events.