Skip to content

FE+BE product list#159

Open
lesavantdon wants to merge 16 commits into
projectshft:masterfrom
lesavantdon:master
Open

FE+BE product list#159
lesavantdon wants to merge 16 commits into
projectshft:masterfrom
lesavantdon:master

Conversation

@lesavantdon

Copy link
Copy Markdown

No description provided.

Comment thread BE/api/products/index.js
Comment on lines +6 to +10
router.get('/', productController.getAllProducts);
router.get('/:id', productController.getProductById);
router.post('/', productController.createProduct);
router.put('/:id', productController.updateProduct);
router.delete('/:id', productController.deleteProduct);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

very clear and good organization

Comment on lines +9 to +11
if (category && category !== 'all') {
query.category = category;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
if (category && category !== 'all') {
query.category = category;
}
query.category = category !== 'all' ? category : null;

Comment thread BE/models/product.js
name: { type: String, required: true },
description: { type: String, required: true },
price: { type: Number, required: true },
category: { type: String, required: true },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ideally we would want to limit categories and use an enum or some specific ones

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