3888-ticket.expedition_moveExpedition #1097

Merged
vicent merged 26 commits from 3888-ticket.expedition_moveExpedition into dev 2022-11-02 13:54:11 +00:00
6 changed files with 13 additions and 9 deletions
Showing only changes of commit d4e2783630 - Show all commits

View File

@ -236,5 +236,5 @@
"Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
"Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
"This route not exists": "Esta ruta no existe"
"This route does not exists": "Esta ruta no existe"
vicent marked this conversation as resolved Outdated
Outdated
Review

This route does not exists

This route does not exists
}

View File

@ -33,9 +33,13 @@ module.exports = Self => {
}
try {
const deletedExpeditions = await models.Expedition.destroyAll({
id: {inq: expeditionIds}
}, myOptions);
const promises = [];
vicent marked this conversation as resolved Outdated
Outdated
Review

Utilizar destroyById() en un bucle. La función destroyAll() no es segura

Utilizar destroyById() en un bucle. La función destroyAll() no es segura
for (let expeditionId of expeditionIds) {
const deletedExpedition = models.Expedition.destroyById(expeditionId, myOptions);
promises.push(deletedExpedition);
}
const deletedExpeditions = await Promise.all(promises);
if (tx) await tx.commit();

View File

@ -70,12 +70,12 @@ module.exports = Self => {
try {
if (args.routeId) {
const route = await models.Route.findById(args.routeId, null, myOptions);
if (!route) throw new UserError('This route not exists');
if (!route) throw new UserError('This route does not exists');
}
const ticket = await models.Ticket.new(ctx, myOptions);
const promises = [];
for (let expeditionsId of args.expeditionIds) {
const expeditionToUpdate = await models.Expedition.findById(expeditionsId);
const expeditionToUpdate = await models.Expedition.findById(expeditionsId, null, myOptions);
vicent marked this conversation as resolved Outdated
Outdated
Review

pasar transacción null, myOptions

pasar transacción null, myOptions
const expeditionUpdated = expeditionToUpdate.updateAttribute('ticketFk', ticket.id, myOptions);
promises.push(expeditionUpdated);
}

View File

@ -10,7 +10,7 @@ describe('ticket deleteExpeditions()', () => {
const expeditionIds = [12, 13];
const result = await models.Expedition.deleteExpeditions(expeditionIds, options);
expect(result.count).toEqual(2);
expect(result.length).toEqual(2);
await tx.rollback();
} catch (e) {

View File

@ -159,7 +159,7 @@
</vn-date-picker>
<vn-textfield
ng-show="selectLanded.data == 'withRoute'"
label="Id route"
label="Route id"
ng-model="$ctrl.newRoute">
</vn-textfield>
</tpl-body>

View File

@ -3,4 +3,4 @@ Expedition removed: Expedición eliminada
Move: Mover
New ticket without route: Nuevo ticket sin ruta
New ticket with route: Nuevo ticket con ruta
Id route: Id ruta
Route id: Id ruta
vicent marked this conversation as resolved Outdated
Outdated
Review

Route id

Route id