From 517d3abe5de151538afdd42a5082ebe6fdd8d1b3 Mon Sep 17 00:00:00 2001 From: jrhoads <jrhoads@datacite.org> Date: Mon, 1 May 2023 09:30:05 -0400 Subject: [PATCH 1/2] Fix typo in default first value --- app/graphql/schema.graphql | 4 ++-- app/graphql/types/organization_type.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql index 48a6bce8c..a5d9cab86 100644 --- a/app/graphql/schema.graphql +++ b/app/graphql/schema.graphql @@ -6674,7 +6674,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 } """ @@ -8615,7 +8615,7 @@ type Query { work(id: ID!): Work! workflow(id: ID!): Workflow! workflows(after: String, facetCount: Int = 10, fieldOfScience: String, first: Int = 25, 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, memberId: String, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): WorkflowConnectionWithTotal! - works(after: String, facetCount: Int = 10, fieldOfScience: String, first: Int = 25, 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, memberId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal! + works(after: String, facetCount: Int = 10, fieldOfScience: String, fieldOfScienceCombined: String, fieldOfScienceRepository: String, first: Int = 25, 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, memberId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal! } """ diff --git a/app/graphql/types/organization_type.rb b/app/graphql/types/organization_type.rb index ed5b15830..779330cbe 100644 --- a/app/graphql/types/organization_type.rb +++ b/app/graphql/types/organization_type.rb @@ -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 From 010c5d5a0b1558225b2db997377efdfda326e2fe Mon Sep 17 00:00:00 2001 From: jrhoads <jrhoads@datacite.org> Date: Mon, 1 May 2023 11:54:20 -0400 Subject: [PATCH 2/2] Update organization spec with true number of nodes --- spec/graphql/types/organization_type_spec.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spec/graphql/types/organization_type_spec.rb b/spec/graphql/types/organization_type_spec.rb index 9bfb0433d..bdaa4172a 100644 --- a/spec/graphql/types/organization_type_spec.rb +++ b/spec/graphql/types/organization_type_spec.rb @@ -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(