Skip to content

nycanshu/apnaHotel-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

ApnaHotel API Documentation.

Introduction

This is a complete overview of my recent project apnaHotel, which I did using JAVA, SpringBoot.

All end points that as access among Admin or User, will require JWT token to verify their identity.

1. Registration Services 👍

  • Register User

Description: Registers a new user in the system.

Endpoint Url /auth/register
Method Post
Data

{

"email": "string",

"name": "string",

"phonenumber": "string",

"password": "string",

"role": "ADMIN or USER(Default)"

}

Access Anyone (no authentication required)
  • Login User

Description: Login a registered user in the system. Returns a JWT token that contains user identity along with role.

Endpoint Url /auth/login
Method POST
Data

{

"email": "string",

"password": "string"

}

Access Anyone (no authentication required)

2. Users Service 👍

  • Get all users

Description : Retrieves a list of all users.

Endpoint Url /users/all
Method GET
Data Requires JWT token in Auth Headers.
Access Only Admin
  • Get user by ID

Description : Returns a specific user by their ID.

Endpoint Url /users/get-by-id/{userId}
Method GET
Data UserId [Long (path parameter)]
Access Anyone
  • Delete a user

Description : Deletes a user by their ID.

Endpoint Url /users/delete/{userId}
Method DELETE
Data UserId [Long (path parameter)]
Access Only Admin
  • Get current logged-in user

Description : Returns the profile information of the currently logged-in user.

Endpoint Url /users/get-logged-in-profile-info
Method GET
Data None
Access Anyone (must be logged in)
  • Get user booking history.

Description : Returns the booking history for a specific user.

Endpoint Url /users/get-user-bookings/{userId}
Method GET
Data UserId (path parameter)
Access Anyone

3. Room Services 👍

  • Add a new room.

Description : Add a new room to the hotel’s inventory.

Endpoint Url /rooms/add
Method POST
Data

FormData. (photo, roomType, roomPrice, roomDescription)

(All field required)

Access Only Admin
  • Update existing room.

Description : Updates the details of added rooms.

Endpoint Url /rooms/update/{roomId}
Method PUT
Data RoomId (path parameter)
FormData. (photo, roomType, roomPrice, roomDescription)
(All fields required)
Access Only Admin
  • Get all the rooms.

Description : Returns List of all the rooms.

Endpoint Url /rooms/all
Method GET
Data None
Access Anyone.
  • Get room types.

Description : Returns List of all types of rooms registered.

Endpoint Url /rooms/types
Method GET
Data None
Access Anyone.
  • Get room types.

Description : Returns a specific room by its ID.

Endpoint Url /rooms/rom-by-id/{roomId}
Method GET
Data roomId [Path parameter]
Access Anyone.
  • Get all available rooms.

Description : Returns a list of all available rooms. (Non booked rooms)

Endpoint Url /rooms/all-available-rooms
Method GET
Data None
Access Anyone.
  • Get available rooms by Date and Type.

Description : Returns available rooms based on the specified check-in date, check-out date, and room type.

Endpoint Url /rooms/available-rooms-by-date-and-type
Method GET
Data

CheckIn Date, CheckOut Date, RoomType

(All fields required)

Access Anyone.
  • Delete a room.

Description : Deletes a room by its ID.

Endpoint Url /rooms/delete/{roomId}
Method DELETE
Data RoomId as path parameter.
Access Admin.

4. Booking Services 👍

  • Book a room.

Description : Creates a new booking for a room.

Endpoint Url /bookings/book-room/{roomId}/{userId}
Method POST
Data

roomId (path parameter)

userId (path parameter)

Booking object in the request body.

checkInDate: LocalDate

checkOutDate: LocalDate

Access Admin or User
  • Get all bookings.

Description : Retrieves a list of all bookings.

Endpoint Url /bookings/all
Method GET
Data none
Access Admin only
  • Get booking by confirmation code.

Description : Retrieves a booking by its confirmation code.

Endpoint Url /bookings/get-by-confirmation-code/{confirmationCode}
Method GET
Data confirmationCode as path variable
Access Anyone
  • Cancel Booking.

Description : Delete a booking by booking id.

Endpoint Url /bookings/cancel/{bookingId}
Method DELETE
Data Booking id as path parameter
Access Admin or User

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages