Skip to content

Commit

Permalink
make creator affiliation id optional. #573
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jun 26, 2020
1 parent 5fc1799 commit 105362a
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Information about affiliations
"""
type Affiliation {
"""
Affiliation ROR identifier
Affiliation identifier
"""
id: ID

Expand Down Expand Up @@ -1421,7 +1421,7 @@ type Creator {
"""
The organizational or institutional affiliation of the creator.
"""
affiliation: [Organization!]
affiliation: [Affiliation!]

"""
Family name. In the U.S., the last name of an Person.
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/affiliation_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
class AffiliationType < BaseObject
description "Information about affiliations"

field :id, ID, null: true, description: "Affiliation ROR identifier"
field :id, ID, null: true, description: "Affiliation identifier"
field :name, String, null: false, description: "Affiliation name"
end
2 changes: 1 addition & 1 deletion app/graphql/types/creator_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CreatorType < BaseObject
field :name, String, null: true, description: "The name of the creator."
field :given_name, String, null: true, description: "Given name. In the U.S., the first name of a Person."
field :family_name, String, null: true, description: "Family name. In the U.S., the last name of an Person."
field :affiliation, [OrganizationType], null: true, description: "The organizational or institutional affiliation of the creator."
field :affiliation, [AffiliationType], null: true, description: "The organizational or institutional affiliation of the creator."

def type
object.name_type == "Organizational" ? "Organization" : "Person"
Expand Down
1 change: 0 additions & 1 deletion app/models/concerns/mailable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def send_welcome_email(responsible_id: nil)
html = User.format_message_html(template: "users/welcome.html.erb", title: title, contact_name: name, name: symbol, url: url, reset_url: reset_url)

response = User.send_message(name: name, email: system_email, subject: subject, text: text, html: html)

fields = [
{ title: "Account ID", value: symbol, short: true },
{ title: "Account type", value: account_type, short: true },
Expand Down
2 changes: 1 addition & 1 deletion spec/graphql/types/creator_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
it { is_expected.to have_field(:name).of_type("String") }
it { is_expected.to have_field(:givenName).of_type("String") }
it { is_expected.to have_field(:familyName).of_type("String") }
it { is_expected.to have_field(:affiliation).of_type("[Organization!]") }
it { is_expected.to have_field(:affiliation).of_type("[Affiliation!]") }
end
end
2 changes: 0 additions & 2 deletions spec/graphql/types/dataset_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@
expect(response.dig("data", "datasets", "nodes").length).to eq(2)
expect(response.dig("data", "datasets", "nodes", 0, "viewCount")).to be > 1
expect(response.dig("data", "datasets", "nodes", 0, "viewsOverTime").length).to be >= 1
puts "dfkhjfgdjhkfgdjhk"
puts response.dig("data", "datasets", "nodes", 0, "viewsOverTime")
expect(response.dig("data", "datasets", "nodes", 0, "viewsOverTime").first.dig('yearMonth')).not_to be_nil
# expect(response.dig("data", "datasets", "nodes", 0, "citations", "totalCount")).to eq(2)
# expect(response.dig("data", "datasets", "nodes", 0, "citations", "nodes").length).to eq(2)
Expand Down
3 changes: 0 additions & 3 deletions spec/requests/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,8 @@
it "are correctly stored" do
post uri, params, headers


expect(last_response.status).to eq(201)
puts json.dig("data", "id")
event = Event.where(uuid: json.dig("data", "id")).first
puts event.inspect
expect(event[:obj].has_key?('datePublished')).to be_truthy
expect(event[:obj].has_key?('registrantId')).to be_truthy
expect(event[:obj].has_key?('proxyIdentifiers')).to be_truthy
Expand Down
1 change: 0 additions & 1 deletion spec/requests/exports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

it 'returns repositories', vcr: false do
get "/export/repositories", nil, admin_headers
puts last_response.body
expect(last_response.status).to eq(200)
csv = last_response.body.lines
expect(csv.length).to eq(2)
Expand Down
1 change: 0 additions & 1 deletion spec/requests/media_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
it 'returns media' do
get "/dois/#{doi.doi}/media", nil, headers

puts last_response.body
expect(last_response.status).to eq(200)
expect(json).not_to be_empty
expect(json['data'].size).to eq(6)
Expand Down

0 comments on commit 105362a

Please sign in to comment.