INNER CODE UNIT · JavaScript
editAccount
shadowsocks/shadowsocks-manager · plugins/account/index.js:186
const editAccount = async (id, options) => {
const account = await knex('account_plugin').where({ id }).then(success => {
if(success.length) {
return success[0];
}
return Promise.reject('account not found');
});
const update = {};
if(options.hasOwnProperty('active')) { update.active = options.active; }
update.type = options.type;
update.orderId = options.orderId;
update.userId = options.userId;
update.autoRemove = options.autoRemove;
update.autoRemoveDelay = options.autoRemoveDelay;
update.multiServerFlow = options.multiServerFlow;
if(options.hasOwnProperty('server')) {
update.server = options.server ? JSON.stringify(options.server) : null;
}