8144-devToTest_2448 #3216
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue