salix/back/methods/collection/getCollection.js

23 lines
574 B
JavaScript
Raw Normal View History

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