pull request changed
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
c1edb8206e
commit
0ec51202e0
|
@ -1,6 +1,6 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('deleteSalesClaimed', {
|
||||
description: 'Deletes the selected sales',
|
||||
Self.remoteMethodCtx('deleteClamedSales', {
|
||||
description: 'Deletes the claimed sales',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'sales',
|
||||
|
@ -13,12 +13,12 @@ module.exports = Self => {
|
|||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/deleteSalesClaimed`,
|
||||
path: `/deleteClamedSales`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.deleteSalesClaimed = async(ctx, sales, options) => {
|
||||
Self.deleteClamedSales = async(ctx, sales, options) => {
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
const tx = await Self.beginTransaction({});
|
|
@ -35,14 +35,18 @@ module.exports = Self => {
|
|||
|
||||
try {
|
||||
const models = Self.app.models;
|
||||
const promises = [];
|
||||
for (let row of rows) {
|
||||
const claimEnd = await models.ClaimEnd.findById(row.id, null, myOptions);
|
||||
await claimEnd.updateAttribute('claimDestinationFk', claimDestinationFk, myOptions);
|
||||
const updatedClaimEnd = claimEnd.updateAttribute('claimDestinationFk', claimDestinationFk, myOptions);
|
||||
promises.push(updatedClaimEnd);
|
||||
}
|
||||
|
||||
const updatedSales = await Promise.all(promises);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return {};
|
||||
return updatedSales;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/claim-end/filter')(Self);
|
||||
require('../methods/claim-end/deleteSalesClaimed')(Self);
|
||||
require('../methods/claim-end/deleteClamedSales')(Self);
|
||||
};
|
||||
|
|
|
@ -93,7 +93,7 @@ export default class Controller extends Section {
|
|||
|
||||
removeSales(saleClaimed) {
|
||||
const params = {sales: [saleClaimed]};
|
||||
this.$http.post(`ClaimEnds/deleteSalesClaimed`, params).then(() => {
|
||||
this.$http.post(`ClaimEnds/deleteClamedSales`, params).then(() => {
|
||||
this.$.model.refresh();
|
||||
this.vnApp.showSuccess(this.$t('Data saved!'));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue