Skip to content

About

topjava graduation project

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

My topjava graduation project


Given task description:

Design and implement a REST API using Hibernate/Spring/SpringMVC (or 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.

API

AdminRestController

   

path: rest/admin/users

Method GET: Returns all users

path: rest/admin/users/{id}

Method GET: Returns one user with given id

path: rest/admin/users

Method POST: Adds new user

path: rest/admin/users

Method PUT: Updates existing user

path: rest/admin/users/{id}

Method DELETE: deletes user with given id

path: rest/admin/users/by

Method GET with parameter email: Returns user by email

ProfileRestController

   

path: rest/profile/register

Method POST: Register new user

path: rest/profile

Method GET: Returns authorized user

path: rest/profile

Method PUT: updates authorized user

path: rest/profile

Method DELETE: Deletes authorized user

RestaurantRestController

   

path: rest/admin/restaurants

Method GET: Returns all restaurants

path: rest/admin/restaurants/{id}

Method GET: Returns one restaurant with given id

path: rest/admin/restaurants

Method POST: Adds new restaurant

path: rest/admin/restaurants

Method PUT: Updates existing restaurant

path: rest/admin/restaurants/{id}

Method DELETE: deletes user with given id

AdminMenuController

   

path: rest/admin/menus

Method POST: Adds new menu with current date

path: rest/admin/menus/future

Method POST with parameter date: Adds new menu with future date given as parameter

path: rest/admin/menus

Method PUT: Updates existing menu

path: rest/admin/menus/{id}

Method GET: Returns one menu with given id


MenuRestController

   

path: rest/menus/today

Method GET: Returns today's menus

path: rest/menus/bydate

Method GET: Returns menus for the date given as parameter 'date'

AdminVoteController

   

path: rest/admin/voteresult

Method GET: Returns voting results for date given as parameter 'date'

path: rest/admin/todayvoteresult

Method GET: Returns current voting results

VoteRestController

   

path: rest/votes

Method POST: Gives authorized user's vote for menu which id was given as parameter 'menuId'

path: rest/votes

Method PUT: Change authorized user's vote for menu which id was given as parameter 'menuId' (possible only till 11:00 AM)

path: rest/votes/votedmenu

Method GET: Returns menu which authorized user voted on date given as parameter 'date'

About

topjava graduation project

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages