Skip to content

Conversation

@rmrantunes
Copy link
Owner

@rmrantunes rmrantunes commented May 15, 2021

What if I wanted to select the friends with same age as each user? To be done, the age should be available in the scope. So my resolution was to make the second parameter accepts also a function that returns the same thing, but now, it have access to each object in the array. But you can only check the values.

const sameAgeFriends = arrayQL(users, ({ age }) => {
      return {
        keys: {
          age: true,
          friends: {
            where: (friend) => age === friend.age,
            keys: {
              age: true,
            },
          },
        },
      };
    });

@rmrantunes rmrantunes added the enhancement New feature or request label May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants