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 assume that he changed his mind.
- If it is after 11:00 then it is too late, vote can't be changed
- Each restaurant provides a new menu each day.
- Clone this repository to your machine
- Open up terminal and navigate to the root directory
- Make sure you've maven and java 17 installed
- Run 'mvn spring-boot:run'
- docker-compose up
User: [email protected] / kanye
Admin: [email protected] / admin
Test user: [email protected] / testuser
curl -s http://localhost:8080/api/restaurants --user [email protected]:kanye
curl -s http://localhost:8080/api/restaurants/3 --user [email protected]:kanye
curl -s http://localhost:8080/api/restaurants/1017 --user [email protected]:kanye
curl -s -X POST -d '{"name": "Anderson"}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/api/admin/restaurants --user [email protected]:admin
curl -s -X DELETE http://localhost:8080/api/admin/restaurants/2 --user [email protected]:admin
curl -s http://localhost:8080/api/dishes --user [email protected]:kanye
curl -s http://localhost:8080/api/dishes?restaurantId=3 --user [email protected]:kanye
curl -s -X POST -d '{"name": "new dish","price": 1017.0,"restaurantId": 3,"entryDate": "2022-05-21"}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/api/admin/dishes --user [email protected]:admin
curl -s -X DELETE http://localhost:8080/api/admin/dishes/6 --user [email protected]:admin
curl -s http://localhost:8080/api/profile/voting --user [email protected]:kanye
curl -s -X POST -d '{"restaurantId": 3}' -H 'Content-Type:application/json;charset=UTF-8' http://localhost:8080/api/profile/voting --user [email protected]:testuser
Spring Boot, Spring MVC, Spring Security, Spring Data JPA, Hibernate ORM, JUnit 5, AssertJ, Apache Tomcat, Hibernate Validator, SLF4J, Json Jackson, Springdoc OpenAPI UI, Mockito, Java 17, Caffeine cache