salix/modules/monitor/back/methods/sales-monitor/deleteOrders.js

34 lines
816 B
JavaScript
Raw Normal View History

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'
}
});
2021-08-12 07:23:19 +00:00
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);
};
};