{"id":19023754,"url":"https://github.com/ppichugin/restaurant-voting-system","last_synced_at":"2026-04-13T21:31:41.218Z","repository":{"id":42184556,"uuid":"508296390","full_name":"ppichugin/restaurant-voting-system","owner":"ppichugin","description":"Restaurant Voting System. REST API.","archived":false,"fork":false,"pushed_at":"2022-11-02T05:45:12.000Z","size":252,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-12T01:06:55.284Z","etag":null,"topics":["caffeine-cache","h2-database","hibernate-orm","java","lombok","maven","spring-boot","swagger-ui"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ppichugin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-28T12:47:40.000Z","updated_at":"2023-01-20T13:46:56.000Z","dependencies_parsed_at":"2023-01-21T07:15:17.521Z","dependency_job_id":null,"html_url":"https://github.com/ppichugin/restaurant-voting-system","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ppichugin/restaurant-voting-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppichugin%2Frestaurant-voting-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppichugin%2Frestaurant-voting-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppichugin%2Frestaurant-voting-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppichugin%2Frestaurant-voting-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppichugin","download_url":"https://codeload.github.com/ppichugin/restaurant-voting-system/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppichugin%2Frestaurant-voting-system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31771809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T20:17:16.280Z","status":"ssl_error","status_checked_at":"2026-04-13T20:17:08.216Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["caffeine-cache","h2-database","hibernate-orm","java","lombok","maven","spring-boot","swagger-ui"],"created_at":"2024-11-08T20:32:36.509Z","updated_at":"2026-04-13T21:31:41.196Z","avatar_url":"https://github.com/ppichugin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"REST API Project\n==================\n\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/f4d82a6c9735461c9486a4d76fbff683)](https://www.codacy.com/gh/ppichugin/restaurant-voting-system/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=ppichugin/restaurant-voting-system\u0026utm_campaign=Badge_Grade)  [![Build Status](https://app.travis-ci.com/ppichugin/restaurant-voting-system.svg?branch=master)](https://app.travis-ci.com/ppichugin/restaurant-voting-system)\n\n---\n\n### Content\n\n\u003c!-- TOC --\u003e\n* [TopJava Graduation Project](#topjava-graduation-project)\n    * [Content](#content)\n  * [Restaurant Voting System](#restaurant-voting-system)\n    * [Technical requirement](#technical-requirement)\n    * [Stack](#stack)\n    * [Swagger UI link](#swagger-ui-link)\n    * [Credentials for testing purposes:](#credentials-for-testing-purposes)\n    * [Some testing cURLs](#some-testing-curls)\n      * [Admin API: Administration of restaurants](#admin-api-administration-of-restaurants)\n      * [Admin API: Administration of dishes](#admin-api-administration-of-dishes)\n      * [Admin API: Administration of users](#admin-api-administration-of-users)\n      * [User API: operations with restaurants](#user-api-operations-with-restaurants)\n      * [Profile operations](#profile-operations)\n      * [Voting operations](#voting-operations)\n\u003c!-- TOC --\u003e\n\n---\n\n## Restaurant Voting System\n\nThe voting system for deciding where to have lunch.\n\n---\n\n### Technical requirement\n\nDesign and implement a REST API using Hibernate/Spring/SpringMVC (Spring-Boot preferred!) **without frontend**.\n\nThe task is: **Build a voting system for deciding where to have lunch.**\n\n* 2 types of users: admin and regular users\n* Admin can input a restaurant, and it's lunch menu of the day (2-5 items usually, just a dish name and price)\n* Menu changes each day (admins do the updates)\n* Users can vote on which restaurant they want to have lunch at\n* Only one vote counted per user\n* If user votes again the same day:\n  * If it is before 11:00 we assume that he changed his mind.\n  * If it is after 11:00 then it is too late, vote can't be changed\n* Each restaurant provides a new menu each day.\n\n[ ⬆️Go Up](#content)\n\n---\n\n### Stack\n\n| Technology       | Version                  |\n|------------------|--------------------------|\n| Spring Framework | v.5.3.21                 |\n| Spring Boot      | v.2.6.9                  |\n| Java             | JDK 17.0.3               |\n| Database         | H2 v2.1.214              |\n| Lombok           | v.1.18.24                |\n| Cache            | Caffeine Cache           |\n| REST             | Open API v.3 / SwaggerUI |\n\n[ ⬆️Go Up](#content)\n\n---\n\n### Swagger UI link\n\nhttp://localhost:8080/swagger-ui/index.html\n\n[ ⬆️Go Up](#content)\n\n---\n\n### Credentials for testing purposes:\n\n|        | Login             | Password   |\n|--------|-------------------|------------|\n| User1: | `user1@yandex.ru` | `password` |\n| Admin: | `admin@gmail.com` | `admin`    |\n| User2: | `user2@yandex.ru` | `password` |\n| User3: | `user3@yandex.ru` | `password` |\n| User4: | `user4@yandex.ru` | `password` |\n\n[ ⬆️Go Up](#content)\n\n---\n\n### Some testing cURLs\n\n---\n\n#### Admin API: Administration of restaurants\n\n- Get all restaurants by Admin:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user admin@gmail.com:admin http://localhost:8080/api/admin/restaurants\n```\n\n- Create new restaurant by Admin:\n\n```console\ncurl -H \"Content-Type: application/json\" -X POST http://localhost:8080/api/admin/restaurants -v --user admin@gmail.com:admin -d \"{\\\"name\\\": \\\"New restaurant1\\\"}\"\n```\n\n- Update existing restaurant by Admin:\n\n```console\ncurl -H \"Content-Type: application/json\" -X PUT http://localhost:8080/api/admin/restaurants/100009 -v --user admin@gmail.com:admin -d \"{\\\"name\\\": \\\"Updated Roof to Heaven\\\"}\"\n```\n\n- Get existing restaurant by Admin:\n\n```console\ncurl -X GET http://localhost:8080/api/admin/restaurants/100009 -v --user admin@gmail.com:admin -H \"accept: application/json\"\n```\n\n[ ⬆️Go Up](#content)\n\n---\n\n#### Admin API: Administration of dishes\n\n- Get all dishes from restaurant {100005} by Admin:\n\n```console\ncurl -X GET http://localhost:8080/api/admin/restaurants/100010/dishes -v --user admin@gmail.com:admin -H \"accept: application/json\"\n```\n\n- Create new dish for restaurant {100005} by Admin:\n\n```console\ncurl -X POST http://localhost:8080/api/admin/restaurants/100010/dishes -H \"accept: application/json\" -H \"Content-Type: application/json\" -d \"{\\\"name\\\": \\\"Coffee Pastry\\\",\\\"price\\\": 12}\" -v --user admin@gmail.com:admin\n```\n\n- Update dish {100038} for restaurant {100005} by Admin:\n\n```console\ncurl -X PUT http://localhost:8080/api/admin/restaurants/100010/dishes/100038 -H \"accept: application/json\" -H \"Content-Type: application/json\" -d \"{\\\"name\\\": \\\"Waffles with cream\\\",\\\"price\\\": 200}\" -v --user admin@gmail.com:admin\n```\n\n- Delete dish {100033} for restaurant {100005} by Admin:\n\n```console\ncurl -X DELETE http://localhost:8080/api/admin/restaurants/100010/dishes/100033 -v --user admin@gmail.com:admin\n```\n\n[ ⬆️Go Up](#content)\n\n---\n\n#### Admin API: Administration of users\n\n- Get all users by Admin:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user admin@gmail.com:admin http://localhost:8080/api/admin/users\n```\n\n- Get user {id=100000} by Admin:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user admin@gmail.com:admin http://localhost:8080/api/admin/users/100000\n```\n\n[ ⬆️Go Up](#content)\n\n---\n\n#### User API: operations with restaurants\n\n- Get all restaurants with ID only:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user user1@yandex.ru:password http://localhost:8080/api/restaurants/\n```\n\n- Get all restaurants with menu today:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user user1@yandex.ru:password http://localhost:8080/api/restaurants/with-menu\n```\n\n- Get restaurant {id=100005} with menu today:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user user1@yandex.ru:password http://localhost:8080/api/restaurants/100005/with-menu\n```\n\n- Get restaurant {id=100011} without menu for today:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user user1@yandex.ru:password http://localhost:8080/api/restaurants/100011/with-menu\n```\n\n[ ⬆️Go Up](#content)\n\n---\n\n#### Profile operations\n\n- Get profile of the logged-in user:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user admin@gmail.com:admin -X GET http://localhost:8080/api/profile\n```\n\n- Create new user:\n\n```console\ncurl -X POST -d \"{\\\"name\\\":\\\"newName\\\",\\\"email\\\":\\\"newemail2@ya.ru\\\",\\\"password\\\":\\\"newPassword\\\"}\" http://localhost:8080/api/profile -H \"Content-Type: application/json\"\n```\n\n[ ⬆️Go Up](#content)\n\n---\n\n#### Voting operations\n\n- Get all votes of authenticated user:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user user1@yandex.ru:password http://localhost:8080/api/profile/votes\n```\n\n- Get votes for today of authenticated user:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user user1@yandex.ru:password http://localhost:8080/api/profile/votes/by-date\n```\n\n❗ _'/by-date' without provided parameter will filter votes for today by default_\n\n- Get votes for yesterday of authenticated user:\n\n```console\ncurl -H \"Content-Type: application/json\" -v --user user1@yandex.ru:password \"http://localhost:8080/api/profile/votes/by-date?date=2022-08-03\"\n```\n\n❗ _change parameter 'date=' to the yesterday value while testing_\n\n- Make new vote for restaurant {100006} by user who didn't vote today:\n\n```console\ncurl -X POST -H \"Content-Type: application/json\" -v --user user3@yandex.ru:password http://localhost:8080/api/profile/votes?restaurantId=100006\n```\n\n❗ _'user3@yandex.ru' didn't vote for restaurant {100006} by today yet_\n\n[ ⬆️Go Up](#content)\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppichugin%2Frestaurant-voting-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppichugin%2Frestaurant-voting-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppichugin%2Frestaurant-voting-system/lists"}