Skip to content
devkingdom1116 edited this page Mar 15, 2018 · 1 revision

The application will contain the following models and attributes (excluding framework/database automatically created fields id/created_at etc)

Order order_id: String serving_datetime: DateTime

OrderItem delivery_order_id: Integer meal_id: Integer quantity: Integer unit_price: Integer #in cents

Meal name: String meal_code: String byline: String

The associations are as follows, A Order has one or many OrderItems A OrderItem belongs to Order A OrderItem belongs to a Meal A Meal has many OrderItems

  • Clears the DB
  • Creates 5 delivery orders that contains 1-5 order_items (include the Meal)

Create the following JSON endpoints:

Query:

{ orders { order_id delivery_date delivery_time order_items { quantity unit_price meal { name byline meal_code } } } }

Example response: { orders: [ { "order_id": "GO123", "delivery_date": "2017-10-20", "delivery_time": "11:00–11:30AM" "order_items": [ { "name": "Buffalo Chicken on Sweet Potato Mash and Celery Confit ", "quantity": 2, "total_price": 2390 } ] } ] }

Clone this wiki locally