Skip to content

Commit

Permalink
feat(customer-portal): Extract organization type and add premium inte…
Browse files Browse the repository at this point in the history
…grations
  • Loading branch information
rsempe committed Oct 2, 2024
1 parent a119605 commit 2f3dd9c
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ module CustomerPortal
class OrganizationResolver < Resolvers::BaseResolver
include AuthenticableCustomerPortalUser

description 'Query customer portal organization'
description "Query customer portal organization"

type Types::Organizations::OrganizationType, null: true
type Types::CustomerPortal::Organizations::Object, null: true

def resolve
context[:customer_portal_user].organization
Expand Down
21 changes: 21 additions & 0 deletions app/graphql/types/customer_portal/organizations/object.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

module Types
module CustomerPortal
module Organizations
class Object < Types::Organizations::BaseOrganizationType
graphql_name "CustomerPortalOrganization"
description "CustomerPortalOrganization"

field :id, ID, null: false

field :billing_configuration, Types::Organizations::BillingConfiguration, null: true
field :default_currency, Types::CurrencyEnum, null: false
field :logo_url, String
field :name, String, null: false
field :premium_integrations, [Types::Integrations::PremiumIntegrationTypeEnum], null: false
field :timezone, Types::TimezoneEnum, null: true
end
end
end
end
15 changes: 14 additions & 1 deletion schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

137 changes: 136 additions & 1 deletion schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
id
documentLocale
}
premiumIntegrations
}
}
GQL
Expand All @@ -37,6 +38,7 @@
expect(data['name']).to eq(organization.name)
expect(data['billingConfiguration']['id']).to eq("#{organization.id}-c0nf")
expect(data['billingConfiguration']['documentLocale']).to eq('en')
expect(data['premiumIntegrations']).to eq([])
end
end
end
17 changes: 17 additions & 0 deletions spec/graphql/types/customer_portal/organizations/object_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require "rails_helper"

RSpec.describe Types::CustomerPortal::Organizations::Object do
subject { described_class }

it { is_expected.to be < ::Types::Organizations::BaseOrganizationType }

it { is_expected.to have_field(:id).of_type("ID!") }
it { is_expected.to have_field(:billing_configuration).of_type("OrganizationBillingConfiguration") }
it { is_expected.to have_field(:default_currency).of_type("CurrencyEnum!") }
it { is_expected.to have_field(:logo_url).of_type("String") }
it { is_expected.to have_field(:name).of_type("String!") }
it { is_expected.to have_field(:premium_integrations).of_type("[PremiumIntegrationTypeEnum!]!") }
it { is_expected.to have_field(:timezone).of_type("TimezoneEnum") }
end

0 comments on commit 2f3dd9c

Please sign in to comment.