add status filter to DespositOrder
This commit is contained in:
6
app/graphql/inputs/deposit_order_filter_input.rb
Normal file
6
app/graphql/inputs/deposit_order_filter_input.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
module Inputs
|
||||||
|
class DepositOrderFilterInput < Types::BaseInputObject
|
||||||
|
argument :status, [Types::ProcessStatusEnum], required: false
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -32,9 +32,13 @@ module Types
|
|||||||
ransack(scope, filter)
|
ransack(scope, filter)
|
||||||
end
|
end
|
||||||
|
|
||||||
field :deposit_orders, DepositOrderType.connection_type, null: false
|
field :deposit_orders, DepositOrderType.connection_type, null: false do
|
||||||
def deposit_orders
|
argument :filter, Inputs::DepositOrderFilterInput, required: false
|
||||||
Pundit.policy_scope(current_user, DepositOrder)
|
end
|
||||||
|
|
||||||
|
def deposit_orders(filter: nil)
|
||||||
|
scope = Pundit.policy_scope(current_user, DepositOrder)
|
||||||
|
scope.where(status: filter.status) if filter&.status
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
5
app/javascript/__generated__/schema.graphql
generated
5
app/javascript/__generated__/schema.graphql
generated
@@ -211,6 +211,10 @@ type DepositOrderEdge {
|
|||||||
node: DepositOrder!
|
node: DepositOrder!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input DepositOrderFilterInput {
|
||||||
|
status: [ProcessStatus!]
|
||||||
|
}
|
||||||
|
|
||||||
type FiatBalance implements Node {
|
type FiatBalance implements Node {
|
||||||
amountCents: Int!
|
amountCents: Int!
|
||||||
amountCurrency: String!
|
amountCurrency: String!
|
||||||
@@ -335,6 +339,7 @@ type Query {
|
|||||||
Returns the elements in the list that come before the specified cursor.
|
Returns the elements in the list that come before the specified cursor.
|
||||||
"""
|
"""
|
||||||
before: String
|
before: String
|
||||||
|
filter: DepositOrderFilterInput
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Returns the first _n_ elements from the list.
|
Returns the first _n_ elements from the list.
|
||||||
|
|||||||
Reference in New Issue
Block a user