Skip to content

Spring Boot project for tourism promotion and hotel booking. This RESTful web service serves as the backend for a tourism and hospitality platform, allowing users to discover and book hotels, access tourist information, and plan their travel experiences.

Notifications You must be signed in to change notification settings

Qhung3217/where-go-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WhereGo? RESTfull API web service

Spring Boot project for tourism promotion and hotel booking. This RESTful web service serves as the backend for a tourism and hospitality platform, allowing users to discover and book hotels, access tourist information, and plan their travel experiences.

Tech Stack

  • Spring Framework: Spring Boot, Spring Web, Spring Security, Spring Data JPA
  • Language: Java

Maven external dependencies

  • Lombok
  • Mapstruct
  • Hibernate validator
  • Jsonwebtoken

API Reference

User roles:


Role Guest/Public

Hotel api

Get all hotel
  GET /api/hotel
Get hotel random
  GET /api/hotel/random?quantity={quantity}
Parameter Type Description
quantity Integer Not required. Default value is 20
Get hotel
  GET /api/hotel/{hotel_id}
Parameter Type Description
hotel_id Long Required. Id of hotel to fetch
Get hotel filter information
  GET /api/hotel/filter-infor

Place api

Get all place
  GET /api/place
Get place random
  GET /api/place/random?quantity={quantity}
Parameter Type Description
quantity Integer Not required. Default value is 20
Get place
  GET /api/place/{place_id}
Parameter Type Description
place_id Long Required. Id of place to fetch
Get place filter information
  GET /api/place/filter-infor

Restaurant api

Get all restaurant
  GET /api/restaurant
Get restaurant random
  GET /api/restaurant/random?quantity={quantity}
Parameter Type Description
quantity Integer Not required. Default value is 20
Get restaurant
  GET /api/restaurant/{restaurant_id}
Parameter Type Description
restaurant_id Long Required. Id of restaurant to fetch
Get restaurant filter information
  GET /api/restaurant/filter-infor

Article api

Get all article
  GET /api/article
Get article random
  GET /api/article/random?quantity={quantity}
Parameter Type Description
quantity Integer Not required. Default value is 20
Get article
  GET /api/article/detail/{article_id}
Parameter Type Description
article_id Long Required. Id of article to fetch

Search api

Search by name and category
  GET /api/search?category={category}&keyword={keyword}
Parameter Type Description
category String Required. Value in range: `'hotel'
keyword String Required. The keyword searches for items with matching names

Share api

Render image
  GET /api/render/{image_file}
Parameter Type Description
image_file String Required. The full file name to render

User authentication api

Login
  POST /api/auth/login?role={user_role}
Parameter Type Description
user_role String Required. Specify login as role writer or role traveler

Request body (JSON format)

Parameter Type Description
email String Required. Email for login
password String Required. Account password
Writer register
  POST /api/auth/writer/register

Request body (Form-data)

Parameter Type Description
email String Required. Email for login
name String Required. Full name
tels String Required. Phone number
dob Date:YYYY-MM-DD Required. Date of birth
username String Required. Account username
password String Required. Account password
Check writer username exist
  POST /api/auth/writer/check-username-exist

Request body (x-www-form-urlencoded)

Parameter Type Description
username String Required. Username to check existence
Check writer email exist
  POST /api/auth/writer/check-email-exist

Request body (x-www-form-urlencoded)

Parameter Type Description
email String Required. Email to check existence
Traveler register
  POST /api/auth/traveler/register

Request body (Form-data)

Parameter Type Description
email String Required. Email for login
name String Required. Full name
tels String Required. Phone number
dob Date:YYYY-MM-DD Required. Date of birth
username String Required. Account username
password String Required. Account password
Check traveler username exist
  GET /api/auth/traveler/check-username-exist?username={username}
Parameter Type Description
username String Required. Username to check existence
Check traveler email exist
  GET /api/auth/traveler/check-email-exist?email={email}
Parameter Type Description
email String Required. Email to check existence

Role Traveler

  • Access requires the traveler role
  • Attach the Bearer Token to the request header for access
Get traveler detail
  GET /api/traveler
Update account
  POST /api/traveler/update

Request body (Form-data)

Parameter Type Description
name String Not required. Full name
tels String Not required. Phone number
dob Date:YYYY-MM-DD Not required. Date of birth
username String Not required. Account username
avatar File Not required. Account avatar
Change password
  POST /api/traveler/change-password

Request body (JSON format)

Parameter Type Description
currentPassword String Required. Current account password
newPassword String Required. New account password
Review hotel/restaurant/place
  POST /api/traveler/review?category={category}
Parameter Type Description
category String Required. Specify a review for hotel, restaurant or place

Request body (Form-data)

Parameter Type Description
commment String Required. Leave a comment about the object
rating Integer Required. Provide a rating between 1 and 5 for the object
categoryId Long Required. The id of the object
Booking
  POST /api/traveler/booking

Request body (JSON format)

Parameter Type Description
hotelId Long Required. The id of the hotel booking
people Integer Required. Total people
price Long Required. Total booking price
checkIn Date:YYYY-MM-DD Required. Check-in date
checkOut Date:YYYY-MM-DD Required. Check-out date

Role Writer

  • Access requires the writer role
  • Attach the Bearer Token to the request header for access
Get writer detail
  GET /api/writer
Update account
  POST /api/writer/update

Request body (Form-data)

Parameter Type Description
name String Not required. Full name
tels String Not required. Phone number
dob Date:YYYY-MM-DD Not required. Date of birth
username String Not required. Account username
avatar File Not required. Account avatar
Change password
  POST /api/writer/change-password

Request body (JSON format)

Parameter Type Description
currentPassword String Required. Current account password
newPassword String Required. New account password
Create article
  POST /api/article/create

Request body (Form-data)

Parameter Type Description
title String Required. Article title
shortDescription String Required. Article short content
content String Required. Article content
thumbnail File Required. Article thumbnail
Update article
  POST /api/article/update/{article_id}
Parameter Type Description
article_id Long Required. The id of the article to update

Request body (Form-data)

Parameter Type Description
title String Not Required. Article title
shortDescription String Not Required. Article short content
content String Not Required. Article content
thumbnail File Not Required. Article thumbnail

About

Spring Boot project for tourism promotion and hotel booking. This RESTful web service serves as the backend for a tourism and hospitality platform, allowing users to discover and book hotels, access tourist information, and plan their travel experiences.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages