diff --git a/app/graphql/types/organization_type.rb b/app/graphql/types/organization_type.rb index d1d5f9a76..6b3f94c4a 100644 --- a/app/graphql/types/organization_type.rb +++ b/app/graphql/types/organization_type.rb @@ -29,6 +29,14 @@ class OrganizationType < BaseObject argument :first, Int, required: false, default_value: 25 end + def id + object.id || object.fetch("affiliationIdentifier", nil) + end + + def name + object.name || object.fetch("name", nil) + end + def datasets(**args) ids = Event.query(nil, obj_id: object[:id], citation_type: "Dataset-Organization").results.to_a.map do |e| doi_from_url(e.subj_id) diff --git a/app/graphql/types/researcher_type.rb b/app/graphql/types/researcher_type.rb index b049a2623..873ee29eb 100644 --- a/app/graphql/types/researcher_type.rb +++ b/app/graphql/types/researcher_type.rb @@ -8,7 +8,7 @@ class ResearcherType < BaseObject field :name_type, String, null: true, hash_key: "nameType", description: "The type of name" field :given_name, String, null: true, hash_key: "givenName", description: "Researcher given name" field :family_name, String, null: true, hash_key: "familyName", description: "Researcher family name" - field :affiliation, [String], null: true, description: "Researcher affiliation" + field :affiliation, [OrganizationType], null: true, description: "Researcher affiliation" field :datasets, ResearcherDatasetConnectionWithMetaType, null: true, description: "Authored datasets", connection: true, max_page_size: 100 do argument :first, Int, required: false, default_value: 25 end