2018-10-05 11:01:46 +00:00
|
|
|
module.exports = function(Self) {
|
|
|
|
Self.remoteMethodCtx('setUserConfig', {
|
|
|
|
description: 'Change worker of tickets state',
|
|
|
|
accepts: [{
|
|
|
|
arg: 'params',
|
|
|
|
type: 'object',
|
|
|
|
required: true,
|
|
|
|
description: 'warehouseFk, companyFk',
|
|
|
|
http: {source: 'body'}
|
|
|
|
}],
|
|
|
|
returns: {
|
|
|
|
arg: 'response',
|
|
|
|
type: 'object'
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: `/setUserConfig`,
|
|
|
|
verb: 'post'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Self.setUserConfig = async(ctx, params) => {
|
|
|
|
let token = ctx.req.accessToken;
|
|
|
|
let currentUserId = token && token.userId;
|
|
|
|
params.userFk = currentUserId;
|
|
|
|
|
|
|
|
return await Self.app.models.UserConfig.upsertWithWhere({userFk: currentUserId}, params);
|
2019-01-24 14:50:21 +00:00
|
|
|
};
|
2018-10-05 11:01:46 +00:00
|
|
|
};
|