refactor: change type of params in endpoints
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Vicent Llopis 2022-07-22 13:35:18 +02:00
parent b886a7e0da
commit 4076f2908e
5 changed files with 8 additions and 8 deletions

View File

@ -17,7 +17,7 @@ module.exports = Self => {
},
{
arg: 'geoIds',
type: 'any',
type: ['number'],
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];
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];
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'],
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 = {