Class: Decidim::Core::UserEntityList

Inherits:
Object
  • Object
show all
Includes:
NeedsApiFilterAndOrder
Defined in:
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 '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
27
28
# File 'lib/decidim/api/functions/user_entity_list.rb', line 19

def call(_obj, args, ctx)
  @query = Decidim::UserBaseEntity
           .where(organization: ctx[:current_organization])
           .confirmed
           .not_blocked
           .includes(avatar_attachment: :blob)
  add_filter_keys(args[:filter])
  add_order_keys(args[:order].to_h)
  @query
end