module.exports = Self => { Self.remoteMethod('getLastEntries', { description: 'Returns last entries', accessType: 'READ', accepts: [{ arg: 'filter', type: 'object', required: true, description: 'itemFk, id' }], returns: { type: 'Array', root: true }, http: { path: `/getLastEntries`, verb: 'GET' } }); Self.getLastEntries = async filter => { let query = `CALL vn.itemLastEntries(?, ?)`; let [lastEntries] = await Self.rawSql(query, [filter.itemFk, filter.date]); return lastEntries; }; };