Skip to content

Commit

Permalink
misc: create a random id on generated plain object
Browse files Browse the repository at this point in the history
This is for FE only needs
  • Loading branch information
ansmonjol committed Sep 10, 2024
1 parent 9a0d465 commit f35bd5e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/graphql/types/customers/usage/charge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ class Charge < Types::BaseObject

field :amount_cents, GraphQL::Types::BigInt, null: false
field :events_count, Integer, null: false
field :id, ID, null: false
field :units, GraphQL::Types::Float, null: false

field :billable_metric, Types::BillableMetrics::Object, null: false
field :charge, Types::Charges::Object, null: false
field :filters, [Types::Customers::Usage::ChargeFilter], null: true
field :grouped_usage, [Types::Customers::Usage::GroupedUsage], null: false

def id
SecureRandom.uuid
end

def units
object.map { |f| BigDecimal(f.units) }.sum
end
Expand Down
1 change: 1 addition & 0 deletions schema.graphql

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

18 changes: 18 additions & 0 deletions schema.json

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

0 comments on commit f35bd5e

Please sign in to comment.