-
Notifications
You must be signed in to change notification settings - Fork 206
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
Conversation
3513b68
to
4ab818f
Compare
There was a problem hiding this 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); |
There was a problem hiding this comment.
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']( |
There was a problem hiding this comment.
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']
.
Signed-off-by: Raymond Feng <[email protected]>
4ab818f
to
f68f022
Compare
There was a problem hiding this 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() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
No description provided.