2019-01-21 10:45:53 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
Self.remoteMethod('removeByDate', {
|
|
|
|
description: 'Removes one or more delivery dates for a zone',
|
2019-05-22 10:35:24 +00:00
|
|
|
accessType: 'WRITE',
|
2019-01-21 10:45:53 +00:00
|
|
|
accepts: [{
|
|
|
|
arg: 'zoneFk',
|
|
|
|
type: 'Number',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
arg: 'dates',
|
|
|
|
type: ['Date'],
|
|
|
|
required: true,
|
|
|
|
}],
|
|
|
|
returns: {
|
|
|
|
type: 'object',
|
|
|
|
root: true
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: `/removeByDate`,
|
|
|
|
verb: 'POST'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Self.removeByDate = (zoneFk, dates) => {
|
|
|
|
return Self.destroyAll({zoneFk, delivered: {inq: dates}});
|
|
|
|
};
|
|
|
|
};
|