Skip to content

Commit

Permalink
make sure rights in graphql are always an array
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Aug 24, 2020
1 parent 13e44d2 commit c6cdedc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/graphql/types/doi_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module DoiItem
field :formats, [String], null: true, description: "Technical format of the resource"
field :sizes, [String], null: true, description: "Size (e.g. bytes, pages, inches, etc.) or duration (extent), e.g. hours, minutes, days, etc., of a resource"
field :version, String, null: true, hash_key: "version_info", description: "The version number of the resource"
field :rights, [RightsType], null: true, hash_key: "rights_list", description: "Any rights information for this resource"
field :rights, [RightsType], null: true, description: "Any rights information for this resource"
field :descriptions, [DescriptionType], null: true, description: "All additional information that does not fit in any of the other categories" do
argument :first, Int, required: false, default_value: 5
end
Expand Down Expand Up @@ -230,6 +230,10 @@ def type
object.types["resourceTypeGeneral"] || "Work"
end

def rights
Array.wrap(object.rights_list)
end

def language
return {} unless object.language.present?
la = ISO_639.find_by_code(object.language)
Expand Down

0 comments on commit c6cdedc

Please sign in to comment.