Skip to content

Commit

Permalink
Merge branch 'i35-valkyrize-hyku' of https://github.com/samvera/hyku
Browse files Browse the repository at this point in the history
…into i35-valkyrize-hyku
  • Loading branch information
Shana Moore committed Jan 17, 2024
2 parents b083885 + 33a5b16 commit b7b5bb1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# frozen_string_literal: true
module Wings
module CustomQueries
# Custom query override specific to Wings
# Use:
# Hyrax.custom_queries.find_by_bulkrax_identifier(identifier: identifier, models: [ModelClass])
class FindByBulkraxIdentifier
# Custom query override specific to Wings
# Use:
# Hyrax.custom_queries.find_bulkrax_id(identifier: identifier, models: [ModelClass])

def self.queries
[:find_by_bulkrax_identifier]
end
Expand Down
12 changes: 2 additions & 10 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
end
AccountElevator.switch!(single_tenant_default.cname)

puts "\n== Creating default admin set"
admin_set = AdminSet.find(Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id)
puts "\n== Creating default admin set with permission template"
Hyrax::AdminSetCreateService.find_or_create_default_admin_set.id

puts "\n== Creating default collection types"
Hyrax::CollectionType.find_or_create_default_collection_type
Expand All @@ -28,14 +28,6 @@
errors = Hyrax::Workflow::WorkflowImporter.load_errors
abort("Failed to process all workflows:\n #{errors.join('\n ')}") unless errors.empty?

puts "\n== Creating permission template"
begin
permission_template = admin_set.permission_template
# If the permission template is missing we will need to run the creete service
rescue
Hyrax::AdminSetCreateService.new(admin_set: admin_set, creating_user: nil).create
end

puts "\n== Finished creating single tenant resources"
end

Expand Down
2 changes: 1 addition & 1 deletion lib/oai/provider/metadata_format/hyku_dublin_core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def add_public_file_urls(xml, record)
return if record[:file_set_ids_ssim].blank?

fs_ids = record[:file_set_ids_ssim].join('" OR "')
public_fs_ids = ActiveFedora::SolrService.query(
public_fs_ids = Hyrax::SolrService.query(
"id:(\"#{fs_ids}\") AND " \
"has_model_ssim:FileSet AND " \
"visibility_ssi:#{Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC}",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Hyrax::CustomQueries::FindByBulkraxIdentifier do
describe '.queries' do
subject { described_class.queries }
let(:query_name) { :find_by_bulkrax_identifier }

it { is_expected.to include(query_name) }

it 'is registered with the Hyrax.query_service' do
expect(Hyrax.query_service.custom_queries).to respond_to(query_name)
end

context ':find_by_bulkrax_identifier query' do
it 'is valid SQL' do
expect do
Hyrax.query_service.custom_queries.find_by_bulkrax_identifier(identifier: "testing-bulkrax-1-2-3")
end.not_to raise_error
end
end
end
end

0 comments on commit b7b5bb1

Please sign in to comment.