add create sell and buy crypto order mutations

This commit is contained in:
João Geonizeli
2021-08-15 01:59:59 -03:00
parent 4b1341677f
commit a3d32ee13a
25 changed files with 688 additions and 15 deletions

View File

@@ -34,19 +34,24 @@ type BalanceEdge {
node: Balance!
}
type Currency implements Node {
type BuyCryptoOrder implements Node {
createdAt: ISO8601DateTime!
currency: Currency!
id: ID!
name: String!
paidAmountCents: Int!
receivedAmount: Float
status: ProcessStatus!
updatedAt: ISO8601DateTime!
}
"""
The connection type for Currency.
The connection type for BuyCryptoOrder.
"""
type CurrencyConnection {
type BuyCryptoOrderConnection {
"""
A list of edges.
"""
edges: [CurrencyEdge!]!
edges: [BuyCryptoOrderEdge!]!
"""
Information to aid in pagination.
@@ -57,7 +62,7 @@ type CurrencyConnection {
"""
An edge in a connection.
"""
type CurrencyEdge {
type BuyCryptoOrderEdge {
"""
A cursor for use in pagination.
"""
@@ -66,7 +71,82 @@ type CurrencyEdge {
"""
The item at the end of the edge.
"""
node: Currency!
node: BuyCryptoOrder!
}
input CreateBuyCryptoOrderAttributesInput {
"""
Amount to be paid
"""
amount: Float!
currencyId: ID!
}
"""
Autogenerated input type of CreateBuyCryptoOrder
"""
input CreateBuyCryptoOrderInput {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
order: CreateBuyCryptoOrderAttributesInput!
}
"""
Autogenerated return type of CreateBuyCryptoOrder
"""
type CreateBuyCryptoOrderPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
Errors encountered during execution of the mutation.
"""
errors: [String!]
order: BuyCryptoOrder!
}
input CreateSellCryptoOrderAttributesInput {
"""
Amount to be paid
"""
amount: Float!
currencyId: ID!
}
"""
Autogenerated input type of CreateSellCryptoOrder
"""
input CreateSellCryptoOrderInput {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
order: CreateSellCryptoOrderAttributesInput!
}
"""
Autogenerated return type of CreateSellCryptoOrder
"""
type CreateSellCryptoOrderPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
Errors encountered during execution of the mutation.
"""
errors: [String!]
order: SellCryptoOrder!
}
type Currency implements Node {
id: ID!
name: String!
}
type FiatBalance implements Node {
@@ -112,6 +192,21 @@ An ISO 8601-encoded datetime
"""
scalar ISO8601DateTime
type Mutation {
createBuyCryptoOrder(
"""
Parameters for CreateBuyCryptoOrder
"""
input: CreateBuyCryptoOrderInput!
): CreateBuyCryptoOrderPayload
createSellCryptoOrder(
"""
Parameters for CreateSellCryptoOrder
"""
input: CreateSellCryptoOrderInput!
): CreateSellCryptoOrderPayload
}
"""
An object with an ID.
"""
@@ -147,6 +242,12 @@ type PageInfo {
startCursor: String
}
enum ProcessStatus {
CANCELED
COMPLETED
PROCESSING
}
type Query {
balances(
"""
@@ -169,7 +270,7 @@ type Query {
"""
last: Int
): BalanceConnection!
currencies(
buyCryptoOrders(
"""
Returns the elements in the list that come after the specified cursor.
"""
@@ -189,7 +290,7 @@ type Query {
Returns the last _n_ elements from the list.
"""
last: Int
): CurrencyConnection!
): BuyCryptoOrderConnection!
currentUser: User
fiatBalances(
"""
@@ -232,6 +333,67 @@ type Query {
"""
ids: [ID!]!
): [Node]!
sellCryptoOrders(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): SellCryptoOrderConnection!
}
type SellCryptoOrder implements Node {
createdAt: ISO8601DateTime!
currency: Currency!
id: ID!
paidAmount: Float!
receivedAmountCents: Int
status: ProcessStatus!
updatedAt: ISO8601DateTime!
}
"""
The connection type for SellCryptoOrder.
"""
type SellCryptoOrderConnection {
"""
A list of edges.
"""
edges: [SellCryptoOrderEdge!]!
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
}
"""
An edge in a connection.
"""
type SellCryptoOrderEdge {
"""
A cursor for use in pagination.
"""
cursor: String!
"""
The item at the end of the edge.
"""
node: SellCryptoOrder!
}
type User {