Restaurant Review Repo is a Backend Application Built using technologies like Spring Boot, Hibernate, MySQL, JWT. This application allows users to create a profile, Restaurants to create a restaurant, food and menu entities. The users and the restaurants are also allowed to provide contact information such as email address and mobile number. In addition, the Application provides APIs allowing users to comment and rate restaurants. This application provides Authentication using JWT. Thereby to create a restaurant, provide ratings and comments, a user must be authenticated and must include bearer token in header.
To run the Application follow the following Steps,
- Clone the Repository and change the current directory path to the cloned repository path.
- Make sure a DB instance is running with username password mentioned in the Application.properties.(Any changes in Application.properties require re building the Application)
- Move into the target directory and run the following command "java -jar RestaurentReview-0.0.1-SNAPSHOT.jar".
- This should bootup the application and the application starts running on port 8080.
Creating User does not need authentication. So no JWT has to be included for creating a user.
| Http Method | Path | Description | Example | Bearer Token |
|---|---|---|---|---|
| POST | /api/v1/user | Adds user to DB. | { "first_name": "Sanjana", "last_name": "Kandunoori", "gender": "Female", "birth_date": "07-30-1997", "username": "sanju", "password": "sanju1234", "contact": { "mobileNumber":"5104930930", "email":"sanju@gmail.com" }, "address": { "street": "19 Dal St", "apt": "C", "city": "Boston", "state": "Mass", "country": "US", "zipCode": "02130" } } |
No |
| GET | /api/v1/user | Fetches all the users from the database. | No Body Required |
No |
| GET | /api/v1/user/{id} | Fetches user with a specific id. | No Body Required |
No |
| PUT | /api/v1/user/{id} | Updates the user with details provided in the body. | { "first_name": "Kaushik", "last_name": "Boora", "gender": "Male", "birth_date": "07-30-1997", } |
No |
| DELETE | /api/v1/user/{id} | Deletes user with the id mentioned in the path variable. | No Body Required |
No |
Creating restaurant requires authorization. Hence, JWT must be included in the header.
| Http Method | Path | Description | Example | Bearer Token |
|---|---|---|---|---|
| POST | /api/v1/restaurant | Adds restaurant to DB. | { "name": "Godavari", "contact": { "mobileNumber":"7044304130", "email":"sanju@gmail.com" }, "address": { "street": "19 Dal st", "apt": "B", "city": "Boston", "state": "Mass", "country": "US", "zipCode": "02130" } } |
Yes |
| GET | /api/v1/restaurant | Fetches all the restaurants from the database. | No Body Required |
Yes |
| GET | /api/v1/restaurant/{id} | Fetches restaurant with a specific id from the database. | No Body Required |
Yes |
| PUT | /api/v1/restaurant/{id} | Updates the restaurant with details provided in the body. | { "name": "Aaha", } |
Yes |
| DELETE | /api/v1/restaurant/{id} | Deletes restaurant with the id mentioned in the path variable. | No Body Required |
Yes |
Creating address requires authorization. Hence, JWT must be included in the header.
| Http Method | Path | Description | Example | Bearer Token |
|---|---|---|---|---|
| POST | /api/v1/address/restaurant/{restaurantId} | Updates the Address of a Restaurant by creating a new address. | { "street": "19 Dal st", "apt": "B", "city": "Boston", "state": "Mass", "country": "US", "zipCode": "02130" } |
Yes |
| POST | /api/v1/address/user/{userId} | Updates the Address of a user by creating a new address. | { "street": "9 Elmore st", "apt": "A", "city": "Boston", "state": "Mass", "country": "US", "zipCode": "02130" } |
Yes |
| GET | /api/v1/address | Fetches all the addresses from the database. | No Body Required |
Yes |
| GET | /api/v1/address/{id} | Fetches address with a specific id from the database. | No Body Required |
Yes |
| PUT | /api/v1/address/{id} | Updates the address with the details provided in the body. | { "street": "198 Am st", "apt": "A", "city": "Boston", "state": "Mass", "country": "US", "zipCode": "02130" } |
Yes |
| DELETE | /api/v1/address/{id} | Deletes address with the id mentioned in the path variable. | No Body Required |
Yes |
Creating contact requires authorization. Hence, JWT must be included in the header.
| Http Method | Path | Description | Example | Bearer Token |
|---|---|---|---|---|
| POST | /api/v1/contact/restaurant/{restaurantId} | Updates the contact of a Restaurant by creating a new contact. | { "email": "ks@gmail.com", "mobileNumber": "7044304130" } |
Yes |
| POST | /api/v1/contact/user/{userId} | Updates the contact of a user by creating a new contact. | { "email": "sanjana@gmail.com", "mobileNumber": "5104930930" } |
Yes |
| GET | /api/v1/contact | Fetches all the contacts from the database. | No Body Required |
Yes |
| GET | /api/v1/contact/{id} | Fetches contact with a specific id from the database. | No Body Required |
Yes |
| PUT | /api/v1/contact/{id} | Updates the contact with the details provided in the body. | { "email": "sai@gmail.com", "mobileNumber": "7044354135" } |
Yes |
| DELETE | /api/v1/contact/{id} | Deletes contact with the id mentioned in the path variable. | No Body Required |
Yes |
Creating rating requires authorization. Hence, JWT must be included in the header.
| Http Method | Path | Description | Example | Bearer Token |
|---|---|---|---|---|
| POST | /api/v1/rating/restaurant/{restaurantId}/user/{userId} | Adds a rating provided by the user with the mentioned id to a specific id of the restaurant. | { "value": 2 } |
Yes |
| GET | /api/v1/rating | Fetches all the ratings from the database. | No Body Required |
Yes |
| GET | /api/v1/rating/{id} | Fetches rating with a specific id from the database. | No Body Required |
Yes |
| PUT | /api/v1/rating/{id} | Updates the rating with the details provided in the body. | { "value": 5 } |
Yes |
| DELETE | /api/v1/rating/{id} | Deletes rating with the id mentioned in the path variable. | No Body Required |
Yes |
Creating comment requires authorization. Hence, JWT must be included in the header.
| Http Method | Path | Description | Example | Bearer Token |
|---|---|---|---|---|
| POST | /api/v1/comment/restaurant/{restaurantId}/user/{userId} | Adds a comment provided by the user with the mentioned id to a specific id of the restaurant. | { "comment": "Bad" } |
Yes |
| GET | /api/v1/comment | Fetches all the comments from the database. | No Body Required |
Yes |
| GET | /api/v1/comment/{id} | Fetches comment with a specific id from the database. | No Body Required |
Yes |
| PUT | /api/v1/comment/{id} | Updates the comment with the details provided in the body. | { "comment": "Delicious" } |
Yes |
| DELETE | /api/v1/comment/{id} | Deletes comment with the id mentioned in the path variable. | No Body Required |
Yes |
Creating food requires authorization. Hence, JWT must be included in the header.
| Http Method | Path | Description | Example | Bearer Token |
|---|---|---|---|---|
| POST | /api/v1/food | Adds food to the database | { "name": "Pasta", "ingredients": "Penne, Veggies, Salt", "cuisine": "Italian" } |
Yes |
| GET | /api/v1/food | Fetches all the food from the database. | No Body Required |
Yes |
| GET | /api/v1/food/{id} | Fetches food with a specific id from the database. | No Body Required |
Yes |
| PUT | /api/v1/food/{id} | Updates the food with the details provided in the body. | { "name": "Rice", "ingredients": "rice, water, salt", "cuisine": "Indian" } |
Yes |
| DELETE | /api/v1/food/{id} | Deletes food with the id mentioned in the path variable. | No Body Required |
Yes |
Creating menu requires authorization. Hence, JWT must be included in the header.
| Http Method | Path | Description | Example | Bearer Token |
|---|---|---|---|---|
| POST | /api/v1/menu//restaurant/{restaurantId}/food/{foodId} | Adds menu to the database and links to the restaurant and food with their respective id’s mentioned in the path | { "price": 15, "calories": 100 } |
Yes |
| GET | /api/v1/menu | Fetches all menu from the database. | No Body Required |
Yes |
| GET | /api/v1/menu/{id} | Fetches menu with a specific id from the database. | No Body Required |
Yes |
| PUT | /api/v1/menu/{id} | Updates the menu with the details provided in the body. | { "price": 30, "calories": 150 } |
Yes |
| DELETE | /api/v1/menu/{id} | Deletes menu with the id mentioned in the path variable. | No Body Required |
Yes |