Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(customer-portal): Extract organization type and add premium integrations #2648

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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