hedera-web/back/common/models/zone.js

34 lines
718 B
JavaScript
Raw Normal View History

2020-06-29 11:31:48 +00:00
module.exports = function (Self) {
Self.remoteMethod('getEventsForAddress', {
description: 'Returns delivery days for a postcode',
accepts: [
{
arg: 'geoFk',
type: 'Number',
description: 'The geo id'
}, {
arg: 'agencyModeFk',
type: 'Number',
description: 'The agency mode id'
}
],
returns: {
type: 'Object',
root: true
},
http: {
path: `/getEvents`,
verb: 'GET'
}
});
Self.getEvents = async(geoFk, agencyModeFk) => {
let [events, exclusions] = await Self.rawSql(
`CALL zone_getEvents(?, ?)`,
[geoFk, agencyModeFk]
);
return {events, exclusions};
};
};