29 lines
677 B
JavaScript
29 lines
677 B
JavaScript
module.exports = Self => {
|
|
Self.remoteMethod('removeByDate', {
|
|
description: 'Removes one or more delivery dates for a zone',
|
|
accessType: '',
|
|
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}});
|
|
};
|
|
};
|