@speakr/speakr-module-services
Version:
SPEAKR Shared Service Module
28 lines (23 loc) • 703 B
JavaScript
;
const path = require('path');
const db = require('../../db');
module.exports = {
withNetworkId
};
function withNetworkId(options) {
let body = {};
const user_id = options.users.id;
const { network_id, title } = options.req.params;
body.network_id = network_id;
body.user_id = user_id;
body.output_file = options.media.mediaUrl;
body.input_file = options.media.keyName;
body.title = title;
return db.account_imports.create(body)
.then(account_imports => {
if(!account_imports) throw new Error('Could not create Account')
options.account_imports = account_imports;
return Promise.resolve(options)
})
.catch(err => Promise.reject(err))
}