Skip to content

Commit 76b2b9b

Browse files
author
Adam Jazairi
authored
Merge pull request #810 from MITLibraries/gdt-218-publishers-field
Add publishers field to record type
2 parents 1ea2408 + 5010917 commit 76b2b9b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

app/graphql/types/record_type.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ def matched_phrases
131131
end
132132
end
133133

134+
class PublishersType < Types::BaseObject
135+
field :name, String, description: 'The name of the publisher'
136+
field :date, String, description: 'The date of the publication'
137+
field :location, String, description: 'Where the publisher is located'
138+
end
139+
134140
class RecordType < Types::BaseObject
135141
field :identifier, ID, null: false, deprecation_reason: 'Use `timdex_record_id`'
136142
field :timdex_record_id, ID, null: false, description: 'TIMDEX unique identifier for the item'
@@ -158,8 +164,8 @@ class RecordType < Types::BaseObject
158164
field :call_numbers, [String], null: true, description: 'Identification number used to classify and locate item'
159165
field :citation, String, null: true, description: 'Citation for item'
160166
field :edition, String, null: true, description: 'Edition information for item'
161-
field :imprint, [String], null: true, deprecation_reason: 'Use `publicationInformation`'
162-
field :publication_information, [String], description: 'Imprint information for item'
167+
field :imprint, [String], null: true, deprecation_reason: 'Use `publishers`'
168+
field :publication_information, [String], deprecation_reason: 'Use `publishers`'
163169
field :physical_description, String, null: true, description: 'Physical description of item'
164170
field :publication_frequency, [String], null: true,
165171
description: 'Publication frequency of item (used for serials)'
@@ -188,6 +194,7 @@ class RecordType < Types::BaseObject
188194
field :provider, String,
189195
null: true,
190196
description: 'The host institution for a resource. Currently only used for geospatial records'
197+
field :publishers, [Types::PublishersType], null: true, description: 'Publishers that are associated with the item'
191198

192199
def in_bibliography
193200
@object['related_items']&.map { |i| i['uri'] if i['relationship'] == 'IsCitedBy' }&.compact
@@ -205,6 +212,10 @@ def publication_date
205212
@object['dates']&.map { |date| date['value'] if date['kind'] == 'Publication date' }&.compact&.first
206213
end
207214

215+
def publication_information
216+
@object['publishers']&.map { |publisher| publisher.values.join('; ') }
217+
end
218+
208219
def file_formats
209220
@object['file_formats'].uniq
210221
end

0 commit comments

Comments
 (0)