Description
After introducing a dedicated rooms table/collection, we need APIs to fetch room-related information such as availability, occupancy, and linked events.
These APIs will power the room booking UI, availability checks, and future analytics.
⚠️ Note: This issue must be implemented only after #230 is completed, i.e. after the Rooms collection/table is added to the database.
Prerequisite
- Rooms collection/schema must be implemented
- Room IDs should be standardized
Required APIs
1. Get All Rooms
Endpoint
Response Format (Example)
[
{
"room_id": "SCITECH_101",
"location": "SciTech Building, Floor 1",
"status": "occupied",
"current_event": "EVENT_12345",
"occupied_until": "2026-02-18T16:00:00Z",
"allowed_roles": ["scitech_core", "gensec_scitech"]
},
{
"room_id": "AUDITORIUM",
"location": "Main Building",
"status": "vacant",
"current_event": null,
"occupied_until": null,
"allowed_roles": ["all"]
}
]
Behavior
2. Get Room by ID
Endpoint
Response Format (Example)
{
"room_id": "SCITECH_101",
"location": "SciTech Building, Floor 1",
"status": "occupied",
"current_event": "EVENT_12345",
"schedule": {
"start": "2026-02-18T14:00:00Z",
"end": "2026-02-18T16:00:00Z"
},
"allowed_roles": ["scitech_core", "gensec_scitech"],
"metadata": {
"capacity": 60,
"has_projector": true
}
}
Backend Requirements
- Create room-controller/service
- Query ongoing events to detect occupancy
- Map rooms ↔ active bookings/events
- Optimize queries for real-time status
- Add proper error handling (404, 500, etc.)
Integration Logic
Acceptance Criteria
Description
After introducing a dedicated
roomstable/collection, we need APIs to fetch room-related information such as availability, occupancy, and linked events.These APIs will power the room booking UI, availability checks, and future analytics.
Prerequisite
Required APIs
1. Get All Rooms
Endpoint
Response Format (Example)
[ { "room_id": "SCITECH_101", "location": "SciTech Building, Floor 1", "status": "occupied", "current_event": "EVENT_12345", "occupied_until": "2026-02-18T16:00:00Z", "allowed_roles": ["scitech_core", "gensec_scitech"] }, { "room_id": "AUDITORIUM", "location": "Main Building", "status": "vacant", "current_event": null, "occupied_until": null, "allowed_roles": ["all"] } ]Behavior
Returns all rooms
Indicates whether each room is:
vacantoccupiedIf occupied:
event_id2. Get Room by ID
Endpoint
Response Format (Example)
{ "room_id": "SCITECH_101", "location": "SciTech Building, Floor 1", "status": "occupied", "current_event": "EVENT_12345", "schedule": { "start": "2026-02-18T14:00:00Z", "end": "2026-02-18T16:00:00Z" }, "allowed_roles": ["scitech_core", "gensec_scitech"], "metadata": { "capacity": 60, "has_projector": true } }Backend Requirements
Integration Logic
A room is considered occupied if:
Event lookup must include:
Acceptance Criteria
GET /roomreturns all rooms with live statusGET /room/:room_idreturns detailed info