The Hotel Management API implements a complex domain model flow to book a hotel room. The flow simulates a real world application in terms of having a variety of booking options and business rules.
- Spring Boot (JPA, Web, Devtools, Validation, Security)
- Spring Framework
- PostgreSQL
- Maven
- Javax
- Jsonwebtoken
- Lombok
- [http://localhost:8080/api/user/*]
- [http://localhost:8080/api/admin/*]
- [http://localhost:8080/api/hotel/*]
- [http://localhost:8080/api/room/*]
- [http://localhost:8080/api/reservation/*]
Http Method | Path | Usage |
---|---|---|
GET | /api/user/auth | get user by username |
GET | /api/admin/{id}/auth | get user by id (preauthorize admin) |
GET | /api/admin/auth/all | get all users (preauthorize admin) |
GET | /api/admin/auth/search? | search user info from specified parameters... (preauthorize admin) |
POST | /api/admin/auth/add | add user (preauthorize admin) |
POST | /api/user/signup | register |
POST | /api/user/login | login |
PUT | /api/user/auth | update to user |
PUT | /api/admin/{id}/auth | update to user (preauthorize admin) |
PATCH | /api/user/auth | update to password |
DELETE | /api/admin/{id}/auth | delete to user (preauthorize admin) |
Postman collections for user and admin part [https://www.getpostman.com/collections/8e1eb5f0f9126387d0a5]
POST /api/user/signup
{
"username": "gregory",
"password": "test3",
"email": "[email protected]",
"fullName": "Gregory K Kirchner",
"phoneNumber": "(918) 926-1503",
"ssn": "446-66-7249",
"drivingLicense": "467632068",
"country": "USA",
"state": "Oklahoma",
"address": "1350 Bridge Street, Tulsa, OK",
"workingSector": "IT",
"birthDate": "06/09/1958"
}
{
"User registered successfully!": true
}
POST /api/user/login
{
"username": "gregory",
"password": "test3"
}
{
"token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJncmVnb3J5IiwiaWF0IjoxNjM1NjQ2NzAyLCJleHAiOjE2MzU3MzMxMDJ9.tph4RvAlggqA6rBRkgoP2ngjD2dSbow2x7cvY7cDrziWj0TKpdyb3rMNKtaK8TG1PWlhl5R7dxr3DR7Z7v6ORw"
}
GET /api/user/auth
{
"username": "samuel",
"email": "[email protected]",
"fullName": "Samuel M Donahue",
"phoneNumber": "(530) 201-1198",
"ssn": "618-74-2612",
"drivingLicense": "T1822054",
"country": "USA",
"state": "California",
"address": "4112 Kerry Way Santa Fe Springs, CA",
"workingSector": "logistic",
"birthDate": "09/21/1956"
}
PUT /api/user/auth
{
"username": "gregory",
"password": "test3",
"email": "[email protected]",
"fullName": "Gregory K Kirchner",
"phoneNumber": "(918) 926-1504",
"ssn": "446-66-7249",
"drivingLicense": "467632068",
"country": "USA",
"state": "Oklahoma",
"address": "1350 Bridge Street, Tulsa, OK",
"workingSector": "IT",
"birthDate": "06/09/1958"
}
{
"success": true
}
PATCH /api/user/auth
{
"oldPassword": "test3",
"newPassword": "test2"
}
{
"success": true
}
GET /api/admin/{id}/auth
{
"id": 18,
"username": "gregory",
"password": "$2a$10$lY7QP0ieKjJwNOdchpU1luoirXY8g4juZmr1dzQcud0uZG2DjdH8S",
"email": "[email protected]",
"fullName": "Gregory K Kirchner",
"phoneNumber": "(918) 926-1504",
"ssn": "446-66-7249",
"drivingLicense": "467632068",
"country": "USA",
"state": "Oklahoma",
"address": "1350 Bridge Street, Tulsa, OK",
"workingSector": "IT",
"birthDate": "06/08/1958",
"roles": [
{
"id": 1,
"name": "ROLE_CUSTOMER"
}
],
"enabled": null
}
GET /api/admin/auth/search?role=3
[
{
"id": 2,
"username": "samuel",
"password": "$2a$10$SE9.KsdwmdTUdTtpl6y3ieIT4R5SL7JjjV5uH.z7WEBwXc09/kxDm",
"email": "[email protected]",
"fullName": "Samuel M Donahue",
"phoneNumber": "(530) 201-1198",
"ssn": "618-74-2612",
"drivingLicense": "T1822054",
"country": "USA",
"state": "California",
"address": "4112 Kerry Way Santa Fe Springs, CA",
"workingSector": "logistic",
"birthDate": "09/20/1956",
"roles": [
{
"id": 4,
"name": "ROLE_MANAGER"
},
{
"id": 3,
"name": "ROLE_CUSTOMER_SERVICE"
}
],
"enabled": true
}
]
GET /api/admin/auth/all
[
{
"id": 1,
"username": "admin",
"password": "$2a$10$6IgQ.mYGSCh4HrnGbi8OXO.Y03Vs1X6fp3oQWRr2CWRQHn1hO6IKm",
"email": "[email protected]",
"fullName": "Samuel Donahue",
"phoneNumber": "(530) 201-1175",
"ssn": "618-74-2643",
"drivingLicense": "T1822042",
"country": "USA",
"state": "California",
"address": "4112 Kerry Way Santa Fe Springs, CA",
"workingSector": "it",
"birthDate": "09/21/1956",
"roles": [
{
"id": 2,
"name": "ROLE_ADMIN"
}
],
"enabled": true
},
{
"id": 18,
"username": "gregory",
"password": "$2a$10$lY7QP0ieKjJwNOdchpU1luoirXY8g4juZmr1dzQcud0uZG2DjdH8S",
"email": "[email protected]",
"fullName": "Gregory K Kirchner",
"phoneNumber": "(918) 926-1504",
"ssn": "446-66-7249",
"drivingLicense": "467632068",
"country": "USA",
"state": "Oklahoma",
"address": "1350 Bridge Street, Tulsa, OK",
"workingSector": "IT",
"birthDate": "06/08/1958",
"roles": [
{
"id": 1,
"name": "ROLE_CUSTOMER"
}
],
"enabled": null
}
]
POST /api/admin/auth/add
{
"username": "tiffany",
"password": "test4",
"email": "[email protected]",
"fullName": "Tiffany S Johnson",
"phoneNumber": "(908) 977-4194",
"ssn": "149-48-4262",
"drivingLicense": "R4582 60598 82476",
"country": "USA",
"state": "New Jersey",
"address": "4049 Fairfax Drive, New Brunswick, NJ",
"workingSector": "logistic",
"birthDate": "11/10/1974",
"role": ["Manager"],
"enabled": true
}
{
"User registered successfully!": true
}
PUT /api/admin/{id}/auth
{
"username": "tiffany",
"password": "test4",
"email": "[email protected]",
"fullName": "Tiffany S Johnson",
"phoneNumber": "(908) 977-4194",
"ssn": "149-48-4262",
"drivingLicense": "R4582 60598 82476",
"country": "USA",
"state": "New Jersey",
"address": "4049 Fairfax Drive, New Brunswick, NJ",
"workingSector": "logistic",
"birthDate": "11/10/1974",
"role": ["Manager", "CustomerService"],
"enabled": true
}
{
"success": true
}
DELETE /api/admin/{id}/auth
{
"success": true
}