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

feat: add shopping-cart controller #11

Merged
merged 1 commit into from
Sep 14, 2018
Merged

feat: add shopping-cart controller #11

merged 1 commit into from
Sep 14, 2018

Conversation

raymondfeng
Copy link
Contributor

No description provided.

@raymondfeng
Copy link
Contributor Author

Fixes loopbackio/loopback-next#1481

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

LGTM. Please get at least one more person to review these changes before landing.

@param.path.string('userId') userId: string,
@requestBody({description: 'shopping cart'}) cart: ShoppingCart,
) {
console.log('Shopping cart received', cart);
Copy link
Member

Choose a reason for hiding this comment

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

Forgotten console.log statement?

) {
console.log('Shopping cart received', cart);
if (userId !== cart.userId) {
throw new HttpErrors['400'](
Copy link
Member

Choose a reason for hiding this comment

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

We usually use HttpErrors.BadRequest instead of HttErrors['400'].

Copy link
Contributor

@virkt25 virkt25 left a comment

Choose a reason for hiding this comment

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

LGTM, just a question.

@@ -8,18 +8,22 @@ import {Entity, model, property} from '@loopback/repository';
/**
* Item in a shopping cart
*/
@model()
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to make this a model so this is registered with the openapi spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's what leads to loopbackio/loopback-next#1710 too.

@raymondfeng raymondfeng merged commit 6fda110 into master Sep 14, 2018
@raymondfeng raymondfeng deleted the cart-controller branch September 14, 2018 16:46
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.

3 participants