Module: Hyrax::Works::ManagedWorksService

Defined in:
app/services/hyrax/works/managed_works_service.rb

Class Method Summary collapse

Class Method Details

.managed_works_count(scope:) ⇒ Array<SolrDocument>

Count of works the current user can manage.

Parameters:

  • scope (Object)

    Typically a controller object that responds to ‘repository`, `can?`, `blacklight_config`, `current_ability`

Returns:



11
12
13
14
15
16
# File 'app/services/hyrax/works/managed_works_service.rb', line 11

def self.managed_works_count(scope:)
  response, _docs = search_service(scope).search_results do |builder|
    builder.rows(0)
  end
  response.response["numFound"]
end

.search_service(scope) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'app/services/hyrax/works/managed_works_service.rb', line 18

def self.search_service(scope)
  Hyrax::SearchService.new(
    config: scope.blacklight_config,
    user_params: scope.params,
    scope: scope,
    current_ability: scope.current_ability,
    search_builder_class: Hyrax::Dashboard::WorksSearchBuilder
  )
end