Lighthouse: Issue to make complex @whereConditions (AND, OR)

Created on 30 Mar 2020  路  3Comments  路  Source: nuwave/lighthouse

When I try to replicate some @whereConditions from the docs to group AND/OR clauses, I see a strange behaviour on the output SQL.

Using a where conditions like below:

where: {
        AND: [
          { column: STATUS, operator: EQ, value: "Active" }
          {
            OR: [
              { column: CITY, operator: EQ, value: "New York" }
              { column: CITY, operator: EQ, value: "Miami" }
            ]
          }
        ]
    }

I get the following buggy SQL:

where (`status` = 'Active' or (`city` = 'New York' or `city` = 'Miami'))

But the expected output should be:

where (`status` = 'Active' and (`city` = 'New York' or `city` = 'Miami'))

Environment

Lighthouse Version: 4.10.2
Laravel Version: 5.8.30

bug

All 3 comments

Yes, sure. I'll try to provide a test case this week. Thanks for pointing out the test file.

Was this page helpful?
0 / 5 - 0 ratings