118 lines
2.0 KiB
GraphQL
118 lines
2.0 KiB
GraphQL
type AboveMaxSaldo implements Error {
|
|
message: String!
|
|
error: Boolean!
|
|
maxSaldo: Float!
|
|
above: Float!
|
|
}
|
|
|
|
union CreateDepositResponse = CreateDepositSuccess | AboveMaxSaldo | FormErrors
|
|
|
|
type CreateDepositSuccess {
|
|
transaction: Transaction!
|
|
}
|
|
|
|
union CreateOrderResponse = CreateOrderSuccess | InsufficientFunds | FormErrors
|
|
|
|
type CreateOrderSuccess {
|
|
order: Order!
|
|
}
|
|
|
|
"""Date with time (isoformat)"""
|
|
scalar DateTime
|
|
|
|
interface Error {
|
|
message: String!
|
|
error: Boolean!
|
|
}
|
|
|
|
type FieldError implements Error {
|
|
message: String!
|
|
error: Boolean!
|
|
field: String!
|
|
}
|
|
|
|
type FormErrors {
|
|
fields: [FieldError!]!
|
|
message: String!
|
|
error: Boolean!
|
|
}
|
|
|
|
type InsufficientFunds implements Error {
|
|
message: String!
|
|
error: Boolean!
|
|
amountLacking: Float!
|
|
}
|
|
|
|
type Mutation {
|
|
createOrder(customerId: ID!, orderLines: [OrderLineInput!]!, isExternal: Boolean! = false): CreateOrderResponse!
|
|
createDeposit(userId: ID!, amount: Int!): CreateDepositResponse!
|
|
}
|
|
|
|
input OffsetPaginationInput {
|
|
offset: Int! = 0
|
|
limit: Int! = -1
|
|
}
|
|
|
|
type Order {
|
|
id: ID!
|
|
customer: User
|
|
orderSum: Float!
|
|
created: DateTime!
|
|
orderlines: [OrderLine!]
|
|
isExternal: Boolean!
|
|
}
|
|
|
|
type OrderLine {
|
|
id: ID!
|
|
order: Order!
|
|
product: Product!
|
|
amount: Int!
|
|
unitPrice: Float!
|
|
}
|
|
|
|
input OrderLineInput {
|
|
productId: ID!
|
|
amount: Int!
|
|
}
|
|
|
|
type Product {
|
|
id: ID!
|
|
name: String!
|
|
imageUrl: String!
|
|
salePriceInt: Float!
|
|
salePriceExt: Float!
|
|
}
|
|
|
|
input ProductFilter {
|
|
id: ID
|
|
active: Boolean
|
|
}
|
|
|
|
type Query {
|
|
allProducts(filters: ProductFilter): [Product!]!
|
|
allUsers: [User!]!
|
|
allOrders: [Order!]!
|
|
orderList(pagination: OffsetPaginationInput): [Order!]!
|
|
transactionList(pagination: OffsetPaginationInput): [Transaction!]!
|
|
}
|
|
|
|
type Transaction {
|
|
id: ID!
|
|
user: User!
|
|
amount: Float!
|
|
created: DateTime!
|
|
}
|
|
|
|
type User {
|
|
id: ID!
|
|
firstName: String!
|
|
lastName: String!
|
|
profile: UserProfile
|
|
}
|
|
|
|
type UserProfile {
|
|
id: ID!
|
|
balance: Float!
|
|
image: String!
|
|
lastPurchaseDate: DateTime!
|
|
} |