remove file
This commit is contained in:
parent
cf0b6f8c6e
commit
51f9055d23
|
@ -1,49 +0,0 @@
|
|||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('deleteSaleGroupDetail', {
|
||||
description: 'Elimina los registros de saleGroupDetail',
|
||||
accessType: 'WRITE',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'saleFk',
|
||||
type: 'number',
|
||||
description: 'The sale id'
|
||||
}
|
||||
],
|
||||
returns: {
|
||||
type: ['object'],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/deleteSaleGroupDetail`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.deleteSaleGroupDetail = async(saleFk, options) => {
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
let tx;
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
try {
|
||||
const deletes = await models.SaleGroupDetail.destroyAll({
|
||||
saleFk: saleFk
|
||||
}, myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return deletes;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue