wallet screen

This commit is contained in:
João Geonizeli
2021-08-11 20:51:42 -03:00
parent 38b60ca0fa
commit a057931c51
19 changed files with 656 additions and 20 deletions

View File

@@ -0,0 +1,13 @@
# frozen_string_literal: true
module Types
class BalanceType < Types::BaseObject
implements GraphQL::Types::Relay::Node
global_id_field :id
graphql_name "Balance"
field :id, ID, null: false
field :currency, CurrencyType, null: false
field :amount, String, null: false
end
end

View File

@@ -0,0 +1,12 @@
# frozen_string_literal: true
module Types
class CurrencyType < Types::BaseObject
implements GraphQL::Types::Relay::Node
global_id_field :id
graphql_name "Currency"
field :id, ID, null: false
field :name, String, null: false
end
end

View File

@@ -8,5 +8,10 @@ module Types
def current_user
context[:current_user]
end
field :balances, BalanceType.connection_type, null: false
def balances
Pundit.policy_scope(current_user, Balance)
end
end
end

View File

@@ -2,9 +2,10 @@
module Types
class UserType < Types::BaseObject
# implements GraphQL::Types::Relay::Node
global_id_field :id
graphql_name "User"
field :id, ID, null: false
field :first_name, String, null: false
field :last_name, String, null: false