Searching restaurants, getting menus, ordering foods and paying for an order.
-
Search a restaurant by name
-
Order food by choosing menu items, quantity and adding a note.
-
User can also fills in delivery address.
-
User should be able to pay.
The application is built on micro-service design. The application consists of three modules.
-
Restaurant
- You can search restaurant, get menu of it here.
-
Order
- You can place your order here.
-
Payment
- You can pay your order here.
Query restaurant -> query menu -> query menu items -> place order -> pay the bill -> payment service notify order service
-
Restaurant
-
Relational database
-
Three table - because they are one to many and we can query restaurant info without querying its menu
-
-
Order
-
mongoDB
-
The reason I used mongoDB is an order can have various number of items in it.
-
-
Payment
- Relational database (structured, query by id)
The format of POST request can be found in the test data (Restaurants.json, Orders.json, Payments.json)
-
Restaurant
-
foo.com/restaurants
-
GET passing name(optional), page and size (optional) as parameters and get list of restaurants
-
DELETE delete all restaurants
-
POST upload a bunch of restaurants
-
-
foo.com/restaurants/[id]
-
GET get details of the restaurant
-
DELETE delete the restaurant
-
GET /restaurants/[id]/menus to get the menus of the restaurant
-
-
foo.com/menus
-
POST create a list of menus
-
GET passing page and size (optional) as parameters and get list of menus
-
DELETE delete all menus
-
-
foo.com/menus/[id]
-
GET get info of the menu
-
DELETE delete a menu
-
-
foo.com/menu_items
-
GET passing page and size (optional) as parameters and get list of menu items
-
POST upload a list of menu items
-
DELETE delete all menu items
-
-
foo.com/menu_items/[id]
-
GET menu items by menu id
-
DELETE delete a menu item
-
GET /menu_items/[id]/price to get the price of it
-
-
-
Order
-
foo.com/orders
-
POST create a list of orders
-
GET passing page and size (optional) as parameters and get list of orders
-
-
foo.com/orders/[id]
- GET query info
-
foo.com/orders/[id]/is_paid
-
GET get if the order is paid
-
PUT set if it is paid
-
-
foo.com/orders/[id]/is_cancelled
-
GET get if the order is cancelled
-
PUT set if it is cancelled
-
-
-
Payment
-
foo.com/payment
-
GET passing page and size (optional) as parameters and get list of payments
-
POST create a payment
-
-
foo.com/payment/[id]
- GET Return its info
-
The basic idea is: upload top down in hierarchy.
-
Upload restaurants and get the id from response.
-
Upload menus with the restaurant id they belong to and get the menu id from respons.
-
Upload menu items with the menu id they belong to.
launch restaurant -> upload test data -> launch order -> upload test data -> launch payment
Please note that because we cannot predict id generated by MongoDB, the test data of payment cannot let any order change to payed. The order service will only log a request try to set an inexistent order to payed.