Please see my code, i am not being able to find what's wrong in the code.
async makeSale({request,response,auth,params})
{
const data=request.body.data
var total=0
_.forEach(data,(v)=>{
total+=(v.productQuantity*v.productPrice)
})
const saleData={seller_id:1, buyer_id:params.id,totalAmount:total}
const [sale,config] = await Promise.all(this.createSale(saleData),this.getsConfig())
}
and these are the two methods
createSale(s)
{
console.log('One: '+new Date().getTime())
const d=Sale.create(s)
console.log(d) // this echo promise pending
return d
}
getsConfig()
{
console.log('two: '+new Date().getTime())
const c=Config.all()
console.log(c) // this echo promise pending
return c
}
and the result in the console is
One: 1521967277914
Promise { <pending> }
two: 1521967277916
Promise { <pending> }
and the error is
"undefined is not a function", name: "TypeError", status: 500
Thank you for your time.