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.
- Spring Framework: Spring Boot, Spring Web, Spring Security, Spring Data JPA
- Language: Java
- Lombok
- Mapstruct
- Hibernate validator
- Jsonwebtoken
User roles:
- Guest/Public
- Traveler
- Writer
Hotel api ↥
GET /api/hotel
GET /api/hotel/random?quantity={quantity}
Parameter | Type | Description |
---|---|---|
quantity |
Integer |
Not required. Default value is 20 |
GET /api/hotel/{hotel_id}
Parameter | Type | Description |
---|---|---|
hotel_id |
Long |
Required. Id of hotel to fetch |
GET /api/hotel/filter-infor
Place api ↥
GET /api/place
GET /api/place/random?quantity={quantity}
Parameter | Type | Description |
---|---|---|
quantity |
Integer |
Not required. Default value is 20 |
GET /api/place/{place_id}
Parameter | Type | Description |
---|---|---|
place_id |
Long |
Required. Id of place to fetch |
GET /api/place/filter-infor
Restaurant api ↥
GET /api/restaurant
GET /api/restaurant/random?quantity={quantity}
Parameter | Type | Description |
---|---|---|
quantity |
Integer |
Not required. Default value is 20 |
GET /api/restaurant/{restaurant_id}
Parameter | Type | Description |
---|---|---|
restaurant_id |
Long |
Required. Id of restaurant to fetch |
GET /api/restaurant/filter-infor
Article api ↥
GET /api/article
GET /api/article/random?quantity={quantity}
Parameter | Type | Description |
---|---|---|
quantity |
Integer |
Not required. Default value is 20 |
GET /api/article/detail/{article_id}
Parameter | Type | Description |
---|---|---|
article_id |
Long |
Required. Id of article to fetch |
Search api ↥
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 ↥
GET /api/render/{image_file}
Parameter | Type | Description |
---|---|---|
image_file |
String |
Required. The full file name to render |
User authentication api ↥
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 |
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 |
POST /api/auth/writer/check-username-exist
Request body (x-www-form-urlencoded)
Parameter | Type | Description |
---|---|---|
username |
String |
Required. Username to check existence |
POST /api/auth/writer/check-email-exist
Request body (x-www-form-urlencoded)
Parameter | Type | Description |
---|---|---|
email |
String |
Required. Email to check existence |
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 |
GET /api/auth/traveler/check-username-exist?username={username}
Parameter | Type | Description |
---|---|---|
username |
String |
Required. Username to check existence |
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 /api/traveler
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 |
POST /api/traveler/change-password
Request body (JSON format)
Parameter | Type | Description |
---|---|---|
currentPassword |
String |
Required. Current account password |
newPassword |
String |
Required. New account password |
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 |
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 /api/writer
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 |
POST /api/writer/change-password
Request body (JSON format)
Parameter | Type | Description |
---|---|---|
currentPassword |
String |
Required. Current account password |
newPassword |
String |
Required. New account password |
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 |
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 |