Objective: Create a reservation management API for a hotel system.
-
Entities and Relationships:
Room
: Room with attributes likeid
,number
,type
,price
,status
. ✅DONEBooking
: Reservation with attributes likeid
,customerName
,checkInDate
,checkOutDate
,status
,room
. ✅DONECustomer
: Customer with attributes likeid
,name
,email
,phone
. ✅DONE- Relationships:
- A reservation is associated with a single room and a customer. ✅DONE
- A customer can have multiple reservations. ✅DONE
- A room can have multiple reservations over time but cannot be reserved for more than one reservation at the same time. ✅DONE
-
Business Rules:
- Check room availability before creating a reservation. ✅DONE
- Do not allow a reservation for a room that is already booked for the specified dates. ✅DONE
- Update the room status to
BOOKED
when a reservation is created and toAVAILABLE
when the reservation is canceled or completed. ✅DONE - The reservation status can be
PENDING
,CONFIRMED
,CHECKED_IN
,CANCELLED
. ✅DONE
-
Technologies and Tools:
- Spring Boot for creating the API. ✅DONE
- Spring Validation for validating input data. ✅DONE
- Spring Data JPA for database interaction. ✅DONE
- Relational Database (e.g., PostgreSQL, MySQL). ✅DONE
- Flyway for database migration. ✅DONE
- Automated Tests with Junit and Mockito. ✅DONE
- Error Handling with
@ControllerAdvice
. ✅DONE - Swagger Configuration and Implementation for API Documentation. ✅DONE
- Docker and Docker Compose. 🔄In Progress
-
API Endpoints:
GET /rooms
: List all rooms. ✅DONEGET /rooms/{id}
: Get details of a specific room. ✅DONEPOST /rooms
: Add a new room. ✅DONEPUT /rooms/{id}
: Update an existing room. ✅DONEDELETE /rooms/{id}
: Delete a room. ✅DONEGET /bookings
: List all reservations. ✅DONEGET /bookings/customer_name
: Get details of List reservation by customer name.✅DONEPOST /bookings
: Create a new reservation. ✅DONEPUT /bookings/{id}
: Update an existing reservation. ✅DONEPUT /bookings/check_out/{id}
: Check out a reservation. ✅DONEDELETE /bookings/{id}
: Cancel a reservation. ✅DONEGET /customers
: List all customers. ✅DONEGET /customers/{id}
: Get details of a specific customer. ✅DONEPOST /customers
: Add a new customer. ✅DONEPUT /customers/{id}
: Update an existing customer. ✅DONEDELETE /customers/{id}
: Delete a customer.✅DONEGET /customers/actives
: List all actives customers.✅DONE
This challenge involves creating an API for managing hotel reservations, including rooms, reservations, and customers. The implementation should address validation, database migration, error handling, and integration tests. Good luck! 🚀