feat: refs #8151 moveExpeditions
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-11-13 13:46:40 +01:00
parent 782563f67d
commit 344427da45
1 changed files with 10 additions and 2 deletions

View File

@ -80,11 +80,19 @@ module.exports = Self => {
const expeditionUpdated = expeditionToUpdate.updateAttribute('ticketFk', ticket.id, myOptions);
promises.push(expeditionUpdated);
}
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();
return ticket;
} catch (e) {
if (tx) await tx.rollback();