feat: refs #8151 moveExpeditions #3200

Merged
guillermo merged 7 commits from 8151-moveExpeditions into dev 2024-11-15 05:59:19 +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);
promises.push(expeditionUpdated);
}
await Promise.all(promises);
await models.Ticket.updateAll({id: ticket.id}, {packages: promises.length}, myOptions);
Review

no he utilizado ticket.updateAttribute porque me daba error val.slice is not a function en una linea de código de la libreria sqlstring

no he utilizado ticket.updateAttribute porque me daba `error val.slice is not a function` en una linea de código de la libreria sqlstring
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();