room reservation added

This commit is contained in:
Kiss Dávid
2026-04-01 12:12:46 +02:00
parent d55e085741
commit 821ec88882
6 changed files with 145 additions and 9 deletions
+97
View File
@@ -308,5 +308,102 @@ Retrieves and displays a previously uploaded image.
---
## Room Reservations
### Get All Rooms
Retrieves a list of all available rooms.
- **URL:** `/api/room-reservations/rooms`
- **Method:** `GET`
- **Response:** Array of room objects.
### Create Room
Creates a new room.
- **URL:** `/api/room-reservations/rooms`
- **Method:** `POST`
- **Authentication:** Required (Admin)
- **Body:**
- `name` (string, required): The name of the room.
- `capacity` (number, required): The capacity of the room.
- `description` (string, optional): A description of the room.
- **Response:** Created room object.
### Update Room
Updates an existing room.
- **URL:** `/api/room-reservations/rooms`
- **Method:** `PUT`
- **Authentication:** Required (Admin)
- **Body:**
- `id` (number, required): The ID of the room to update.
- `name` (string, optional): The new name.
- `capacity` (number, optional): The new capacity.
- `description` (string, optional): The new description.
- **Response:** Updated room object.
### Delete Room
Deletes a room.
- **URL:** `/api/room-reservations/rooms`
- **Method:** `DELETE`
- **Authentication:** Required (Admin)
- **Body:**
- `id` (number, required): The ID of the room to delete.
- **Response:** `{"message": "Room deleted"}`
### Get All Reservations
Retrieves a list of all room reservations, preloading room details.
- **URL:** `/api/room-reservations/reservations`
- **Method:** `GET`
- **Response:** Array of reservation objects.
### Create Reservation
Creates a new room reservation.
- **URL:** `/api/room-reservations/reservations`
- **Method:** `POST`
- **Authentication:** Required (Admin)
- **Body:**
- `roomId` (number, required): The ID of the room.
- `customerName` (string, required): The name of the customer.
- `customerPhone` (string, required): The phone number of the customer.
- `guestsCount` (number, required): Number of guests.
- `startsAt` (string, required): Start time (ISO 8601).
- `endsAt` (string, required): End time (ISO 8601).
- `notes` (string, optional): Additional notes.
- **Response:** Created reservation object.
### Update Reservation
Updates an existing reservation.
- **URL:** `/api/room-reservations/reservations`
- **Method:** `PUT`
- **Authentication:** Required (Admin)
- **Body:**
- `id` (number, required): The ID of the reservation to update.
- `roomId` (number, optional): The new room ID.
- `customerName` (string, optional): The new customer name.
- `customerPhone` (string, optional): The new customer phone.
- `guestsCount` (number, optional): The new guests count.
- `startsAt` (string, optional): The new start time.
- `endsAt` (string, optional): The new end time.
- `status` (string, optional): The new status ('confirmed' or 'cancelled').
- `notes` (string, optional): New notes.
- **Response:** Updated reservation object.
### Delete Reservation
Deletes a reservation.
- **URL:** `/api/room-reservations/reservations`
- **Method:** `DELETE`
- **Authentication:** Required (Admin)
- **Body:**
- `id` (number, required): The ID of the reservation to delete.
- **Response:** `{"message": "Reservation deleted"}`
---
## Rate Limiting
Some endpoints (like login, registration, and deletion) are protected by rate limiting to prevent abuse. If you receive a `429 Too Many Requests` response, please wait before trying again.