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
http://localhost:8080/swagger-ui/index.html
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 -s http://localhost:8080/restaurants/menus --user [email protected]:password
curl -s http://localhost:8080/restaurants/100014/menus --user [email protected]:password
curl -s -X POST -d '{}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/restaurants/100014/votes --user [email protected]:gosha
curl -s http://localhost:8080/restaurants/100014/votes --user [email protected]:password
curl -s http://localhost:8080/restaurants --user [email protected]:admin
curl -s -X POST -d '{"name":"Created restaurant"}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/restaurants --user [email protected]:admin
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
curl -s -X DELETE http://localhost:8080/restaurants/100014 --user [email protected]:admin
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
curl -s http://localhost:8080/admin/users --user [email protected]:admin
curl -s http://localhost:8080/admin/users/100000 --user [email protected]:admin
curl -s http://localhost:8080/admin/users/100000/votes --user [email protected]:admin
curl -s -X POST -d '{"description":"Created dish"}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/dishes --user [email protected]:admin
curl -s http://localhost:8080/dishes?description=coffee --user [email protected]:admin
curl -s http://localhost:8080/dishes/100002/history --user [email protected]:admin