Skip to content

Conditionally inner join user table if creator is present in query#32

Open
Devorein wants to merge 1 commit intobenawad:masterfrom
Devorein:creator-inner-join
Open

Conditionally inner join user table if creator is present in query#32
Devorein wants to merge 1 commit intobenawad:masterfrom
Devorein:creator-inner-join

Conversation

@Devorein
Copy link
Copy Markdown

This PR uses issue #29 to utilize limit instead of take and conditionally inner joins the user table if the query contains the creator field, using an util method.

Copy link
Copy Markdown

@aseerkt aseerkt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix indentation for better git diff

let parent = info.operation.selectionSet;
for (let index = 0; index < fields.length; index++) {
const field = fields[index];
const selectionNode = parent.selections.find(selection=>(selection as any).name.value === field) ?? false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work with using Fragments as the name.value will resolve as the Fragment name, i.e PostSnippet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants