Giter Site home page Giter Site logo

musanabiyev / hotel-management Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nuriyeyldrm/hotel-management

0.0 0.0 0.0 90 KB

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.

License: MIT License

Java 100.00%

hotel-management's Introduction

Hotel Management API Back-end

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.

Technologies

  • Spring Boot (JPA, Web, Devtools, Validation, Security)
  • Spring Framework
  • PostgreSQL
  • Maven
  • Javax
  • Jsonwebtoken
  • Lombok
Application starts on localhost port 8080
  • [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/*]

Available Services

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)

... continues

Postman collections for user and admin part [https://www.getpostman.com/collections/8e1eb5f0f9126387d0a5]

NOTE: All method except signup/login methods, needs Authorization Bearer token in header

image

User Resources

Request

POST /api/user/signup
Body

{   
    "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"
}
Response

{
    "User registered successfully!": true
}

--------------------------------------------------

Request

POST /api/user/login
Body

{   
    "username": "gregory",
    "password": "test3"
}
Response

{
    "token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJncmVnb3J5IiwiaWF0IjoxNjM1NjQ2NzAyLCJleHAiOjE2MzU3MzMxMDJ9.tph4RvAlggqA6rBRkgoP2ngjD2dSbow2x7cvY7cDrziWj0TKpdyb3rMNKtaK8TG1PWlhl5R7dxr3DR7Z7v6ORw"
}

--------------------------------------------------

Request

GET /api/user/auth
Response

{
    "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"
}

--------------------------------------------------

Request

PUT /api/user/auth
Body

{   
    "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"
}
Response

{
    "success": true
}

--------------------------------------------------

Request

PATCH /api/user/auth
Body

{   
    "oldPassword": "test3",
    "newPassword": "test2"
}
Response

{
    "success": true
}

--------------------------------------------------

Request

GET /api/admin/{id}/auth
Response

{
    "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
}

--------------------------------------------------

Request

GET /api/admin/auth/search?role=3
Params

image

Response

[
    {
        "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
    }
]

--------------------------------------------------

Request

GET /api/admin/auth/all
Response

[
    {
        "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
    }
]

--------------------------------------------------

Request

POST /api/admin/auth/add
Body

{   
    "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
}
Response

{
    "User registered successfully!": true
}

--------------------------------------------------

Request

PUT /api/admin/{id}/auth
Body

{   
    "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
}
Response

{
    "success": true
}

--------------------------------------------------

Request

DELETE /api/admin/{id}/auth
Response

{
    "success": true
}

hotel-management's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.