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