Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakfast @ Tiffany's #20

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open

Breakfast @ Tiffany's #20

wants to merge 37 commits into from

Conversation

joelamb
Copy link

@joelamb joelamb commented Oct 16, 2018

No description provided.

if (menuItems.length != 0) {
res.json(menuItems);
} else {
res.status(404).json({ error: 'Sorry, there are no items on the menu' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

const ordersKeys = Object.keys(orders.customerOrders);
const id = ordersKeys.length > 0 ? Math.max(...ordersKeys) + 1 : 1;
orders.customerOrders = Object.assign({}, orders.customerOrders, {
[id]: order
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put the id property on the order itself, so you can know the id even when order object is outside of collection

@dmitrigrabov
Copy link
Contributor

Great work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants