2021-02-26 08:08:31 +00:00
|
|
|
module.exports = function(Self) {
|
|
|
|
Self.remoteMethodCtx('getStarredModules', {
|
|
|
|
description: 'returns the receved modules adding the starred property.',
|
|
|
|
returns: {
|
|
|
|
type: 'object',
|
|
|
|
root: true
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: `/getStarredModules`,
|
|
|
|
verb: 'get'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Self.getStarredModules = async ctx => {
|
2021-03-01 11:15:13 +00:00
|
|
|
const userId = ctx.req.accessToken.userId;
|
|
|
|
const filter = {
|
|
|
|
where: {
|
|
|
|
workerFk: userId
|
|
|
|
},
|
|
|
|
fields: ['moduleFk']
|
|
|
|
};
|
|
|
|
|
|
|
|
const starredModules = await Self.app.models.StarredModule.find(filter);
|
|
|
|
|
|
|
|
return starredModules;
|
2021-02-26 08:08:31 +00:00
|
|
|
};
|
|
|
|
};
|