mohamedtosman / pizza-shop

0 stars 0 forks source link

Custom pizza #1

Open atymoshchuk opened 4 years ago

atymoshchuk commented 4 years ago

Hi Mohamed, Thanks for taking this challenge ;-) How would you deal with customers, who would like to create their own pizza: base dough plus their favourite ingredients. And the second question, what if customer would like to add some extras? For example, I would like to get extra cheese in all pizzas in my order and extra tomatoes in one of the pizzas.

mohamedtosman commented 4 years ago

Hi Anastasiia,

For the first question, actually maybe it would make more sense to have the base, dough, and extra ingredients added for all pizzas. Without totally redesigning my whole application, for example, when creating a new order, add a new value for "Base" (enum values for the base e.g Tomato or BBQ), "Dough", (enum values for the dough e.g Thin or Thick), "Extra" (string where user would enter their extra ingredients they would like to add on top of their chosen pizza). And add another option for pizza selection would be "Create your own pizza" instead of just selecting "Cheese" or "Ham".

For the second question, a simple solution would be to add an extras string field in the order object where users can enter their extra specifications like you mentioned extra cheese or whatsoever.

A more complex solution would be to have a "Topping" field where a user would enter for example "Cheese" and then "Amount" would either be "Light", "Regular" or "Extra". The "Amount" would have to be specified for each extra topping entered. If not specified, then "Regular" would be used.

For example:

"pizzas": [{ "id": "6cf64e9a-9871-412a-ab4d-173a92af270f", "details": [{ "size": "Small", "count": 1, "extras": "extra cheese" }

These are just some ideas. Might not be the best solution but would love to bounce ideas of each other.

Cheers, Mohamed