Skip to content

Commit

Permalink
Remove lists from aggregation filter generation
Browse files Browse the repository at this point in the history
  • Loading branch information
angrykoala committed Dec 12, 2024
1 parent 5c7ba22 commit 2533b0f
Show file tree
Hide file tree
Showing 3 changed files with 1,203 additions and 51 deletions.
5 changes: 3 additions & 2 deletions packages/graphql/src/schema/generation/aggregate-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ function makeAggregationFields(
const fields: InputTypeComposerFieldConfigMapDefinition = {};
for (const attribute of attributes) {
addAggregationFieldsByType(attribute, userDefinedDirectivesOnTargetFields?.get(attribute.name), fields);

fields[attribute.name] = getAggregationFilterFromAttributeType(attribute);
if (attribute.isAggregationWhereField()) {
fields[attribute.name] = getAggregationFilterFromAttributeType(attribute);
}
}
return fields;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,83 +31,39 @@ import { TimeScalarAggregationFilters } from "../../graphql/input-objects/generi
import type { AttributeAdapter } from "../../schema-model/attribute/model-adapters/AttributeAdapter";

export function getAggregationFilterFromAttributeType(attribute: AttributeAdapter): GraphQLInputObjectType | string {
// // NOTE: static types returned here must be added to schema-validation > validateUserDefinition
// if (attribute.typeHelper.isBoolean()) {
// if (attribute.typeHelper.isList()) {
// return BooleanListFilters;
// }
// return BooleanScalarFilters;
// }
if (attribute.typeHelper.isList()) {
throw new Error("List types not available for aggregations");
}

if (attribute.typeHelper.isID()) {
// if (attribute.typeHelper.isList()) {
// return IDListFilters;
// }
return IDScalarAggregationFilters;
}
if (attribute.typeHelper.isString()) {
// if (attribute.typeHelper.isList()) {
// return StringListFilters;
// }
return StringScalarAggregationFilters;
}
if (attribute.typeHelper.isInt()) {
// if (attribute.typeHelper.isList()) {
// return IntListFilters;
// }
return IntScalarAggregationFilters;
}
if (attribute.typeHelper.isFloat()) {
// if (attribute.typeHelper.isList()) {
// return FloatListFilters;
// }
return FloatScalarAggregationFilters;
}
if (attribute.typeHelper.isBigInt()) {
// if (attribute.typeHelper.isList()) {
// return BigIntListFilters;
// }
return BigIntScalarAggregationFilters;
}
if (attribute.typeHelper.isTime()) {
// if (attribute.typeHelper.isList()) {
// return TimeListFilters;
// }
return TimeScalarAggregationFilters;
}
// if (attribute.typeHelper.isPoint()) {
// if (attribute.typeHelper.isList()) {
// return PointListFilters;
// }
// return PointFilters;
// }
// if (attribute.typeHelper.isCartesianPoint()) {
// if (attribute.typeHelper.isList()) {
// return CartesianPointListFilters;
// }
// return CartesianPointFilters;
// }

if (attribute.typeHelper.isDateTime()) {
// if (attribute.typeHelper.isList()) {
// return DateTimeListFilters;
// }
return DateTimeScalarAggregationFilters;
}
if (attribute.typeHelper.isLocalTime()) {
// if (attribute.typeHelper.isList()) {
// return LocalTimeListFilters;
// }
return LocalTimeScalarAggregationFilters;
}
if (attribute.typeHelper.isLocalDateTime()) {
// if (attribute.typeHelper.isList()) {
// return LocalDateTimeListFilters;
// }
return LocalDateTimeScalarAggregationFilters;
}
if (attribute.typeHelper.isDuration()) {
// if (attribute.typeHelper.isList()) {
// return DurationListFilters;
// }
return DurationScalarAggregationFilters;
}
// if (attribute.typeHelper.isDate()) {
Expand Down
Loading

0 comments on commit 2533b0f

Please sign in to comment.