- return UserModel.findAndCountAll(query)
- .then(({ rows, count }) => {
- return {
- data: rows,
- total: count
- }
- })
+ return Promise.all([
+ UserModel.unscoped().count(query),
+ UserModel.scope([ 'defaultScope', ScopeNames.WITH_QUOTA ]).findAll(query)
+ ]).then(([ total, data ]) => ({ total, data }))