diff --git a/app/models/organization.rb b/app/models/organization.rb index 74fd16111..94ef986a1 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -1,4 +1,7 @@ class Organization < ActiveRecord::Base + + include Graphqlable + belongs_to :user, touch: true validates :name, presence: true diff --git a/config/api.yml b/config/api.yml index 4fda3393c..d11a94bd3 100644 --- a/config/api.yml +++ b/config/api.yml @@ -1,10 +1,11 @@ User: fields: - id: integer - username: string - debates: [Debate] - proposals: [Proposal] - comments: [Comment] + id: integer + username: string + debates: [Debate] + proposals: [Proposal] + comments: [Comment] + organization: Organization Debate: fields: id: integer @@ -82,3 +83,8 @@ Vote: votable_id: integer votable_type: string public_timestamp: string +Organization: + fields: + id: integer + user_id: integer + name: string diff --git a/spec/lib/graphql_spec.rb b/spec/lib/graphql_spec.rb index b2a9ed477..bc491f6ba 100644 --- a/spec/lib/graphql_spec.rb +++ b/spec/lib/graphql_spec.rb @@ -37,7 +37,6 @@ describe 'ConsulSchema' do end it "returns has_one associations" do - skip "Organizations are not being exposed yet" organization = create(:organization) response = execute("{ user(id: #{organization.user_id}) { organization { name } } }") expect(dig(response, 'data.user.organization.name')).to eq(organization.name) @@ -61,7 +60,6 @@ describe 'ConsulSchema' do end it "executes deeply nested queries" do - skip "Organizations are not being exposed yet" org_user = create(:user) organization = create(:organization, user: org_user) org_proposal = create(:proposal, author: org_user)