Added pizza API
Closes #490 (closed)
Short description
Introduces an API for the pizzas app.
Long description
Implements the proposal as described in #490 (closed), where the following methods are included in the API:
-
GET /api/v1/pizzas/
to view pizzas (only if there is currently a PizzaEvent or if admin) -
GET /api/v1/pizzas/event/
to view the current PizzaEvent. This returns a dictionary{'order': ..., 'event': ...}
, whereevent
is the current PizzaEvent andorder
is your current order. -
GET /api/v1/pizzas/orders/
to view all orders for the current event (only if admin. Also works for non-admins, but they only get to see their own order) -
GET /api/v1/pizzas/orders/[<id>|me]/
to view a specific order (only if yours or admin) -
POST /api/v1/pizzas/orders/
to create a new order (with an optional body containing a name, for adding an order for non-members) -
PUT /api/v1/pizzas/orders/[<id>|me]/
to edit a specific order, with a product id in the body, and (for admins) a paid field in the body (only if yours or admin) -
DELETE /api/v1/pizzas/orders/[<id>|me]/
to cancel a specific order (only if yours or admin)
Steps to use this feature
- Create a PizzaEvent instance.
- Use
POST
as described above to create an order. - Use
GET
to view your order and the event. - Use
PUT
to update your order. - Use
DELETE
to cancel your order. - Note that the features above also work for other people's orders if you are admin.