Sha256: 181c7c725bac7ec6500095a6859e10543cf9d8b7440d804f637fb8a9226c34ef

Contents?: true

Size: 611 Bytes

Versions: 6

Compression:

Stored size: 611 Bytes

Contents

module Queries
  class <%= @model_name.titleize %> < Queries::BaseQuery
    description "Fetch all or specific <%= @model_name.titleize %> detail"

    type Types::Objects::<%= @model_name.titleize %>ListType, null: true

    argument :paging, Types::Inputs::Base::Paging, required: false
    argument :sort, Types::Inputs::Base::Sort, required: false

    def resolve(paging: nil, filters: nil, sort: nil)
      raise Unauthorized, I18n.t("graphql.unauthorized") if (filters && filters.my) && Current.user.nil?
      ::<%= @model_name.titleize %>.all.list(paging&.per_page, paging&.page_no)
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cm-graphql-0.0.7 lib/generators/cm_graphql/templates/query_type.rb
cm-graphql-0.0.6 lib/generators/cm_graphql/templates/query_type.rb
cm-graphql-0.0.5 lib/generators/cm_graphql/templates/query_type.rb
cm-graphql-0.0.3 lib/generators/cm_graphql/templates/query_type.rb
cm-graphql-0.0.2 lib/generators/cm_graphql/templates/query_type.rb
cm-graphql-0.0.1 lib/generators/cm_graphql/templates/query_type.rb