fix: 🐛 fixes host set attributes field types (#1251)

This commit is contained in:
Randall Morey authored and GitHub committed 2022-08-11 16:10:42 -04:00
1 parent bdc2238f17
commit d8b5056094
2 files changed
+14 -11

No files matched your search

+2 -2
View File
@@ -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;
+12 -9
View File
@@ -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()}`,
};
}
},
});