May 2018
Intermediate to advanced
470 pages
13h 54m
English
When a product's status is changed to any value other than Processing and Cancelled, a PUT request to '/api/order/status/:shopId' will directly update the order in the database given the current user is the verified owner of the shop with the ordered product.
mern-marketplace/server/routes/order.routes.js:
router.route('/api/order/status/:shopId') .put(authCtrl.requireSignin, shopCtrl.isOwner, orderCtrl.update)
The update controller method will query the Order collection and find the order with the CartItem object that matches the updated product, and set the status value of this matched CartItem in the products array of the order.
mern-marketplace/server/controllers/order.controller.js:
const update = (req, res) => { ...Read now
Unlock full access