module.exports = Self => { Self.remoteMethod('listByBrowser', { description: 'Get the list of visits grouped by browser', accessType: 'READ', accepts: [ { arg: 'from', type: 'Date', description: 'The from date' }, { arg: 'to', type: 'Date', description: 'The to date' } ], returns: { type: ['Object'], description: 'The visits list', root: true, }, http: { path: `/listByBrowser`, verb: 'GET' } }); Self.listByBrowser = (from, to, cb) => { Self.dataSource.connector.query( `CALL hedera.visit_listByBrowser(?, ?)`, [from, to], (err, res) => { if (err) return cb(err) return cb(null, res[0]) } ); }; };