Skip to content

Commit

Permalink
more fields for repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 10, 2020
1 parent 0043a1d commit 79bd25f
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 1 deletion.
45 changes: 45 additions & 0 deletions app/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4962,6 +4962,26 @@ type InteractiveResourceEdge {
node: InteractiveResource
}

"""
Information about ISSN
"""
type Issn {
"""
The electronic ISSN
"""
electronic: String

"""
The ISSNL
"""
issnl: String

"""
The print ISSN
"""
print: String
}

"""
Information about providers
"""
Expand Down Expand Up @@ -8359,11 +8379,21 @@ type Repository {
"""
alternateName: String

"""
The certificate(s) for the repository
"""
certificate: [String!]

"""
The number of citations.
"""
citationCount: Int

"""
The client type (repository or periodical)
"""
clientType: String

"""
Datasets managed by the repository
"""
Expand Down Expand Up @@ -8416,6 +8446,16 @@ type Repository {
"""
id: ID!

"""
The ISSN
"""
issn: Issn

"""
The langauge of the repository
"""
language: [String!]

"""
Repository name
"""
Expand Down Expand Up @@ -8487,6 +8527,11 @@ type Repository {
"""
re3data: ID

"""
The repository type(s)
"""
repositoryType: [String!]

"""
The name of the software that is used to run the repository
"""
Expand Down
9 changes: 9 additions & 0 deletions app/graphql/types/issn_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

class IssnType < BaseObject
description "Information about ISSN"

field :issnl, String, null: true, description: "The ISSNL"
field :electronic, String, null: true, description: "The electronic ISSN"
field :print, String, null: true, description: "The print ISSN"
end
8 changes: 7 additions & 1 deletion app/graphql/types/repository_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@ class RepositoryType < BaseObject

field :id, ID, null: false, hash_key: "uid", description: "Unique identifier for each repository"
field :type, String, null: false, description: "The type of the item."
field :re3data, ID, null: true, description: "The re3data identifier for the repository"
field :name, String, null: false, description: "Repository name"
field :alternate_name, String, null: true, description: "Repository alternate name"
field :re3data, ID, null: true, description: "The re3data identifier for the repository"
field :description, String, null: true, description: "Description of the repository"
field :url, Url, null: true, description: "The homepage of the repository"
field :software, String, null: true, description: "The name of the software that is used to run the repository"
field :client_type, String, null: true, description: "The client type (repository or periodical)"
field :repository_type, [String], null: true, description: "The repository type(s)"
field :certificate, [String], null: true, description: "The certificate(s) for the repository"
field :language, [String], null: true, description: "The langauge of the repository"
field :issn, IssnType, null: true, description: "The ISSN"

field :view_count, Integer, null: true, description: "The number of views according to the Counter Code of Practice."
field :download_count, Integer, null: true, description: "The number of downloads according to the Counter Code of Practice."
field :citation_count, Integer, null: true, description: "The number of citations."
Expand Down
11 changes: 11 additions & 0 deletions spec/graphql/types/issn_type_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "rails_helper"

describe IssnType do
describe "fields" do
subject { described_class }

it { is_expected.to have_field(:issnl).of_type("String") }
it { is_expected.to have_field(:electronic).of_type("String") }
it { is_expected.to have_field(:print).of_type("String") }
end
end
9 changes: 9 additions & 0 deletions spec/graphql/types/repository_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@

it { is_expected.to have_field(:id).of_type(!types.ID) }
it { is_expected.to have_field(:type).of_type("String!") }
it { is_expected.to have_field(:re3data).of_type(types.ID) }
it { is_expected.to have_field(:name).of_type("String!") }
it { is_expected.to have_field(:alternateName).of_type("String") }
it { is_expected.to have_field(:description).of_type("String") }
it { is_expected.to have_field(:url).of_type("Url") }
it { is_expected.to have_field(:software).of_type("String") }
it { is_expected.to have_field(:clientType).of_type("String") }
it { is_expected.to have_field(:repositoryType).of_type("[String!]") }
it { is_expected.to have_field(:certificate).of_type("[String!]") }
it { is_expected.to have_field(:language).of_type("[String!]") }
it { is_expected.to have_field(:issn).of_type("Issn") }

it { is_expected.to have_field(:datasets).of_type("DatasetConnection") }
it { is_expected.to have_field(:publications).of_type("PublicationConnection") }
it { is_expected.to have_field(:softwares).of_type("SoftwareConnection") }
Expand Down

0 comments on commit 79bd25f

Please sign in to comment.