salix/back/methods/collection/collectionGet.js

23 lines
576 B
JavaScript
Raw Normal View History

2020-03-23 07:24:57 +00:00
module.exports = Self => {
Self.remoteMethodCtx('collectionGet', {
description: 'Get pending collections from a worker',
accessType: 'WRITE',
returns: {
type: 'Object',
root: true
},
http: {
path: `/collectionGet`,
verb: 'POST'
}
});
Self.collectionGet = async ctx => {
const userId = ctx.req.accessToken.userId;
const query = `CALL vn.collection_get(?)`;
const [result] = await Self.rawSql(query, [userId]);
return result;
};
};