- return VideoPlaylistElementModel
- .findAndCountAll(query)
- .then(({ rows, count }) => {
- return { total: count, data: rows.map(e => e.url) }
- })
+ return Promise.all([
+ VideoPlaylistElementModel.count(getQuery(true)),
+ VideoPlaylistElementModel.findAll(getQuery(false))
+ ]).then(([ total, rows ]) => ({
+ total,
+ data: rows.map(e => e.url)
+ }))