Major refactor

This commit is contained in:
Niklas Fondberg
2021-07-06 15:57:22 +02:00
parent 6bca11c62d
commit f66dbe33d7
21 changed files with 299 additions and 73 deletions
+10
View File
@@ -0,0 +1,10 @@
export interface Category {
id: number;
name: string;
path: string;
isLeaf: number;
depth: number;
childCount: number;
lft: number;
rgt: number;
}
+5
View File
@@ -0,0 +1,5 @@
export interface Designer {
id: number;
name: string;
path: string;
}
+129
View File
@@ -0,0 +1,129 @@
import { DateInput } from './types';
export interface Market {
id: number;
name: string;
vat: number;
currency: string;
priceAdjustment: number;
}
export interface Address {
id: number;
firstname: string;
lastname: string;
recipientName: string;
companyname: string;
address1: string;
address2: string;
countryCode: string;
city: string;
zipcode: string;
stateCountyOrRegion: string;
}
export interface ContactInformation {
email: string;
phone: string;
addressId: number;
}
export interface Order {
id: number;
inserted: Date;
paid: boolean;
confirmed: boolean;
delivered: boolean;
newsletter: boolean;
creditInvoice: boolean;
canceled: boolean;
reminder: boolean;
deliveredDate: Date;
countryCode: string;
language: string;
deliveryCountryCode: string;
deliveryMethod: string;
deliveryPrice: string;
deliveryVat: number;
customerType: string;
paymentType: string;
attention: string;
currency: string;
exchangeRate: number;
exchangeRateEur: number;
invoiceId: string;
contractCustomerId: number | null;
vatNumber: string;
comment: string;
cancelsOrderId: number;
cancelledByOrderId: number;
orderlogId: number;
resellerStore: string;
orderSum: number;
klarnaOrderId: string;
pwintyId: number;
email: string;
phone: string;
deliveryEmail: string;
deliveryPhone: string;
customerFirstname: string;
customerLastname: string;
customerEmail: string;
customerCellphone: string;
flyerIds: string;
market: string;
locale: string;
billingInformation: ContactInformation;
deliveryInformation: ContactInformation;
billingAddressId: number;
deliveryAddressId: number;
}
export interface OrderRow {
id: number;
artNo: string;
code: string;
commission: number;
commissionAmount: number;
commissionResale: number;
designer: string;
designerId: number;
designerPath: string;
discountType: string;
discountValue: number;
displayHeight: number;
displayWidth: number;
edge: string;
frameColor: string;
framed: number;
group: string;
height: number;
imagedonotprint: number;
imageprocessed: number;
imageprocessingrejected: number;
inserted: Date;
material: string;
measureUnit: string;
mirrored: number;
modifier: string;
name: string;
noShipping: boolean;
order: Order;
orderId: number;
path: string;
price: number;
printId: number;
process: Boolean;
productGroup: string;
productId: number;
pwintyImageId: number;
pwintySku: string;
resolution: number;
status: string;
type: string;
vat: number;
weight: number;
width: number;
x: number;
y: number;
}
+65
View File
@@ -0,0 +1,65 @@
export enum ProductGroup {
PHOTO_WALLPAPER = 1,
CANVAS = 2,
WALLPAPER = 3,
OLD_REMOVED = 4,
DO_IT_YOURSELF_FRAME = 5,
DESIGNER_WALLPAPER = 6,
POSTER = 7,
FRAMED_PRINT = 8,
UNKNOWN = 9,
}
export function getProductGroupStringFromString(group: string): string {
return ProductGroup[getProductGroupFromString(group)];
}
export function getProductGroupFromString(group: string): ProductGroup {
switch (group) {
case 'canvas':
return ProductGroup.CANVAS;
case 'framed-print':
return ProductGroup.FRAMED_PRINT;
case 'photo-wallpaper':
return ProductGroup.PHOTO_WALLPAPER;
case 'poster':
return ProductGroup.POSTER;
case 'wallpaper':
return ProductGroup.WALLPAPER;
case 'design-wallpaper':
return ProductGroup.DESIGNER_WALLPAPER;
case 'doityourselfframe':
return ProductGroup.DO_IT_YOURSELF_FRAME;
default:
return ProductGroup.UNKNOWN;
}
}
export interface ProductBlacklist {
id: number;
groupId: number;
group: ProductGroup;
marketId: String;
inserted: Date;
updated: Date;
}
export interface PrintProduct {
id: number;
groupId: number;
group: ProductGroup;
inserted: Date;
updated?: Date;
}
export interface Product {
id: number;
path: string;
visible: boolean;
browsable: boolean;
inserted: Date;
updated?: Date;
printProducts: [PrintProduct];
blacklisting: [ProductBlacklist];
api1json: JSON;
fields_json: JSON;
}
+16
View File
@@ -0,0 +1,16 @@
export type Maybe<T> = T | undefined;
export interface DateInput {
from: Date;
to: Date;
}
export interface GeneralInput {
dates: DateInput;
limit: number;
offset: number;
}
export interface FilterInput {
filter: GeneralInput;
}