Skip to content

Commit

Permalink
fix passing of has_parts, has_versions parameters. #438, #439
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 5, 2020
1 parent 545bf73 commit 3c485b6
Show file tree
Hide file tree
Showing 25 changed files with 144 additions and 28 deletions.
4 changes: 3 additions & 1 deletion app/graphql/types/audiovisual_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def response(**args)
has_person: args[:has_person],
has_funder: args[:has_funder],
has_organization: args[:has_organization],
has_citations: args[:has_citations],
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],
page: { number: 1, size: 0 })
Expand Down
10 changes: 9 additions & 1 deletion app/graphql/types/client_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class ClientType < BaseObject
argument :has_organization, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -51,6 +53,8 @@ class ClientType < BaseObject
argument :has_organization, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -68,6 +72,8 @@ class ClientType < BaseObject
argument :has_organization, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -85,6 +91,8 @@ class ClientType < BaseObject
argument :has_organization, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand Down Expand Up @@ -151,6 +159,6 @@ def citation_count
end

def response(**args)
Doi.query(args[:query], funder_id: args[:funder_id], user_id: args[:user_id], client_id: object.uid, provider_id: args[:provider_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_organization: args[:has_organization], has_funder: args[:has_funder], has_citations: args[:has_citations], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
Doi.query(args[:query], funder_id: args[:funder_id], user_id: args[:user_id], client_id: object.uid, provider_id: args[:provider_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_organization: args[:has_organization], has_funder: args[:has_funder], 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], state: "findable", page: { number: 1, size: args[:first] })
end
end
4 changes: 3 additions & 1 deletion app/graphql/types/collection_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def response(**args)
has_funder: args[:has_funder],
has_organization: args[:has_organization],
has_citations: args[:has_citations],
has_views: args[:has_views],
has_parts: args[:has_parts],
has_versions: args[:has_versions],
has_views: args[:has_views],
has_downloads: args[:has_downloads],
page: { number: 1, size: 0 })
end
Expand Down
4 changes: 3 additions & 1 deletion app/graphql/types/data_catalog_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class DataCatalogType < BaseObject
argument :client_id, String, required: false
argument :provider_id, String, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand Down Expand Up @@ -74,7 +76,7 @@ def software_application
end

def datasets(**args)
Doi.query(args[:query], re3data_id: object[:id], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], has_citations: args[:has_citations], has_views: args[:has_views], has_downloads: args[:has_downloads], resource_type_id: "Dataset", state: "findable", page: { number: 1, size: args[:first] }).results.to_a
Doi.query(args[:query], re3data_id: object[:id], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], 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], resource_type_id: "Dataset", state: "findable", page: { number: 1, size: args[:first] }).results.to_a
end

def view_count
Expand Down
4 changes: 3 additions & 1 deletion app/graphql/types/data_paper_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def response(**args)
has_person: args[:has_person],
has_funder: args[:has_funder],
has_organization: args[:has_organization],
has_citations: args[:has_citations],
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],
page: { number: 1, size: 0 })
Expand Down
4 changes: 3 additions & 1 deletion app/graphql/types/dataset_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def response(**args)
has_person: args[:has_person],
has_funder: args[:has_funder],
has_organization: args[:has_organization],
has_citations: args[:has_citations],
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],
page: { number: 1, size: 0 })
Expand Down
14 changes: 13 additions & 1 deletion app/graphql/types/doi_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ module DoiItem
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -78,6 +80,8 @@ module DoiItem
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -94,6 +98,8 @@ module DoiItem
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -110,6 +116,8 @@ module DoiItem
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -126,6 +134,8 @@ module DoiItem
argument :affiliation_id, String, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -142,6 +152,8 @@ module DoiItem
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand Down Expand Up @@ -231,7 +243,7 @@ def version_of(**args)
def response(**args)
return [] if args[:ids].blank?

Doi.query(args[:query], ids: args[:ids], funder_id: object[:id], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], has_person: args[:has_person], has_funder: args[:has_funder], has_organization: args[:has_organization], has_citations: args[:has_citations], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] }).results.to_a
Doi.query(args[:query], ids: args[:ids], funder_id: object[:id], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_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], state: "findable", page: { number: 1, size: args[:first] }).results.to_a
end

def doi_link(url)
Expand Down
6 changes: 4 additions & 2 deletions app/graphql/types/event_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ def response(**args)
has_person: args[:has_person],
has_funder: args[:has_funder],
has_organization: args[:has_organization],
has_citations: args[:has_citations],
has_views: args[:has_views],
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],
page: { number: 1, size: 0 })
end
Expand Down
10 changes: 9 additions & 1 deletion app/graphql/types/funder_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class FunderType < BaseObject
argument :has_person, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -35,6 +37,8 @@ class FunderType < BaseObject
argument :has_person, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -49,6 +53,8 @@ class FunderType < BaseObject
argument :has_person, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -65,6 +71,8 @@ class FunderType < BaseObject
argument :has_person, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand Down Expand Up @@ -121,6 +129,6 @@ def citation_count
end

def response(**args)
Doi.query(args[:query], funder_id: object[:id], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_organization: args[:has_organization], has_citations: args[:has_citations], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
Doi.query(args[:query], funder_id: object[:id], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], 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], state: "findable", page: { number: 1, size: args[:first] })
end
end
4 changes: 3 additions & 1 deletion app/graphql/types/image_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def response(**args)
has_person: args[:has_person],
has_funder: args[:has_funder],
has_organization: args[:has_organization],
has_citations: args[:has_citations],
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],
page: { number: 1, size: 0 })
Expand Down
4 changes: 3 additions & 1 deletion app/graphql/types/interactive_resource_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def response(**args)
has_person: args[:has_person],
has_funder: args[:has_funder],
has_organization: args[:has_organization],
has_citations: args[:has_citations],
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],
page: { number: 1, size: 0 })
Expand Down
4 changes: 3 additions & 1 deletion app/graphql/types/model_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def response(**args)
has_person: args[:has_person],
has_funder: args[:has_funder],
has_organization: args[:has_organization],
has_citations: args[:has_citations],
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],
page: { number: 1, size: 0 })
Expand Down
10 changes: 9 additions & 1 deletion app/graphql/types/organization_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class OrganizationType < BaseObject
argument :client_id, String, required: false
argument :provider_id, String, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -35,6 +37,8 @@ class OrganizationType < BaseObject
argument :client_id, String, required: false
argument :provider_id, String, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -48,6 +52,8 @@ class OrganizationType < BaseObject
argument :client_id, String, required: false
argument :provider_id, String, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand All @@ -61,6 +67,8 @@ class OrganizationType < BaseObject
argument :client_id, String, required: false
argument :provider_id, String, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :first, Int, required: false, default_value: 25
Expand Down Expand Up @@ -129,6 +137,6 @@ def citation_count
end

def response(**args)
Doi.query(args[:query], affiliation_id: object[:id], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], funder_id: args[:funder_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_funder: args[:has_funder], has_citations: args[:has_citations], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] })
Doi.query(args[:query], affiliation_id: object[:id], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], funder_id: args[:funder_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_funder: args[:has_funder], 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], state: "findable", page: { number: 1, size: args[:first] })
end
end
4 changes: 3 additions & 1 deletion app/graphql/types/other_connection_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def response(**args)
has_person: args[:has_person],
has_funder: args[:has_funder],
has_organization: args[:has_organization],
has_citations: args[:has_citations],
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],
page: { number: 1, size: 0 })
Expand Down
Loading

0 comments on commit 3c485b6

Please sign in to comment.