Files
graphql-api-js/src/schema.ts
T

421 lines
7.9 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
"""
Will be replaced with a ProductsResult type similar to OrdersResult but we need to change in the similar-images code then
"""
products(limit: Int, visible: Boolean, browsable: Boolean): [Product]
product(id: Int!): Product
categories: [Category]
category(id: Int!): Category
keywords: [Keyword]
keyword(id: Int!): Keyword
designers(limit: Int): [Designer]
designer(id: Int!): Designer
markets: [Market]
market(name: String!): Market
interiors(filter: InteriorsFilterInput): [Interior]
}
type Mutation {
addKeyword(productId: Int!, keywordId: Int!): MutationResult
}
type MutationResult {
result: String!
}
"""
Only return valid interiors for product, type and orientation
"""
input InteriorsFilterInput {
productId: Int!
type: InteriorType!
orientation: Orientation!
}
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: Float
displayWidth: Float
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
pathNumeric: String
isLeaf: Int
depth: Int
childCount: Int
lft: Int
rgt: Int
products: [Product]
}
type Product {
id: ID!
stockid: Int
path: String!
visible: Boolean!
browsable: Boolean!
inserted: DateTime!
updated: DateTime
printProducts: [PrintProduct]
blacklisting: [ProductBlacklist]
categories: [Category]
designerId: Int
designer: Designer
keywords: [Keyword]
ref1: String
ref2: String
ref3: String
related: [Product]
wallpaperTypes: [ProductWallpaperType]
fields: ProductFields
orientation: Orientation
"""
Will be single values return in later release
"""
type: [ProductType]
# Below are for debug and will be removed soon
fields_json: JSON
}
type ProductFields {
artNo: String!
name: String!
height: Int
width: Int
photowallResolution: Int
canvasResolution: Int
wallpaperResolution: Int
copyright: String
proportionsWarning: String
marginWidthMax: Int
marginWidthMin: Int
marginHeightMax: Int
marginHeightMin: Int
focusXpoint: Float
focusYpoint: Float
focusXpoint2: Float
focusYpoint2: Float
batch: String
imageResolution: Int
printFileWidth: Int
printFileHeight: Int
printFileDpi: Int
}
enum Orientation {
UNKNOWN
PORTRAIT
LANDSCAPE
SQUARE
}
enum ProductGroup {
PHOTO_WALLPAPER
CANVAS
WALLPAPER
OLD_REMOVED
DO_IT_YOURSELF_FRAME
DESIGNER_WALLPAPER
POSTER
FRAMED_PRINT
UNKNOWN
}
enum ProductType {
UNKNOWN
PHOTO
ILLUSTRATION
}
enum ProductWallpaperType {
WALLMURAL
DESIGN
}
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
interiors: [Interior]
}
enum InteriorType {
WALLPAPER
PAINTING
POSTER
FRAMED_PRINT
}
type Interior {
"""
room id
"""
id: ID!
roomName: String
position: Int
roomType: String
uri: String
roomNumber: Int
type: InteriorType
orientation: Orientation
}
type Designer {
id: ID!
name: String
path: String
orderRows(filter: FilterInput): [OrderRow]
}
enum KeywordType {
NOT_SET
COLOR
}
type Keyword {
id: ID!
value: String!
type: KeywordType
products: [Product]
}
`;
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
}
types:
"doityourselfframe"
"fixed"
"tiling"
"gift-voucher"
"custom"
"scaling"
"%"
"stock"
*/