Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lucas-Barret/cb18f8330eab2d08675c987260854c56 to your computer and use it in GitHub Desktop.
Save Lucas-Barret/cb18f8330eab2d08675c987260854c56 to your computer and use it in GitHub Desktop.
module Queries
<% if @nested_modules.first.present? %>module <%= @nested_modules.first.camelize %>
<% if @nested_modules.second.present? %>module <%= @nested_modules.second.camelize %>
class <%= class_name%>Query<% @arguments&.each do |arg| %>
argument :<%=arg.split(':').first%>, <%=arg.split(':').second%><% if arg.split(':').second != arg.split(':').last %>, required: true<%end%><%end%>
<%if @type.present? %>type Types::<%=@nested_modules.first.camelize%>::<%=@nested_modules.second.camelize%>::<%=@type.split(':').first.camelize%>Type<%if @type.split(':').second != @type.split(':').first%>, null: true<%end%>
<% else %>type Types::<%=@nested_modules.first.camelize%>::<%=@nested_modules.second.camelize%>::<%= class_name%>
<%end%>
def resolve
end
end
end<% else %>class <%= class_name%>Query<% @arguments.each do |arg| %>
argument :<%=arg.split(':').first%>, <%=arg.split(':').second%><% if arg.split(':').second != arg.split(':').last %>, required: true<%end%><%end%>
type Types::<%=@nested_modules.first.camelize%>::<%=@type.split(':').first%>Type<%if @type.split(':').second != @type.split(':').first%><%=@type.split(':').second%>, null: true<%end%>
def resolve
end
end<%end%>
end<%end%>
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment