Skip to content

ricardobaumann/vending-machine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vending machine

Objectives

  • REST API should be implemented consuming and producing “application/json”
  • Implement user model with username, password, deposit and role fields
  • All of the endpoints should be authenticated unless stated otherwise
  • Implement product model with amountAvailable, cost (should be in multiples of 5), productName and sellerId fields
  • Implement an authentication method (basic, oAuth, JWT or something else, the choice is yours)
  • Implement CRUD for users (POST /user should not require authentication to allow new user registration)
  • Implement CRUD for a product model (GET can be called by anyone, while POST, PUT and DELETE can be called only by the seller user who created the product)
  • Implement /deposit endpoint so users with a “buyer” role can deposit only 5, 10, 20, 50 and 100 cent coins into their vending machine account (one coin at the time)
  • Implement /buy endpoint (accepts productId, amount of products) so users with a “buyer” role can buy a product ( shouldn't be able to buy multiple different products at the same time) with the money they’ve deposited. API should return total they’ve spent, the product they’ve purchased and their change if there’s any (in an array of 5, 10, 20, 50 and 100 cent coins)
  • Implement /reset endpoint so users with a “buyer” role can reset their deposit back to 0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages