Class: Decidim::Core::UserEntityList

Inherits:
Object
  • Object
show all
Includes:
NeedsApiFilterAndOrder
Defined in:
decidim-core/lib/decidim/api/functions/user_entity_list.rb

Overview

A resolver for the GraphQL users/groups endpoints Used in the keyword “users”, ie:

users(filter: “foo”)

name

Instance Method Summary collapse

Methods included from NeedsApiFilterAndOrder

#add_filter_keys, #add_order_keys

Constructor Details

#initializeUserEntityList

Returns a new instance of UserEntityList.


15
16
17
# File 'decidim-core/lib/decidim/api/functions/user_entity_list.rb', line 15

def initialize
  @model_class = Decidim::UserBaseEntity
end

Instance Method Details

#call(_obj, args, ctx) ⇒ Object


19
20
21
22
23
24
25
26
# File 'decidim-core/lib/decidim/api/functions/user_entity_list.rb', line 19

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