Pizza API
One-sentence description
Add the pizza module to the API (V2 I guess?)
Desired behaviour
Add functionality to the API to view products, order pizza, change order, etc. from the ThaliApp. It is probably also nice to include admin actions in the API, in case we want to perform admin actions through the app. Would be nice to implement this as soon as possible, both here and on the app side, so it can be used on one of the next drinks.
Suggestion
I've thought a bit about how to make this as RESTful as possible. Thoughts are welcome.
-
GET https://thalia.nu/api/v2/pizzas/
to view pizzas (only if there is currently a PizzaEvent or if admin) -
GET https://thalia.nu/api/v2/pizzas/event/
to view the current PizzaEvent (if there is one) -
GET https://thalia.nu/api/v2/pizzas/orders/
to view all orders for the current event (only if admin) -
GET https://thalia.nu/api/v2/pizzas/orders/[<id>|me]/
to view a specific order (only if yours or admin) -
POST https://thalia.nu/api/v2/pizzas/orders/
to create a new order (with an optional body containing a name, for adding an order for non-members) -
PUT https://thalia.nu/api/v2/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 https://thalia.nu/api/v2/pizzas/orders/[<id>|me]/
to cancel a specific order (only if yours or admin)
This is what I came up with, but maybe there is a better way?
Edited by Gijs Hendriksen