Skip to content

Commit

Permalink
feat(tresholds): Add GraphQL for usage tresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
ivannovosad committed Aug 12, 2024
1 parent 2601c88 commit f5c689f
Show file tree
Hide file tree
Showing 17 changed files with 536 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/graphql/mutations/plans/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Create < BaseMutation

argument :charges, [Types::Charges::Input]
argument :minimum_commitment, Types::Commitments::Input, required: false
argument :usage_thresholds, [Types::UsageThresholds::Input], required: false

type Types::Plans::Object

Expand Down
1 change: 1 addition & 0 deletions app/graphql/mutations/plans/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Update < BaseMutation

argument :charges, [Types::Charges::Input]
argument :minimum_commitment, Types::Commitments::Input, required: false
argument :usage_thresholds, [Types::UsageThresholds::Input], required: false

type Types::Plans::Object

Expand Down
1 change: 1 addition & 0 deletions app/graphql/types/plans/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Object < Types::BaseObject
field :parent, Types::Plans::Object, null: true
field :pay_in_advance, Boolean, null: false
field :trial_period, Float
field :usage_thresholds, [Types::UsageThresholds::Object]

field :charges, [Types::Charges::Object]
field :taxes, [Types::Taxes::Object]
Expand Down
1 change: 1 addition & 0 deletions app/graphql/types/subscriptions/plan_overrides_input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class PlanOverridesInput < Types::BaseInputObject
argument :name, String, required: false
argument :tax_codes, [String], required: false
argument :trial_period, Float, required: false
argument :usage_thresholds, [Types::Subscriptions::UsageThresholdOverridesInput], required: false
end
end
end
13 changes: 13 additions & 0 deletions app/graphql/types/subscriptions/usage_threshold_overrides_input.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module Types
module Subscriptions
class UsageThresholdOverridesInput < Types::BaseInputObject
argument :id, ID, required: true

argument :amount_cents, GraphQL::Types::BigInt, required: false
argument :recurring, Boolean, required: false
argument :threshold_display_name, String, required: false
end
end
end
15 changes: 15 additions & 0 deletions app/graphql/types/usage_thresholds/input.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

module Types
module UsageThresholds
class Input < BaseInputObject
graphql_name 'UsageThresholdInput'

argument :id, ID, required: false

argument :amount_cents, GraphQL::Types::BigInt, required: false
argument :recurring, Boolean, required: false
argument :threshold_display_name, String, required: false
end
end
end
18 changes: 18 additions & 0 deletions app/graphql/types/usage_thresholds/object.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

module Types
module UsageThresholds
class Object < Types::BaseObject
graphql_name 'UsageThreshold'

field :id, ID, null: false

field :amount_cents, GraphQL::Types::BigInt, null: false
field :recurring, Boolean, null: false
field :threshold_display_name, String, null: true

field :created_at, GraphQL::Types::ISO8601DateTime, null: false
field :updated_at, GraphQL::Types::ISO8601DateTime, null: false
end
end
end
27 changes: 27 additions & 0 deletions schema.graphql

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

Loading

0 comments on commit f5c689f

Please sign in to comment.