brunorplima / divino-dog-menu-app

Automated menu and order app for Divino Dog
divino-dog-menu-app.vercel.app
0 stars 0 forks source link

Create "Select Option" area on menu item page #84

Closed brunorplima closed 2 years ago

brunorplima commented 2 years ago

Some items from the menu need to have options for the user to choose from to specify to the admin what he wants. For example, Refrigerante might be Coke, Sprite, Guarana etc. There is already a model in place that handles that, the MenuItemOption and the MenuItemModel is associated with it by the optionIds property.

Requirements:

ericbraz commented 2 years ago

Já estou alterando o código pra exibir essas outras opções, mas verifiquei que um dos itens tem essa propriedade. image Essa propriedade será usada?

ericbraz commented 2 years ago

English, sorry. I also realized that MenuItemOption interface had no canBeExtra property: image

But I found this property in DB: image

A few items have it

ericbraz commented 2 years ago

Since this items shall be displayed separately from other items, nor as aditions to a promo with a drink (in example) I think they don't have to be single choice.

brunorplima commented 2 years ago

Já estou alterando o código pra exibir essas outras opções, mas verifiquei que um dos itens tem essa propriedade. image Essa propriedade será usada?

No, this property was being used before but it was changed. When we need to make changes on the db structure because we don't have a MVC framework to do db migrations for us it's possible that old things like this uniqOptions might still be found in the database. You shouldn't take the database as reference, but the models instead. You will see that in the MenuItemModel this property doesn't exist, so you won't be able to use it (even if the db returns a document with this property there). The property you'll use is the optionIds if I'm no mistaken.

brunorplima commented 2 years ago

English, sorry. I also realized that MenuItemOption interface had no canBeExtra property: image

But I found this property in DB: image

A few items have it

Same as before, take the interfaces and models as reference, not what's on the database, because what is not in interfaces/models is never gonna be saved on new items anymore. It was deprecated. Likewise, if you try to use menuItemOption.canBeExtra in the code you'll see a compile error thrown by typescript, because it can't access a non-existent property of MenuItemOption.

brunorplima commented 2 years ago

Since this items shall be displayed separately from other items, nor as aditions to a promo with a drink (in example) I think they don't have to be single choice.

They have to be a single choice, because you can't buy a pop that is both a coke and a sprite. They can go with a promotion, if they want to create a combo they only need to create a new menu item with name hot dog + refrigerante, add this on the description and add options such as Coca cola, Sprite and H2O. The idea behind options is not to be an addition to an order, instead is to give further information to the admin users of what drink flavor/option that person wants, instead of just saying he wants a drink.

I agree that there is a limitation in our db structure to easily allow admin user to create combos like creating a menu item that references other menu items, but maybe that's something to worry about when they decide they want to pay us to improve that. We can talk more about this later on.