Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregation filters #5879

Merged
merged 6 commits into from
Dec 13, 2024
Merged

Aggregation filters #5879

merged 6 commits into from
Dec 13, 2024

Conversation

angrykoala
Copy link
Member

Description

Add generic filters for aggregations:

{
    posts(where: { likesAggregate: { node: { rating: { average: { eq: 3.2 } } } } }) {
        title
    }
}

Copy link

changeset-bot bot commented Dec 12, 2024

🦋 Changeset detected

Latest commit: 8fcfe20

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@neo4j/graphql Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@MacondoExpress MacondoExpress left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments but apart of that it looks great!

case "equals":
case "eq":
return "EQUAL";
case "lessThan": // TODO: remove long syntax once tests have been updated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has already been removed!

@@ -608,6 +613,29 @@ export class FilterFactory {
throw new Error(`Invalid operator ${key}`);
}
}
private parseGenericOperatorForAggregation(key: string): AggregationLogicalOperator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we can reuse parseGenericOperator!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not the same filters, even if they have the same name, the typings are defined to use one or the other, and I rather keep the nice typings

@@ -919,4 +987,27 @@ export class FilterFactory {
}
return targetPoint;
}

private parsedGenericAggregationOperator(key: string): AggregationOperator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private parsedGenericAggregationOperator(key: string): AggregationOperator {
private parseGenericAggregationOperator(key: string): AggregationOperator {

@angrykoala angrykoala merged commit 968a4d8 into generic-scalar-filters Dec 13, 2024
0 of 2 checks passed
@angrykoala angrykoala deleted the aggregation-filters branch December 13, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants