@speakr/speakr-module-services
Version:
SPEAKR Shared Service Module
26 lines (21 loc) • 502 B
JavaScript
;
const db = require('../../db');
module.exports = {
byAccountId
};
function byAccountId(options) {
let where = {
account_id: options.accounts.id
};
return db.accounts_stats.findOne( { where } )
.then(accounts_stats => {
if(!!accounts_stats) {
options.accounts_stats = accounts_stats;
return Promise.resolve(options);
} else {
return Promise.resolve(options);
}
}).catch(err => {
return Promise.reject(err);
});
}