Skip to content

Commit

Permalink
Add table prefix to groupBy query (#10250)
Browse files Browse the repository at this point in the history
Fixes #10092
  • Loading branch information
rijkvanzanten committed Dec 3, 2021
1 parent 57bddf9 commit a77f08b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/src/utils/apply-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function applyQuery(
}

if (query.group) {
dbQuery.groupBy(query.group.map(applyFunctionToColumnName));
dbQuery.groupBy(`${collection}.${query.group.map(applyFunctionToColumnName)}`);
}

if (query.aggregate) {
Expand Down
4 changes: 2 additions & 2 deletions api/src/utils/sanitize-query.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { flatten, get, merge, set } from 'lodash';
import { flatten, get, isPlainObject, merge, set } from 'lodash';
import logger from '../logger';
import { Meta } from '../types';
import { Query, Aggregate, Filter } from '@directus/shared/types';
Expand Down Expand Up @@ -184,7 +184,7 @@ function sanitizeDeep(deep: Record<string, any>, accountability?: Accountability
// way of knowing when to keep nesting and when to stop
const [parsedKey, parsedValue] = Object.entries(parsedSubQuery)[0];
parsedLevel[`_${parsedKey}`] = parsedValue;
} else {
} else if (isPlainObject(value)) {
parse(value, [...path, key]);
}
}
Expand Down

0 comments on commit a77f08b

Please sign in to comment.