Skip to content

Commit

Permalink
Merge pull request #956 from datacite/issue-876
Browse files Browse the repository at this point in the history
GraphQL - Fix default number of works returned for an Organization
  • Loading branch information
jrhoads authored May 1, 2023
2 parents d54b9bf + 010c5d5 commit 3ca6a0c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6682,7 +6682,7 @@ type Organization implements ActorItem {
"""
Works from this organization
"""
works(after: String, fieldOfScience: String, first: Int = 2, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasMember: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal
works(after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasMember: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal
}

"""
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/organization_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class OrganizationType < BaseObject
argument :has_views, Int, required: false
argument :has_downloads, Int, required: false
argument :field_of_science, String, required: false
argument :first, Int, required: false, default_value: 2
argument :first, Int, required: false, default_value: 25
argument :after, String, required: false
end

Expand Down
3 changes: 1 addition & 2 deletions spec/graphql/types/organization_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,9 @@
expect(
response.dig("data", "organization", "works", "resourceTypes"),
).to eq([{ "count" => 3, "title" => "Dataset" }])
# TODO should be 3 nodes
expect(
response.dig("data", "organization", "works", "nodes").length,
).to eq(2)
).to eq(3)

work = response.dig("data", "organization", "works", "nodes", 0)
expect(work.dig("titles", 0, "title")).to eq(
Expand Down

0 comments on commit 3ca6a0c

Please sign in to comment.