Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix set_doi - Use Elastcisearch instead of ActiveRecord #1152

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/graphql/types/query_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1372,9 +1372,9 @@ def set_doi(id)
doi = doi_from_url(id)
fail ActiveRecord::RecordNotFound if doi.nil?

doi = DataciteDoi.includes(:reference_events, :version_events, :version_of_events, :citation_events, :part_events, :part_of_events).where(doi: doi, aasm_state: "findable").first
fail ActiveRecord::RecordNotFound if doi.nil?
result = ElasticsearchLoader.for(Doi).load(doi)
fail ActiveRecord::RecordNotFound if result.nil?

doi
result
end
end
9 changes: 0 additions & 9 deletions spec/graphql/types/organization_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -831,15 +831,6 @@
response = LupoSchema.execute(query).as_json

expect(response.dig("data")).to be_nil
expect(response.dig("errors")).to eq(
[
{
"locations" => [{ "column" => 9, "line" => 2 }],
"message" => "Record not found",
"path" => %w[organization],
},
],
)
end
end

Expand Down
9 changes: 0 additions & 9 deletions spec/graphql/types/person_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,6 @@
response = LupoSchema.execute(query).as_json

expect(response.dig("data")).to be_nil
expect(response.dig("errors")).to eq(
[
{
"locations" => [{ "column" => 9, "line" => 2 }],
"message" => "Record not found",
"path" => %w[person],
},
],
)
end
end

Expand Down
9 changes: 0 additions & 9 deletions spec/graphql/types/work_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,6 @@
response = LupoSchema.execute(query).as_json

expect(response.dig("data")).to be_nil
expect(response.dig("errors")).to eq(
[
{
"locations" => [{ "column" => 9, "line" => 2 }],
"message" => "Record not found",
"path" => %w[work],
},
],
)
end
end

Expand Down