Files
bbs/schema.graphql
T
2022-02-06 12:02:09 +01:00

137 lines
2.3 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!
}
"""
The GenericScalar scalar type represents a generic GraphQL scalar value that could be: List or Object.
"""
scalar JSONScalar
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!
}
input OrderOrdering {
created: Ordering
}
enum Ordering {
ASC
DESC
}
type Product {
id: ID!
name: String!
imageUrl: String!
salePriceInt: Float!
salePriceExt: Float!
userCounts: JSONScalar!
}
input ProductFilter {
id: ID
active: Boolean
}
type Query {
allProducts(filters: ProductFilter): [Product!]!
allUsers: [User!]!
allOrders: [Order!]!
orderList(pagination: OffsetPaginationInput, order: OrderOrdering): [Order!]!
transactionList(pagination: OffsetPaginationInput, order: TransactionOrdering): [Transaction!]!
}
type Transaction {
id: ID!
user: User!
amount: Float!
created: DateTime!
}
input TransactionOrdering {
created: Ordering
}
type User {
id: ID!
firstName: String!
lastName: String!
profile: UserProfile
}
type UserProfile {
id: ID!
balance: Float!
image: String!
lastPurchaseDate: DateTime!
}