class Decidim::Core::UserEntityFinder

A resolver for the GraphQL user/group endpoints Used in the keyword “user”, ie:

user(nickname: “foo”) {

name

}

Public Instance Methods

call(_obj, args, ctx) click to toggle source
# File lib/decidim/api/functions/user_entity_finder.rb, line 13
def call(_obj, args, ctx)
  filters = {
    organization: ctx[:current_organization]
  }
  args.each do |argument, value|
    next if value.blank?

    v = value.to_s
    v = v[1..-1] if value.starts_with? "@"
    filters[argument.to_sym] = v
  end
  Decidim::UserBaseEntity
    .where.not(confirmed_at: nil)
    .find_by(filters)
end