Skip to content

POC Add sub queries for conversation tags#51

Open
GlennGeelen wants to merge 2 commits intomasterfrom
glenn/graphql-subqueries
Open

POC Add sub queries for conversation tags#51
GlennGeelen wants to merge 2 commits intomasterfrom
glenn/graphql-subqueries

Conversation

@GlennGeelen
Copy link
Copy Markdown
Contributor

Proof of concept to add subqueries in the graphql scheme, with assoc so it doesn't do a N+1 query.

Comment thread lib/intercom_stats/repository/tags.ex Outdated
where: tag.name == ^name,
join: conversations in assoc(tag, :conversations),
preload: [conversations: conversations])
where: tag.name == ^name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can be a oneliner now

@GlennGeelen GlennGeelen force-pushed the glenn/graphql-subqueries branch from e84d61b to d983d2e Compare December 20, 2017 09:01
resolve assoc(:conversations, fn conversation_query, %{filter: %{company_name: company_name}}, _context ->
company_name = "%#{company_name}%"
conversation_query
|> where([c], like(c.company_name, ^company_name))
Copy link
Copy Markdown
Contributor

@fatboypunk fatboypunk Dec 20, 2017

Choose a reason for hiding this comment

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

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.

2 participants