salix/back/methods/user-config/getUserConfig.js

22 lines
568 B
JavaScript

module.exports = function(Self) {
Self.remoteMethodCtx('getUserConfig', {
description: 'returns the information from UserConfig model for the active user',
accepts: [],
returns: {
type: 'object',
root: true
},
http: {
path: `/getUserConfig`,
verb: 'get'
}
});
Self.getUserConfig = async ctx => {
let token = ctx.req.accessToken;
let currentUserId = token && token.userId;
return await Self.findOne({userFk: currentUserId});
};
};