Venues
📍 Venue Model¶
- name: Name of the venue (e.g., Auditorium A)
- block: Block or area where the venue is located (e.g., Block A)
- capacity: Maximum capacity of people the venue can hold (e.g., 200 people)
- abbreviation: Abbreviation for the venue (e.g., NLH4)
- images: Array of image URLs (or file paths) representing the venue.
- status: Status of the venue (can be "booked", "available", or "pending").
Updated CRUD Endpoints¶
1. GET /api/v1/venues
- Get All Venues¶
-
Description: Retrieves a list of all venues.
-
Response:
[
{
"_id": "venue123",
"name": "Auditorium A",
"block": "Block A",
"capacity": 200,
"abbreviation": "NLH4",
"images": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"createdAt": "2025-02-17T10:00:00Z",
"updatedAt": "2025-02-17T10:00:00Z",
"status": "booked"
},
{
"_id": "venue124",
"name": "Conference Room 1",
"block": "Block B",
"capacity": 50,
"abbreviation": "CR1",
"images": [
"https://example.com/image3.jpg"
],
"createdAt": "2025-02-16T14:30:00Z",
"updatedAt": "2025-02-16T14:30:00Z"
}
]
2. POST /api/v1/venues
- Create New Venue¶
-
Description: Adds a new venue to the system. Admins must provide
name
,block
,capacity
,abbreviation
, and optionalimages
array. -
Request Body:
{
"name": "Auditorium B",
"block": "Block C",
"userId": "w3eegcr5er14qere4r",
"abbreviation": "NLH4",
"status": "booked",
"capacity": 300,
"images": [
"https://example.com/venue-image1.jpg",
"https://example.com/venue-image2.jpg"
]
}
- Response:
{
"status": "success",
"message": "Venue created successfully.",
"data": {
"_id": "venue125",
"name": "Auditorium B",
"status": "booked",
"block": "Block C",
"abbreviation": "NLH4",
"capacity": 300,
"images": [
"https://example.com/venue-image1.jpg",
"https://example.com/venue-image2.jpg"
],
"createdAt": "2025-02-17T15:00:00Z",
"updatedAt": "2025-02-17T15:00:00Z"
}
}
3. GET /api/v1/venues/:id
- Get Venue by ID¶
-
Description: Retrieves a specific venue by its
id
. -
Response:
{
"_id": "venue123",
"name": "Auditorium A",
"block": "Block A",
"capacity": 200,
"status": "booked",
"abbreviation": "NLH4",
"images": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"createdAt": "2025-02-17T10:00:00Z",
"updatedAt": "2025-02-17T10:00:00Z"
}
4. PUT /api/v1/venues/:id
- Update Venue by ID¶
-
Description: Updates the details of an existing venue by its
id
. Updates can include thename
,block
,capacity
,abbreviation
, andimages
. -
Request Body:
{
"name": "Updated Auditorium A",
"block": "Block A",
"capacity": 250,
"abbreviation": "NLH5",
"images": [
"https://example.com/updated-image1.jpg"
]
}
- Response:
{
"status": "success",
"message": "Venue updated successfully.",
"data": {
"_id": "venue123",
"name": "Updated Auditorium A",
"block": "Block A",
"capacity": 250,
"abbreviation": "NLH5",
"images": [
"https://example.com/updated-image1.jpg"
],
"createdAt": "2025-02-17T10:00:00Z",
"updatedAt": "2025-02-17T16:00:00Z"
}
}
5. DELETE /api/v1/venues/:id
- Delete Venue by ID¶
-
Description: Deletes a specific venue by its
id
. -
Response:
{
"status": "success",
"message": "Venue deleted successfully."
}
🔐 Security Notes¶
- Ensure only users with an
admin
role can access the POST, PUT, and DELETE endpoints for venues. - Always validate input parameters for
capacity
,name
,block
, andabbreviation
to ensure correctness. - For the
images
field, you can store URLs or use a file upload mechanism, depending on your setup.
📌 Example Venue Data¶
{
"_id": "venue123",
"name": "Auditorium A",
"block": "Block A",
"capacity": 200,
"abbreviation": "NLH4",
"images": [
"https://example.com/image1.jpg",
"https://example.com/image2.jpg"
],
"createdAt": "2025-02-17T10:00:00Z",
"updatedAt": "2025-02-17T10:00:00Z"
}