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

21 lines
541 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 => {
return await Self.app.models.UserConfig.findOne({
where: {userFk: ctx.req.accessToken.userId}
});
};
};