I am new to sequelize. So, I am writing a query where I map the parameters and find them in the db. But all I am getting is a Promise. Here's my code
findData(params) {
return params.map(product => {
return Model.Stock.findAll({ raw: true })
.then(stocks => stocks.map(stock => ({ success: true, data: stock })))
.catch(err => ({ success: true, error: err.toString() }));
});
},
I am hoping to get objects, how do I do that?
0:Promise
_bitField:33554432
_fulfillmentHandler0:undefined
_promise0:undefined
_receiver0:undefined
_rejectionHandler0:Array(4)
_trace:CapturedTrace
__proto__:Object
length:1
__proto__:Array(0)
What should I change in order to return objects?