Skip to content

Commit

Permalink
review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
OlenaTi committed Jan 8, 2024
1 parent 8f096ec commit b7ff8b3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/resolvers/parse/ast2cqn/where.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,13 @@ const _objectFieldTo_xpr = (objectField, columnName) => {
const ref = { ref: [columnName] }
const gqlOperator = objectField.name.value

if (gqlOperator === 'in') {
return [ref, _gqlOperatorToCdsOperator(gqlOperator), { list: objectField.value.values.map(value => ({ val: value.value })) }]
}
if (gqlOperator === 'in') {
return [
ref,
_gqlOperatorToCdsOperator(gqlOperator),
{ list: objectField.value.values.map(value => ({ val: value.value })) }
]
}
if (objectField.value.kind === Kind.LIST) {
const _xprs = objectField.value.values.map(value => _to_xpr(ref, gqlOperator, value.value))
return _joinedXprFrom_xprs(_xprs, 'and')
Expand Down
2 changes: 2 additions & 0 deletions test/schemas/edge-cases/fields-with-connection-names.gql
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ input ID_filter {
eq: ID
ge: ID
gt: ID
in: [ID]
le: ID
lt: ID
ne: [ID]
Expand All @@ -119,6 +120,7 @@ input String_filter {
eq: String
ge: String
gt: String
in: [String]
le: String
lt: String
ne: [String]
Expand Down
2 changes: 1 addition & 1 deletion test/tests/queries/filter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ describe('graphql - filter', () => {
const query = gql`
{
AdminService {
Books(filter: [{ ID: { in: [201, 251] }}, { title: { contains: "cat" } }]) {
Books(filter: [{ ID: { in: [201, 251] } }, { title: { contains: "cat" } }]) {
nodes {
ID
title
Expand Down

0 comments on commit b7ff8b3

Please sign in to comment.