docker run --name ampos-mysql8.0 \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=ampos \
-e MYSQL_DATABASE=ampos \
-e MYSQL_USER=ampos \
-e MYSQL_PASSWORD=ampos \
-d mysql:8.0 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
brew install sbt@1
sbt run
- Menu Management
- Bill Order Management
- Exception Handling - Currently Server will only respond
Status 400
when any exception occurs.
POST localhost:9000/foods
{
"name": "Banana milkshake",
"description": "Spiced Banana Milkshake – This deliciously thick banana milkshake is so full of flavour, and is perfectly spiced with a hint of cinnamon and ginger. A perfect, indulgent pick-me-up drink!",
"image": "https://brainfoodstudio.com/wp-content/uploads/2017/06/dairy-free-banana-peanut-butter-shake-2.jpg",
"price": 60,
"types": [
"Banana",
"Milk"
]
}
Status 201
{
"id": 21,
"name": "Banana milkshake",
"description": "Spiced Banana Milkshake – This deliciously thick banana milkshake is so full of flavour, and is perfectly spiced with a hint of cinnamon and ginger. A perfect, indulgent pick-me-up drink!",
"image": "https://brainfoodstudio.com/wp-content/uploads/2017/06/dairy-free-banana-peanut-butter-shake-2.jpg",
"price": 60,
"types": [
"Banana",
"Milk"
]
}
GET localhost:9000/foods?keyword={keyword}&page={page}&size={size}
- Note: Query Strings are not mandatory.
GET localhost:9000/foods?keyword=Banana
{
"keyword": "Banana",
"total": 1,
"foods": [
{
"id": 21,
"name": "Banana milkshake",
"description": "Spiced Banana Milkshake – This deliciously thick banana milkshake is so full of flavour, and is perfectly spiced with a hint of cinnamon and ginger. A perfect, indulgent pick-me-up drink!",
"image": "https://brainfoodstudio.com/wp-content/uploads/2017/06/dairy-free-banana-peanut-butter-shake-2.jpg",
"price": 60,
"types": [
"Milk",
"Banana"
]
}
]
}
PUT localhost:9000/foods/{foodId}
{
"name": "Banana milkshake",
"description": "Spiced Banana Milkshake – This deliciously thick banana milkshake is so full of flavour, and is perfectly spiced with a hint of cinnamon and ginger. A perfect, indulgent pick-me-up drink!",
"image": "https://brainfoodstudio.com/wp-content/uploads/2017/06/dairy-free-banana-peanut-butter-shake-2.jpg",
"price": 60,
"types": [
"Banana",
"Milk"
]
}
Status 200
DELETE localhost:9000/foods/{foodId}
Status 200
POST localhost:9000/bills
{
"newOrders": [
{
"id": 21,
"quantity": 3
}
]
}
Status 201
{
"id": 13,
"orderedTime": "05/08/2019 05:31:18",
"orders": [
{
"foodName": "Banana milkshake",
"unitPrice": 60,
"quantity": 3
}
],
"totalPrice": 180
}
GET localhost:9000/bills
[
{
"id": 13,
"orderedTime": "05/07/2019 21:38:48",
"orders": [
{
"foodName": "Banana milkshake",
"unitPrice": 60,
"quantity": 3
}
],
"totalPrice": 180
}
]
GET localhost:9000/bills/{billId}/check
{
"id": 14,
"orderedTime": "05/07/2019 21:38:48",
"orders": [
{
"foodName": "Banana milkshake",
"unitPrice": 60,
"quantity": 3
}
],
"totalPrice": 180
}
PUT localhost:9000/bills/{billId}
{
"newOrders":[{"id":15, "quantity": 1}, {"id":19, "quantity": 3}],
"orders": [
{
"foodName": "Chocolate",
"quantity": 5
}
]
}
- Note: The behavior of new addition of order items is like creating bill API.
- Note: If you don't want to update any existing order items, the same values need to be passed.
- Note:
foodName
is used as a part of primary key for snapshotting foods of the menu. So future modification of foods won't influence the result of the past bill.