23 lines
574 B
JavaScript
23 lines
574 B
JavaScript
module.exports = Self => {
|
|
Self.remoteMethodCtx('getCollection', {
|
|
description: 'Get pending collections from a worker',
|
|
accessType: 'READ',
|
|
returns: {
|
|
type: 'Object',
|
|
root: true
|
|
},
|
|
http: {
|
|
path: `/getCollection`,
|
|
verb: 'GET'
|
|
}
|
|
});
|
|
|
|
Self.getCollection = async ctx => {
|
|
const userId = ctx.req.accessToken.userId;
|
|
const query = `CALL vn.collection_get(?)`;
|
|
const [result] = await Self.rawSql(query, [userId]);
|
|
|
|
return result;
|
|
};
|
|
};
|