fix(deletExpeditions): merge test → dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-07-22 12:49:50 +02:00
parent b9c57c2f0e
commit 513b4583b3
1 changed files with 2 additions and 9 deletions

View File

@ -40,8 +40,6 @@ module.exports = Self => {
});
const {code} = expedition.agencyMode();
let isDeleted = true;
if (code?.toLowerCase()?.includes('mrw') && expedition.externalId) {
const result = await models.MrwConfig.cancelShipment(expeditionId);
if (!result) throw new Error('not deleted');
@ -52,14 +50,9 @@ module.exports = Self => {
if (result !== 'true') throw new Error('not deleted');
}
if (!isDeleted)
notDeletedExpeditions.push(expeditionId);
else {
const deletedExpedition = await models.Expedition.destroyById(expeditionId);
deletedExpeditions.push(deletedExpedition);
}
} catch (e) {
console.log('e: ', e);
notDeletedExpeditions.push(expeditionId);
}
}