From 24996a8ccd57a7ae27028ae7c7825642ebc9fb13 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Mon, 30 Sep 2019 07:42:10 +0200 Subject: [PATCH] keep required researcher_type. datacite/volpino#72 --- app/graphql/types/researcher_type.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 app/graphql/types/researcher_type.rb diff --git a/app/graphql/types/researcher_type.rb b/app/graphql/types/researcher_type.rb new file mode 100644 index 000000000..4291dafbc --- /dev/null +++ b/app/graphql/types/researcher_type.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class ResearcherType < BaseObject + description "Information about researchers" + + field :id, ID, null: true, description: "ORCID ID" + field :name, String, null: true, description: "Researcher name" + field :name_type, String, null: true, hash_key: "nameType", description: "The type of name" + field :given_names, String, null: true, description: "User given names" + field :family_name, String, null: true, description: "Researcher family name" + + def id + object.uid ? "https://orcid.org/#{object.uid}" : object.id + end + + def name + object.name + end +end