Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
angrykoala committed Feb 18, 2025
1 parent 9600435 commit da68f2b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class CountField extends AggregationField {
}

public getAggregationExpr(variable: Cypher.Variable): Cypher.Expr {
return Cypher.count(variable).distinct();
return Cypher.count(variable);
}

public getAggregationProjection(target: Cypher.Variable, returnVar: Cypher.Variable): Cypher.Clause {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ export class ConnectionReadOperation extends Operation {
}

public transpile(context: QueryASTContext): OperationTranspileResult {
const contextTarget = context.target;
if (!contextTarget) throw new Error();
if (!context.hasTarget())
throw new Error(
"Error generating query: contxt has no target in ConnectionReadOperation. This is likely a bug with the @neo4j/graphql library"
);

// eslint-disable-next-line prefer-const
let { selection: selectionClause, nestedContext } = this.selection.apply(context);
Expand Down Expand Up @@ -170,7 +172,7 @@ export class ConnectionReadOperation extends Operation {
const aggregationSubqueries = (this.aggregationField?.getSubqueries(context) ?? []).map((sq) => {
const subquery = new Cypher.Call(sq);
if (!isTopLevel) {
return subquery.importWith(contextTarget);
return subquery.importWith(context.target);
} else {
return subquery;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ query TopLevelAggregate {
}
}

query TopLevelAggregateWithMultipleFields_only {
query TopLevelAggregateWithMultipleFields {
peopleConnection {
aggregate {
count {
Expand All @@ -25,7 +25,7 @@ query TopLevelAggregateWithMultipleFields_only {
}
}

query NestedAggregation_only {
query NestedAggregation {
people {
name
moviesConnection {
Expand All @@ -40,7 +40,7 @@ query NestedAggregation_only {
}
}

query TopLevelAggregateWithMultipleFieldsDeprecated_only {
query TopLevelAggregateWithMultipleFieldsDeprecated {
peopleAggregate {
count
name {
Expand Down

0 comments on commit da68f2b

Please sign in to comment.