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

34 lines
718 B
JavaScript

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};
};
};