2021-05-18 06:41:36 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
Self.remoteMethod('deleteOrders', {
|
|
|
|
description: 'Deletes the selected orders',
|
|
|
|
accessType: 'WRITE',
|
|
|
|
accepts: [{
|
|
|
|
arg: 'deletes',
|
|
|
|
type: ['number'],
|
|
|
|
required: true,
|
|
|
|
description: 'The order ids to delete'
|
|
|
|
}],
|
|
|
|
returns: {
|
|
|
|
type: ['object'],
|
|
|
|
root: true
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: `/deleteOrders`,
|
|
|
|
verb: 'POST'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
Self.deleteOrders = async(deletes, options) => {
|
|
|
|
const models = Self.app.models;
|
|
|
|
|
|
|
|
let myOptions = {};
|
|
|
|
|
|
|
|
if (typeof options == 'object')
|
|
|
|
Object.assign(myOptions, options);
|
|
|
|
|
2021-05-18 08:05:13 +00:00
|
|
|
return models.Order.destroyAll({
|
|
|
|
id: {inq: deletes}
|
|
|
|
}, myOptions);
|
2021-05-18 06:41:36 +00:00
|
|
|
};
|
|
|
|
};
|