Changes
This commit is contained in:
parent
6ec28cbc86
commit
b87e79b9d3
|
@ -21,22 +21,13 @@ module.exports = Self => {
|
||||||
Self.deleteOrders = async(deletes, options) => {
|
Self.deleteOrders = async(deletes, options) => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
|
|
||||||
let tx;
|
|
||||||
let myOptions = {};
|
let myOptions = {};
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
try {
|
return models.Order.destroyAll({
|
||||||
const deleted = models.Order.destroyAll({
|
|
||||||
id: {inq: deletes}
|
id: {inq: deletes}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
|
||||||
return deleted;
|
|
||||||
} catch (e) {
|
|
||||||
if (tx) await tx.rollback();
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue