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

34 lines
811 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'
}
});
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);
};
};