From d8b5056094917003d49dcaf02d67e9d9e919c95f Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Thu, 11 Aug 2022 13:10:42 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20fixes=20host=20set=20attr?= =?UTF-8?q?ibutes=20field=20types=20(#1251)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/addon/serializers/host-set.js | 4 ++-- addons/api/mirage/factories/host-set.js | 21 ++++++++++++--------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/addons/api/addon/serializers/host-set.js b/addons/api/addon/serializers/host-set.js index b90c607bc..19994f7da 100644 --- a/addons/api/addon/serializers/host-set.js +++ b/addons/api/addon/serializers/host-set.js @@ -80,8 +80,8 @@ export default class HostSetSerializer extends ApplicationSerializer { */ normalize(typeClass, hash, ...rest) { const normalizedHash = copy(hash, true); - if (typeof normalizedHash?.filters === 'string') { - normalizedHash.filters = [normalizedHash.filters]; + if (typeof normalizedHash?.attributes?.filters === 'string') { + normalizedHash.attributes.filters = [normalizedHash.attributes.filters]; } const normalized = super.normalize(typeClass, normalizedHash, ...rest); return normalized; diff --git a/addons/api/mirage/factories/host-set.js b/addons/api/mirage/factories/host-set.js index d805d0feb..4a45a5da5 100644 --- a/addons/api/mirage/factories/host-set.js +++ b/addons/api/mirage/factories/host-set.js @@ -35,21 +35,24 @@ export default factory.extend({ return faker.datatype.number(); } }, - // AWS specific - filters() { + + attributes() { + // AWS specific if (this.plugin?.name === 'aws') { const filtersAmount = faker.datatype.number({ min: 1, max: 5 }); - let result = []; + let filters = []; for (let i = 0; i < filtersAmount; ++i) { - result.push(`${faker.datatype.string(3)}=${faker.datatype.string(8)}`); + filters.push(`${faker.datatype.string(3)}=${faker.datatype.string(8)}`); } - return result; + return { + filters, + }; } - }, - // Azure specific - filter() { + // Azure specific if (this.plugin?.name === 'azure') { - return `${faker.database.column()}=${faker.database.collation()}`; + return { + filter: `${faker.database.column()}=${faker.database.collation()}`, + }; } }, });