Skip to content

EvgenyiRus/Restaurant-voting-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Restaurant voting project

Design and implement a REST API using Hibernate/Spring-Boot without frontend.

The task is:

Build a voting system for deciding where to have lunch.

  • 2 types of users: admin and regular users
  • Admin can input a restaurant and it's lunch menu of the day (2-5 items usually, just a dish name and price)
  • Menu changes each day (admins do the updates)
  • Users can vote on which restaurant they want to have lunch at
  • Only one vote counted per user
  • If user votes again the same day:
    • If it is before 11:00 we asume that he changed his mind.
    • If it is after 11:00 then it is too late, vote can't be changed
Each restaurant provides new menu each day.

Swagger UI:

http://localhost:8080/swagger-ui/index.html


cURL commands for unregister user:

register new User

curl -s -i -X POST -d '{"name":"New User","email":"[email protected]","password":"password"}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/profile/register

cURL commands for user:

get All Menus Restaurants

curl -s http://localhost:8080/restaurants/menus --user [email protected]:password

get Menu Restaurant 100014

curl -s http://localhost:8080/restaurants/100014/menus --user [email protected]:password

create Vote for Restaurant 100014

curl -s -X POST -d '{}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/restaurants/100014/votes --user [email protected]:gosha

cURL commands for admin:

get Users who voted for Restaurant 100014

curl -s http://localhost:8080/restaurants/100014/votes --user [email protected]:password

get All Restaurants

curl -s http://localhost:8080/restaurants --user [email protected]:admin

create new Restaurant

curl -s -X POST -d '{"name":"Created restaurant"}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/restaurants --user [email protected]:admin

update Restaurant 100014

curl -s -X PUT -d '{"name":"Edited restaurant"}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/restaurants/100014 --user [email protected]:admin

delete Restaurant 100014

curl -s -X DELETE http://localhost:8080/restaurants/100014 --user [email protected]:admin

create today's new MenuItem for Restaurant 100014

curl -s -X POST -d '{"dishId":100003, "price":1000}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/restaurants/100014/menus --user [email protected]:admin

get All Users

curl -s http://localhost:8080/admin/users --user [email protected]:admin

get Users 100000

curl -s http://localhost:8080/admin/users/100000 --user [email protected]:admin

get votes Users 100000

curl -s http://localhost:8080/admin/users/100000/votes --user [email protected]:admin

create new Dish

curl -s -X POST -d '{"description":"Created dish"}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/dishes --user [email protected]:admin

get Dish that contains in description "coffee"

curl -s http://localhost:8080/dishes?description=coffee --user [email protected]:admin

get history Dish 100002

curl -s http://localhost:8080/dishes/100002/history --user [email protected]:admin

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages