Sha256: aee13060f12aa5ba6eefab179be78180c8bd6dad3b37ccaf818da3b59c1cb5aa

Contents?: true

Size: 889 Bytes

Versions: 9

Compression:

Stored size: 889 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Core
    # A resolver for the GraphQL users/groups endpoints
    # Used in the keyword "users", ie:
    #
    # users(filter: {nickname: "foo"}) {
    #   name
    # }
    #
    class UserEntityList < GraphQL::Function
      include NeedsApiFilterAndOrder
      argument :order, UserEntityInputSort, "Provides several methods to order the results"
      argument :filter, UserEntityInputFilter, "Provides several methods to filter the results"

      def initialize
        @model_class = Decidim::UserBaseEntity
      end

      def call(_obj, args, ctx)
        @query = Decidim::UserBaseEntity
                 .where(organization: ctx[:current_organization])
                 .where.not(confirmed_at: nil)
        add_filter_keys(args[:filter])
        add_order_keys(args[:order].to_h)
        @query
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-core-0.23.6 app/functions/decidim/core/user_entity_list.rb
decidim-core-0.23.5 app/functions/decidim/core/user_entity_list.rb
decidim-core-0.23.4 app/functions/decidim/core/user_entity_list.rb
decidim-core-0.23.3 app/functions/decidim/core/user_entity_list.rb
decidim-core-0.23.2 app/functions/decidim/core/user_entity_list.rb
decidim-core-0.23.1 app/functions/decidim/core/user_entity_list.rb
decidim-core-0.23.1.rc1 app/functions/decidim/core/user_entity_list.rb
decidim-core-0.23.0 app/functions/decidim/core/user_entity_list.rb
decidim-core-0.22.0 app/functions/decidim/core/user_entity_list.rb