April 2020
Intermediate to advanced
716 pages
18h 55m
English
When a product's status is changed to any value other than Processing or Cancelled, a PUT request to '/api/order/status/:shopId' will directly update the order in the database, given that the current user is the verified owner of the shop with the ordered product. We will declare the route for this update API like so.
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. The update controller method ...
Read now
Unlock full access