Class: CommandTower::AdminService::Users

Inherits:
ServiceBase show all
Includes:
PaginationServiceHelper
Defined in:
app/services/command_tower/admin_service/users.rb

Constant Summary

Constants inherited from ServiceBase

ServiceBase::ON_ARGUMENT_VALIDATION

Instance Method Summary collapse

Methods included from PaginationServiceHelper

#pagination_cursor, #pagination_limit, #pagination_page, #pagination_params, #pagination_schema, #query

Methods inherited from ServiceBase

inherited, #internal_validate, #service_base_logging, #validate!

Methods included from CommandTower::ArgumentValidation

included

Methods included from ServiceLogging

#aletered_message, #class_name, #log, #log_error, #log_info, #log_prefix, #log_warn, #logger, #service_id

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
# File 'app/services/command_tower/admin_service/users.rb', line 13

def call
  schemafied_users = query.map { CommandTower::Schema::User.convert_user_object(user: _1) }
  context.schema = CommandTower::Schema::Admin::Users.new(
    users: schemafied_users,
    count: schemafied_users.count,
    pagination: pagination_schema,
  )
end

#default_queryObject



22
23
24
# File 'app/services/command_tower/admin_service/users.rb', line 22

def default_query
  ::User.all.select(*CommandTower.config.user.default_attributes)
end