Demo project "Voting for restaurants"
How does it work?
The administrator creates a menu every day. In addition, when he will create the first dish, the entity of the voting will be automatically created.
Voting possible only if dishes present today. If restaurant don't containes any dish for todays date that voting impossible.
Admin also can update or delete menu. If admin will update some old dish that the entity of the voting for this restaurant will be automatically created.
Every restaurant have entity of vote for avery day when it contains menu.
Users can vote every day for the different restaurants which contains menu.
If user wants vote again for another restaurant that he can do it until to 11:00 am.
After he can do it in another day.
User can vote from 00:01 to 24:00
- can registration( For example: get all restaurants admin@gmail.com : password )
- can add restaurants(name and description)
- can add restaurants dishes(name and price)
- can watch the voting history(by restaurant Id, by date)
- can watch list of restaurants
- can watch list of dishes
- can change field enable(true|false) for users
- can’t vote
- can’t delete admins or users
- can registration( For example: get result or list menu with restaurants user2@yandex.ru : password )
- can vote( For example: vote for restaurant with id 10006)
- can watch voting after the vote (if he has not voted, he will redirect to the voting list)
- can change his voice by 11 o’clock
- can vote between 00:00 and 23:59
- can’t add or remove restaurants and dishes and other entities
- from 00:00 to 23:59
- the user can vote for the menu that was created or updated by the Administrator today
- the system have a voting history by date
- the system have a menu(dishes) history by date
- consist of the name and price
For testing on localhost. If you want testing on cloud service Heroku you need change "http://localhost:8080" to "https://voting-rest.herokuapp.com"
Notes. After 30 minutes of inactivity, Heroku needs some time (~ 2 minutes) to start the system.
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/restaurants
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/restaurant/10004
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/restaurants/dishes
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/restaurants/dishes/10006
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/restaurants/dishes/date/2017-11-11
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/restaurants/votes
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/restaurants/votes/10005
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/restaurants/votes/date/2018-01-11
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic dXNlckB1a3IubmV0OnBhc3N3b3Jk' -i http://localhost:8080/rest/user/dishes/forVoting
- curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/dish/10008 --data '{"name":"Some Dish3 блюдо","price":350}'
- curl -X PUT -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/dish/10022 --data '{"name":"New Dish блюдо","price":453}'
- curl -X DELETE -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/dish/10021
- curl -X POST -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/restaurant --data '{"name":"Ресторан Golden Star","description":"text текст"}'
- curl -X PUT -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/restaurant/10007 --data '{"name":"Ресторан NEW Star","description":"new текст"}'
- curl -X DELETE -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/restaurant/10008
- curl -X GET -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/user/10002
- curl -X GET -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/users
- curl -X PUT -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/user/on/10003
- curl -X PUT -H 'Authorization: Basic YWRtaW5AZ21haWwuY29tOnBhc3N3b3Jk' -i http://localhost:8080/rest/admin/user/off/10003
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic dXNlckB1a3IubmV0OnBhc3N3b3Jk' -i http://localhost:8080/rest/user/votes
- curl -X GET -H 'Content-Type: application/json' -H 'Authorization: Basic dXNlckB1a3IubmV0OnBhc3N3b3Jk' -i http://localhost:8080/rest/user/voteFor/10006
For testing on Firefox can try RESTClient
10.2018
© Created by Kirilo Lozitsky
Email for questions