Skip to content

Commit

Permalink
Also join o2m relations when not in subquery but at non-root level (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnboland authored Apr 28, 2021
1 parent a64a5a1 commit d9baa0b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/src/utils/apply-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ export function applyFilter(
);
}

if (subQuery === true && isM2O === false) {
// Still join o2m relations when in subquery OR when the o2m relation is not at the root level
if ((subQuery === true || parentAlias !== undefined) && isM2O === false) {
dbQuery.leftJoin(
{ [alias]: relation.many_collection },
`${parentAlias || parentCollection}.${relation.one_primary}`,
Expand Down

0 comments on commit d9baa0b

Please sign in to comment.