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
4 changed files with 10 additions and 9 deletions
Showing only changes of commit 5fce93abd5 - Show all commits

View File

@ -4,7 +4,7 @@ module.exports = Self => {
description: 'Delete the selected expeditions',
accessType: 'WRITE',
accepts: [{
arg: 'expeditionsIds',
arg: 'expeditionIds',
type: ['number'],
required: true,
description: 'The expeditions ids to delete'
@ -19,7 +19,7 @@ module.exports = Self => {
}
});
Self.deleteExpeditions = async(expeditionsIds, options) => {
Self.deleteExpeditions = async(expeditionIds, options) => {
const models = Self.app.models;
const myOptions = {};
let tx;
@ -34,7 +34,7 @@ module.exports = Self => {
try {
const deletedExpeditions = await models.Expedition.destroyAll({
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
id: {inq: expeditionsIds}
id: {inq: expeditionIds}
}, myOptions);
if (tx) await tx.commit();

View File

@ -4,7 +4,7 @@ module.exports = Self => {
description: 'Move the selected expeditions to another ticket',
accessType: 'WRITE',
accepts: [{
arg: 'expeditionsIds',
arg: 'expeditionIds',
type: ['number'],
required: true,
description: 'The expeditions ids to nove'
@ -25,7 +25,7 @@ module.exports = Self => {
}
});
Self.moveExpeditions = async(expeditionsIds, ticketId, options) => {
Self.moveExpeditions = async(expeditionIds, ticketId, options) => {
const models = Self.app.models;
const myOptions = {};
let tx;
@ -40,7 +40,7 @@ module.exports = Self => {
try {
const promises = [];
for (let expeditionsId of expeditionsIds) {
for (let expeditionsId of expeditionIds) {
const expeditionToUpdate = await models.Expedition.findById(expeditionsId);
const expeditionUpdated = expeditionToUpdate.updateAttribute('ticketFk', ticketId, myOptions);
promises.push(expeditionUpdated);

View File

@ -63,7 +63,7 @@ describe('Ticket', () => {
it('should make a query and then call to the model refresh() method', () => {
jest.spyOn($scope.model, 'refresh');
const expectedParams = {expeditionsIds: [1, 2]};
const expectedParams = {expeditionIds: [1, 2]};
$httpBackend.expect('POST', 'Expeditions/deleteExpeditions', expectedParams).respond(200);
controller.onRemove();
$httpBackend.flush();
@ -97,7 +97,7 @@ describe('Ticket', () => {
const expectedResponse = {id: ticketIdToTransfer};
const expectedParams = {
expeditionsIds: [1, 2],
expeditionIds: [1, 2],
ticketId: 28
};
$httpBackend.expect('POST', 'Tickets/new', expectedTicket).respond(expectedResponse);

View File

@ -2,4 +2,5 @@ Status log: Hitorial de estados
Expedition removed: Expedición eliminada
Move: Mover
New ticket without route: Nuevo ticket sin ruta
New ticket with route: Nuevo ticket con ruta
New ticket with route: Nuevo ticket con ruta
Id route: Id ruta
vicent marked this conversation as resolved Outdated
Outdated
Review

Route id

Route id