controllers/OrderController.js
// Waktu create Order -> chaining check stock & update si stock (pakai Hook: beforeUpdate), Product create Order, create OrderProduct, 
Waktu create Order -> chaining check stock & update si stock (pakai Hook: beforeUpdate), Product create Order, create OrderProduct.
Waktu create Order - > chaining check stock & update si stock ( pakai Hook : beforeUpdate ) Product create Order create OrderProduct .
static showOrderForm(req, res) {
    const promises = [User.findOne({
      where: {
        email: req.session.email
      }
    }), Product.findAll()]
    Promise.all(promises)
      .then((result) => {
        res.render('createOrder', { UserId: result[0].id, products: result[1] })
      }).catch((err) => {
        res.send(err)
      })
  }
static showOrderForm ( req , res ) { const promises = [ User . findOne ( { where : { email : req . session . email } } ) , Product . findAll ( ) ] Promise . all ( promises ) . then ( ( result ) => { res . render ( 'createOrder' , { UserId : result [ 0 ] . id , products : result [ 1 ] } ) } ) . catch ( ( err ) => { res . send ( err ) } ) }
Waktu create Order -> chaining check stock & update si stock (pakai Hook: beforeUpdate), Product create Order, create OrderProduct,
Waktu create Order - > chaining check stock & update si stock ( pakai Hook : beforeUpdate ) Product create Order create OrderProduct
// res.send(result)