1781-zoneHoliday #994
|
@ -17,7 +17,7 @@ module.exports = Self => {
|
|||
},
|
||||
{
|
||||
arg: 'geoIds',
|
||||
type: 'any',
|
||||
type: ['number'],
|
||||
vicent marked this conversation as resolved
Outdated
|
||||
description: 'The geos id'
|
||||
}
|
||||
|
||||
|
@ -48,10 +48,10 @@ module.exports = Self => {
|
|||
|
||||
const promises = [];
|
||||
|
||||
for (let geoId of geoIds) {
|
||||
for (const geoId of geoIds) {
|
||||
const newZoneExclusionGeo = await models.ZoneExclusionGeo.create({
|
||||
zoneExclusionFk: newZoneExclusion.id,
|
||||
geoFk: geoId.id
|
||||
geoFk: geoId
|
||||
}, myOptions);
|
||||
|
||||
promises.push(newZoneExclusionGeo);
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('zone exclusionGeo()', () => {
|
|||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const geoIds = [{id: 1}, {id: 2}];
|
||||
const geoIds = [1, 2];
|
||||
vicent marked this conversation as resolved
Outdated
carlosjr
commented
const geoIds = [1, 2] const geoIds = [1, 2]
|
||||
const result = await models.Zone.exclusionGeo(zoneId, today, geoIds, options);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('zone updateExclusionGeo()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
const zoneId = 2;
|
||||
const geoIds = [{id: 1}, {id: 2}];
|
||||
const geoIds = [1, 2];
|
||||
vicent marked this conversation as resolved
Outdated
carlosjr
commented
mas de lo mismo mas de lo mismo
|
||||
const result = await models.Zone.updateExclusionGeo(zoneId, geoIds, options);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports = Self => {
|
|||
},
|
||||
{
|
||||
arg: 'geoIds',
|
||||
type: 'any',
|
||||
type: ['number'],
|
||||
vicent marked this conversation as resolved
Outdated
carlosjr
commented
mala practica mala practica
|
||||
description: 'The geos id'
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ module.exports = Self => {
|
|||
for (const geoId of geoIds) {
|
||||
const params = {
|
||||
zoneExclusionFk: zoneExclusionFk,
|
||||
geoFk: geoId.id
|
||||
geoFk: geoId
|
||||
};
|
||||
const deletedZoneExclusionGeos = models.ZoneExclusionGeo.create(params, myOptions);
|
||||
promises.push(deletedZoneExclusionGeos);
|
||||
|
|
|
@ -215,7 +215,7 @@ class Controller extends Section {
|
|||
const excludeSelected = this.excludeSelected;
|
||||
let req;
|
||||
const geoIds = [];
|
||||
this.exclusionGeos.forEach(id => geoIds.push({id}));
|
||||
this.exclusionGeos.forEach(id => geoIds.push(id));
|
||||
|
||||
if (this.isNew) {
|
||||
const params = {
|
||||
|
|
Loading…
Reference in New Issue
geoIds a mi entender son Identificadores de geo por ejemplo: [1, 2, 3, 4]
pero poner un nombre que reprensentaria una coleccion de ids y darle de tipo "any" no es buena practica resultando en un manejo de datos confuso.
refactoriza los argumentos para que reciba lo que necesita que aparentemente son ids a secas en una array.