Files
graphql-api-js/src/schema.ts
T
2021-07-06 15:57:22 +02:00

306 lines
5.8 KiB
TypeScript

import { gql } from 'apollo-server';
const typeDefs = gql`
scalar DateTime
scalar Date
scalar JSON
type Query {
orders(filter: FilterInput!): OrderResult
order(id: ID!): Order
products(limit: Int, visible: Boolean, browsable: Boolean): [Product]
product(id: Int!): Product
categories: [Category]
category(id: Int!): Category
designers(limit: Int): [Designer]
designer(id: Int!): Designer
}
input DateInput {
from: Date
to: Date
}
input FilterInput {
dates: DateInput
limit: Int!
offset: Int!
}
"""
Later replace with implements ListResult
"""
type OrderResult {
total: Int!
offset: Int
limit: Int
items: [Order]
}
type Market {
id: ID!
name: String
vat: Float
currency: String
priceAdjustment: Float
}
type Address {
id: ID!
firstname: String
lastname: String
recipientName: String
companyname: String
address1: String
address2: String
countryCode: String
city: String
zipcode: String
stateCountyOrRegion: String
}
type ContactInformation {
email: String
phone: String
address: Address
}
type Order {
id: ID!
inserted: DateTime!
paid: Boolean!
confirmed: Boolean!
delivered: Boolean!
newsletter: Boolean
creditInvoice: Boolean
canceled: Boolean
reminder: Boolean
deliveredDate: DateTime
countryCode: String
language: String
deliveryCountryCode: String
deliveryMethod: String
deliveryPrice: String
deliveryVat: Float
customerType: String
paymentType: String
attention: String
currency: String
exchangeRate: Float
exchangeRateEur: Float
invoiceId: String
contractCustomerId: Int
vatNumber: String
comment: String
cancelsOrderId: Int
cancelledByOrderId: Int
orderlogId: Int
resellerStore: String
orderSum: Float
klarnaOrderId: String
pwintyId: Int
email: String
phone: String
deliveryEmail: String
deliveryPhone: String
customerFirstname: String
customerLastname: String
customerEmail: String
customerCellphone: String
flyerIds: String
marketName: String
localeName: String
billingInformation: ContactInformation
deliveryInformation: ContactInformation
billingAddressId: Int
deliveryAddressId: Int
rows: [OrderRow]
market: Market
}
type OrderRow {
id: ID!
artNo: String
code: String
commission: Int
commissionAmount: Float
commissionResale: Int
designer: String
designerId: Int
designerPath: String
discountType: String
discountValue: Float
displayHeight: Int
displayWidth: Int
edge: String
frameColor: String
framed: Int
group: ProductGroup
height: Int
imagedonotprint: Int
imageprocessed: Int
imageprocessingrejected: Int
inserted: DateTime
material: String
measureUnit: String
mirrored: Int
modifier: String
name: String
noShipping: Boolean
order: Order
orderId: Int
path: String
price: Float
printId: Int
process: Boolean
productGroup: String
productId: Int
pwintyImageId: Int
pwintySku: String
resolution: Int
status: String
type: String
vat: Float
weight: Int
width: Int
x: Float
y: Float
}
type Category {
id: ID!
name: String
path: String
isLeaf: Int
depth: Int
childCount: Int
lft: Int
rgt: Int
products: [Product]
}
type Product {
id: ID!
path: String!
visible: Boolean!
browsable: Boolean!
inserted: DateTime!
updated: DateTime
printProducts: [PrintProduct]
blacklisting: [ProductBlacklist]
categories: [Category]
designerId: Int
designer: Designer
api1json: JSON
fields_json: JSON
}
enum ProductGroup {
PHOTO_WALLPAPER
CANVAS
WALLPAPER
OLD_REMOVED
DO_IT_YOURSELF_FRAME
DESIGNER_WALLPAPER
POSTER
FRAMED_PRINT
UNKNOWN
}
type ProductBlacklist {
id: ID!
groupId: Int!
group: ProductGroup!
marketId: Int!
market: Market!
inserted: DateTime!
updated: DateTime!
}
type PrintProduct {
id: ID!
groupId: Int!
group: ProductGroup!
inserted: DateTime!
updated: DateTime
price(market: Int, width: Int, height: Int, sku: String): JSON
}
type Designer {
id: ID!
name: String
path: String
orderRows(filter: FilterInput): [OrderRow]
}
`;
export { typeDefs };
/*
orderrows example
{
printId: '73963',
productId: '54192',
group: 'photo-wallpaper',
type: 'scaling',
artNo: 'e50075',
path: 'flora-hysterica-4',
name: 'Flora Hysterica 4',
price: '587.092480',
width: '640',
height: '260',
x: '0.000000',
y: '0.135133',
weight: '1',
designer: 'martin-bergstrom',
designerId: '201',
commission: '0',
commissionResale: '0',
status: 'print',
process: 'true',
vat: '1.210000',
commissionAmount: '0.000000',
framed: '0',
mirrored: '0',
edge: '0',
imageprocessed: 'true',
imageprocessingrejected: 'false',
resolution: '150',
imagedonotprint: 'false',
material: 'premium-wallpaper',
discountType: '%',
discountValue: '25',
measureUnit: 'cm',
displayWidth: '640',
displayHeight: '260',
designerPath: 'martin-bergstrom',
productGroup: 'photo-wallpaper',
id: 1559849,
orderId: 588274,
inserted: 2021-02-04T09:58:11.243Z
},
{
type: '%',
name: 'Influencer 2021 IT',
price: '-150.826446',
vat: '1.210000',
modifier: 'discount',
code: 'mynameiseleonora25',
noShipping: 'False',
id: 1559850,
orderId: 588274,
inserted: 2021-02-04T09:58:11.243Z
}
"doityourselfframe"
"fixed"
"tiling"
"gift-voucher"
"custom"
"scaling"
"%"
"stock"
*/