module.exports = Self => { Self.remoteMethod('getDiary', { description: 'Returns the ', accessType: 'READ', accepts: [{ arg: 'filter', type: 'Object', required: true, description: 'Filter defining where and paginated data', http: {source: 'query'} }], returns: { type: ['Object'], root: true }, http: { path: `/getDiary`, verb: 'GET' } }); Self.getDiary = async filter => { let where = filter.where; let [diary] = await Self.rawSql(`CALL vn.itemDiary(?, ?)`, [where.itemFk, where.warehouseFk]); return diary; }; };