8144-devToTest_2448 #3216

Merged
alexm merged 256 commits from 8144-devToTest_2448 into test 2024-11-19 07:36:04 +00:00
1 changed files with 10 additions and 2 deletions
Showing only changes of commit 344427da45 - Show all commits

View File

@ -80,11 +80,19 @@ module.exports = Self => {
const expeditionUpdated = expeditionToUpdate.updateAttribute('ticketFk', ticket.id, myOptions); const expeditionUpdated = expeditionToUpdate.updateAttribute('ticketFk', ticket.id, myOptions);
promises.push(expeditionUpdated); promises.push(expeditionUpdated);
} }
await Promise.all(promises); await Promise.all(promises);
await models.Ticket.updateAll({id: ticket.id}, {packages: promises.length}, myOptions);
const state = await models.State.findOne({
where: {code: 'PACKED'}
}, myOptions);
await models.Ticket.state(ctx, {
ticketFk: ticket.id,
stateFk: state.id,
userFk: ctx.req.accessToken.userId
}, myOptions);
if (tx) await tx.commit(); if (tx) await tx.commit();
return ticket; return ticket;
} catch (e) { } catch (e) {
if (tx) await tx.rollback(); if (tx) await tx.rollback();