23 lines
576 B
JavaScript
23 lines
576 B
JavaScript
|
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;
|
||
|
};
|
||
|
};
|