Skip to content

Commit

Permalink
Merge pull request #597 from datacite/works-query
Browse files Browse the repository at this point in the history
Add standard GraphQL query options for works
  • Loading branch information
Martin Fenner authored Aug 5, 2020
2 parents 7646067 + 9af6ce8 commit 0da527a
Show file tree
Hide file tree
Showing 14 changed files with 240 additions and 257 deletions.
322 changes: 161 additions & 161 deletions app/graphql/schema.graphql

Large diffs are not rendered by default.

34 changes: 32 additions & 2 deletions app/graphql/types/doi_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,16 @@ module DoiItem
field :references, WorkConnectionWithTotalType, null: true, max_page_size: 100, description: "References for this DOI" do
argument :query, String, required: false
argument :ids, [String], required: false
argument :published, String, required: false
argument :user_id, String, required: false
argument :funder_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
Expand All @@ -92,11 +97,16 @@ module DoiItem
field :citations, WorkConnectionWithTotalType, null: true, max_page_size: 100, description: "Citations for this DOI." do
argument :query, String, required: false
argument :ids, [String], required: false
argument :published, String, required: false
argument :user_id, String, required: false
argument :funder_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
Expand All @@ -113,11 +123,16 @@ module DoiItem
field :parts, WorkConnectionWithTotalType, null: true, max_page_size: 100, description: "Parts of this DOI." do
argument :query, String, required: false
argument :ids, [String], required: false
argument :published, String, required: false
argument :user_id, String, required: false
argument :funder_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
Expand All @@ -134,11 +149,16 @@ module DoiItem
field :part_of, WorkConnectionWithTotalType, null: true, max_page_size: 100, description: "The DOI is a part of this DOI." do
argument :query, String, required: false
argument :ids, [String], required: false
argument :published, String, required: false
argument :user_id, String, required: false
argument :funder_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
Expand All @@ -155,13 +175,18 @@ module DoiItem
field :versions, WorkConnectionWithTotalType, null: true, max_page_size: 100, description: "Versions of this DOI." do
argument :query, String, required: false
argument :ids, [String], required: false
argument :published, String, required: false
argument :user_id, String, required: false
argument :funder_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :affiliation_id, String, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
Expand All @@ -176,11 +201,16 @@ module DoiItem
field :version_of, WorkConnectionWithTotalType, null: true, max_page_size: 100, description: "The DOI is a version of this DOI." do
argument :query, String, required: false
argument :ids, [String], required: false
argument :published, String, required: false
argument :user_id, String, required: false
argument :funder_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
Expand Down Expand Up @@ -374,7 +404,7 @@ def version_of(**args)
def response(**args)
# make sure no dois are returnded if there are no :ids
args[:ids] = "999" if args[:ids].blank?

Doi.query(args[:query], ids: args[:ids], funder_id: args[:funder_id], user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], affiliation_id: args[:affiliation_id], has_person: args[:has_person], has_funder: args[:has_funder], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], field_of_science: args[:field_of_science], state: "findable", page: { cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : nil, size: args[:first] })
end

Expand Down
21 changes: 12 additions & 9 deletions app/graphql/types/funder_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ class FunderType < BaseObject
argument :user_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :license, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
Expand All @@ -39,10 +40,11 @@ class FunderType < BaseObject
argument :user_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :license, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
Expand All @@ -61,10 +63,11 @@ class FunderType < BaseObject
argument :user_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :license, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
Expand All @@ -83,12 +86,12 @@ class FunderType < BaseObject
argument :user_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :license, String, required: false
argument :registration_agency, String, required: false
argument :language, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :has_person, Boolean, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
Expand Down
1 change: 1 addition & 0 deletions app/graphql/types/organization_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class OrganizationType < BaseObject
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_citations, Int, required: false
Expand Down
4 changes: 4 additions & 0 deletions app/graphql/types/person_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class PersonType < BaseObject
argument :published, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :license, String, required: false
argument :language, String, required: false
Expand All @@ -39,6 +40,7 @@ class PersonType < BaseObject
argument :published, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :license, String, required: false
argument :language, String, required: false
Expand All @@ -60,6 +62,7 @@ class PersonType < BaseObject
argument :published, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :license, String, required: false
argument :language, String, required: false
Expand All @@ -83,6 +86,7 @@ class PersonType < BaseObject
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_funder, Boolean, required: false
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Loading

0 comments on commit 0da527a

Please sign in to comment.