diff --git a/app/graphql/types/record_type.rb b/app/graphql/types/record_type.rb index be06a1d..a4e88b8 100644 --- a/app/graphql/types/record_type.rb +++ b/app/graphql/types/record_type.rb @@ -131,6 +131,12 @@ def matched_phrases end end + class PublishersType < Types::BaseObject + field :name, String, description: 'The name of the publisher' + field :date, String, description: 'The date of the publication' + field :location, String, description: 'Where the publisher is located' + end + class RecordType < Types::BaseObject field :identifier, ID, null: false, deprecation_reason: 'Use `timdex_record_id`' field :timdex_record_id, ID, null: false, description: 'TIMDEX unique identifier for the item' @@ -158,8 +164,8 @@ class RecordType < Types::BaseObject field :call_numbers, [String], null: true, description: 'Identification number used to classify and locate item' field :citation, String, null: true, description: 'Citation for item' field :edition, String, null: true, description: 'Edition information for item' - field :imprint, [String], null: true, deprecation_reason: 'Use `publicationInformation`' - field :publication_information, [String], description: 'Imprint information for item' + field :imprint, [String], null: true, deprecation_reason: 'Use `publishers`' + field :publication_information, [String], deprecation_reason: 'Use `publishers`' field :physical_description, String, null: true, description: 'Physical description of item' field :publication_frequency, [String], null: true, description: 'Publication frequency of item (used for serials)' @@ -188,6 +194,7 @@ class RecordType < Types::BaseObject field :provider, String, null: true, description: 'The host institution for a resource. Currently only used for geospatial records' + field :publishers, [Types::PublishersType], null: true, description: 'Publishers that are associated with the item' def in_bibliography @object['related_items']&.map { |i| i['uri'] if i['relationship'] == 'IsCitedBy' }&.compact @@ -205,6 +212,10 @@ def publication_date @object['dates']&.map { |date| date['value'] if date['kind'] == 'Publication date' }&.compact&.first end + def publication_information + @object['publishers']&.map { |publisher| publisher.values.join('; ') } + end + def file_formats @object['file_formats'].uniq end