39 lines
971 B
JavaScript
39 lines
971 B
JavaScript
|
|
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])
|
|
}
|
|
);
|
|
};
|
|
};
|