refactor: corregidas traducciones, eliminado destroyAll y añadida transacción
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-10-26 08:39:07 +02:00
parent 1e1d4f00f1
commit d4e2783630
6 changed files with 13 additions and 9 deletions

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"
}

View File

@ -33,9 +33,13 @@ module.exports = Self => {
}
try {
const deletedExpeditions = await models.Expedition.destroyAll({
id: {inq: expeditionIds}
}, myOptions);
const promises = [];
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);
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