From 50109172e6b5d93025768b8cbf3c384c8f4f4cc5 Mon Sep 17 00:00:00 2001 From: jazairi <16103405+jazairi@users.noreply.github.com> Date: Thu, 4 Apr 2024 13:09:02 -0400 Subject: [PATCH] Add publishers field to record type Why these changes are being introduced: We recently [made the decision in transmogrifier](https://github.com/MITLibraries/transmogrifier/pull/132) To map publication information to a new nested field, named `publishers` to avoid a naming conflict with the existing `publicationInformation` field. Relevant ticket(s): * [GDT-270](https://mitlibraries.atlassian.net/browse/GDT-270) * [GDT-218](https://mitlibraries.atlassian.net/browse/GDT-218) * [GDT-229](https://mitlibraries.atlassian.net/browse/GDT-229) * [GDT-271](https://mitlibraries.atlassian.net/browse/GDT-271) How this addresses that need: This adds the new `publishers` field and deprecates `publicationInformation`. Side effects of this change: A follow-on ticket is needed to add this field to the UI. (This is ticketed as GDT-271.) --- app/graphql/types/record_type.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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