Sign inSign up

danio189/roomreserve

By danio189

β€’Updated about 3 years ago

🏨 A Spring Boot-based REST API for managing hotel room reservations and user accounts.

Image
0

810

danio189/roomreserve repository overview

⁠🏨 RoomReserve - Hotel Booking REST API

Java Spring Boot JWT Lombok JUnit MySQL Docker Swagger License: MIT

Welcome to RoomReserve - your one-stop solution for managing hotel bookings! 🌍 RoomReserve is a REST API designed for managing room reservations in a hotel. This application allows user registration and management, provides up-to-date information on room availability, pricing, and amenities in your hotel. It's built on Spring Boot, utilizing the power of Java and MySQL to ensure efficient data management and a smooth booking process.

⁠Features 🌟

  • Search and book available hotel rooms
  • Get detailed information about room amenities and pricing
  • Seamless integration with websites and applications
  • Efficient data management with Spring Boot and MySQL
  • Easy-to-use REST API endpoints for quick development

⁠Installation πŸ› οΈ

⁠Using Docker:

Run the Application using Docker Compose

  docker-compose up

All necessary configurations are included in the docker-compose.yml file and environment variables are defined in the .env file.

⁠Running Locally:
  1. Update application.properties

Set the database URL, username, and password in the application.properties file.

  1. Run the Application
  ./mvnw spring-boot:run

⁠API Endpoints 🌐

MethodEndpointDescriptionAccess
POST/api/auth/signupRegister a new userPublic
POST/api/auth/signinLogin a user and get the authentication tokenPublic
GET/api/rooms/availableRetrieve a list of available rooms between given datesPublic
GET/api/rooms/{id}Retrieve room details by IDPublic
GET/api/rooms/room/{roomNumber}Retrieve room by room numberPublic
GET/api/rooms/allRetrieve all rooms as RoomDTOPublic
GET/api/rooms/occupiedRetrieve all currently occupied roomsHOTEL, ADMIN
GET/api/rooms/availableNowRetrieve all currently available roomsPublic
POST/api/rooms/createCreate a new roomADMIN
PUT/api/rooms/updateUpdate an existing roomADMIN
DELETE/api/rooms/{id}Delete a room by IDADMIN
GET/api/userRetrieve the authenticated user’s detailsAuthenticated
GET/api/user/allRetrieve all usersHOTEL, ADMIN
PUT/api/user/update/passwordUpdate the authenticated user’s passwordAuthenticated
PUT/api/user/update/personalUpdate the user’s personal dataAuthenticated, ADMIN
POST/api/user/createCreate a new user with specific roleADMIN
DELETE/api/user/{username}Delete a userADMIN
GET/api/user/searchSearch for users based on some criteriaHOTEL, ADMIN
GET/api/user/findFind a specific user by ID, username or emailHOTEL, ADMIN
GET/api/guest/allRetrieve all guestsHOTEL, ADMIN
PUT/api/guest/update/personalUpdate the guest's personal dataHOTEL, ADMIN
POST/api/guest/createCreate a new guestHOTEL, ADMIN
GET/api/hotel/allGuestsRetrieve all Users and GuestsHOTEL, ADMIN
GET/api/hotel/searchGuestsSearch for Users and Guests based on some criteriaHOTEL, ADMIN
GET/api/hotel/findGuestFind a specific Guest or User by IDHOTEL, ADMIN
POST/api/hotel/checkin/{reservationId}Check-in with a given reservation IDHOTEL, ADMIN
POST/api/hotel/checkout/{reservationId}Check-out with a given reservation IDHOTEL, ADMIN
POST/api/hotel/confirmReservation/{reservationId}Confirm a given reservation IDHOTEL, ADMIN
POST/api/reservation/createReservationCreate a new reservationAuthenticated
GET/api/reservation/{id}Retrieve reservation details by IDAuthenticated
GET/api/reservation/guest/{id}Retrieve all reservations by guest IDAuthenticated
DELETE/api/reservation/{reservationId}Cancel a reservation by reservation IDHOTEL, ADMIN
GET/api/reservation/allRetrieve all reservationsHOTEL, ADMIN
GET/api/reservation/myRetrieve all of the user's reservationsAuthenticated
PUT/api/reservation/updateUpdate an existing reservationHOTEL, ADMIN

The API is also documented using Swagger UI, which allows you to test endpoints directly from your browser.

πŸ”— The Swagger UI page will then be available at http://server:port/swagger-ui.html and the OpenAPI description will be available at the following url for json format: http://server:port/v3/api-docs

For example, if you are running the application locally, it would be: http://localhost:8080/swagger-ui.html⁠

⁠Technologies Used πŸ’‘

  • Spring Boot
  • JWT (JSON Web Token)
  • Lombok
  • MySQL (Database)
  • Docker
  • JUnit (for testing)
  • H2 (Database for testing)

⁠Default Admin Account πŸ§‘β€πŸ’Ό

By default, the application is initialized with an administrator account:

  • Username: admin
  • Password: password

⁠License πŸ“„

This project is licensed under the MIT License - see the LICENSE⁠ file for details.

Tag summary

Content type

Image

Digest

sha256:a1126039d…

Size

610 MB

Last updated

about 3 years ago

docker pull danio189/roomreserve