Skip to content

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
angrykoala committed Dec 13, 2024
1 parent 08c4320 commit 8fcfe20
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/graphql/src/translate/queryAST/factory/FilterFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -580,21 +580,17 @@ export class FilterFactory {
private parseGenericOperator(key: string): FilterOperator {
// we convert them to the previous format to keep the same translation logic
switch (key) {
case "equals":
case "eq":
return "EQ";
case "in":
return "IN";
case "lessThan": // TODO: remove long syntax once tests have been updated
case "lt":
return "LT";
case "lessThanEquals":
case "lte":
return "LTE";
case "greaterThan":
case "gt":
return "GT";
case "greaterThanEquals":
case "gte":
return "GTE";
case "contains":
Expand All @@ -616,19 +612,14 @@ export class FilterFactory {
private parseGenericOperatorForAggregation(key: string): AggregationLogicalOperator {
// we convert them to the previous format to keep the same translation logic
switch (key) {
case "equals":
case "eq":
return "EQUAL";
case "lessThan": // TODO: remove long syntax once tests have been updated
case "lt":
return "LT";
case "lessThanEquals":
case "lte":
return "LTE";
case "greaterThan":
case "gt":
return "GT";
case "greaterThanEquals":
case "gte":
return "GTE";

Expand Down Expand Up @@ -870,7 +861,7 @@ export class FilterFactory {

if (!aggregationOperator) {
const filters = Object.entries(value).flatMap(([aggregationOperator, value]) => {
const parsedAggregationOperation = this.parsedGenericAggregationOperator(aggregationOperator);
const parsedAggregationOperation = this.parseGenericAggregationOperator(aggregationOperator);

// NOTE: this part is duplicate of the code used for non-generic operators
return Object.entries(value as Record<string, unknown>).map(([operator, value]) => {
Expand Down Expand Up @@ -988,7 +979,7 @@ export class FilterFactory {
return targetPoint;
}

private parsedGenericAggregationOperator(key: string): AggregationOperator {
private parseGenericAggregationOperator(key: string): AggregationOperator {
// we convert them to the previous format to keep the same translation logic
switch (key) {
case "averageLength":
Expand Down

0 comments on commit 8fcfe20

Please sign in to comment.