1781-zoneHoliday #994

Merged
joan merged 49 commits from 1781-zoneHoliday into dev 2022-08-03 06:41:31 +00:00
5 changed files with 8 additions and 8 deletions
Showing only changes of commit 4076f2908e - Show all commits

View File

@ -17,7 +17,7 @@ module.exports = Self => {
},
{
arg: 'geoIds',
type: 'any',
type: ['number'],
vicent marked this conversation as resolved Outdated

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.

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.
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);

View File

@ -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

const geoIds = [1, 2]

const geoIds = [1, 2]
const result = await models.Zone.exclusionGeo(zoneId, today, geoIds, options);
expect(result.length).toEqual(2);

View File

@ -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

mas de lo mismo

mas de lo mismo
const result = await models.Zone.updateExclusionGeo(zoneId, geoIds, options);
expect(result.length).toEqual(2);

View File

@ -11,7 +11,7 @@ module.exports = Self => {
},
{
arg: 'geoIds',
type: 'any',
type: ['number'],
vicent marked this conversation as resolved Outdated

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);

View File

@ -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 = {