Sha256: 207f3ba38d4e58e0a99f948d65c1732638cb487ce8260c1cad4bb61e1d462f76

Contents?: true

Size: 734 Bytes

Versions: 24

Compression:

Stored size: 734 Bytes

Contents

# frozen_string_literal: true
module Wings
  module CustomQueries
    ##
    # @see Hyrax::CustomQueries::FindCollectionsByType
    class FindCollectionsByType
      def self.queries
        [:find_collections_by_type]
      end

      def initialize(query_service:)
        @query_service = query_service
      end

      attr_reader :query_service
      delegate :resource_factory, to: :query_service

      ##
      # @param global_id [GlobalID] global id for a Hyrax::CollectionType
      #
      # @return [Enumerable<PcdmCollection>]
      def find_collections_by_type(global_id:)
        ::Collection.where(Hyrax.config.collection_type_index_field.to_sym => global_id.to_s).map(&:valkyrie_resource)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
hyrax-5.0.1 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-5.0.0 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-5.0.0.rc3 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-5.0.0.rc2 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-5.0.0.rc1 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-3.6.0 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-4.0.0 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-4.0.0.rc3 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-4.0.0.rc2 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-4.0.0.rc1 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-3.5.0 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-4.0.0.beta2 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-3.4.2 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-4.0.0.beta1 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-3.4.1 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-3.4.0 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-3.3.0 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-3.2.0 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-3.1.0 lib/wings/services/custom_queries/find_collections_by_type.rb
hyrax-3.0.2 lib/wings/services/custom_queries/find_collections_by_type.rb