-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpayload-types.ts
216 lines (205 loc) · 4.87 KB
/
payload-types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
export interface Media {
id: string;
alt: string;
caption?:
| {
[k: string]: unknown;
}[]
| null;
updatedAt: Date;
createdAt: Date;
url?: string | null;
thumbnailURL?: string | null;
filename?: string | null;
mimeType?: string | null;
filesize?: number | null;
width?: number | null;
height?: number | null;
}
export type CartItems =
| {
product: Product
quantity: number
id: string
}[]
| null
export interface User {
id: string;
name: string | null;
roles?: ('admin' | 'customer')[] | null;
avatar?: Media | null;
stripeCustomerId?: string | null;
stripeSubscriptionId?: string | null;
stripeCurrentPeriodEnd?: Date | null;
skipSync?: boolean | null;
updatedAt: Date;
createdAt: Date;
email: string;
resetPasswordToken?: string | null;
resetPasswordExpiration?: string | null;
salt?: string | null;
hash?: string | null;
password: string | null;
phone?: string | null;
// paymentMethods?: {
// id: string;
// type: string;
// card: {
// brand: string;
// last4: string;
// exp_month: number;
// exp_year: number;
// };
// }[];
groupAddress?: {
streetLine1: string;
streetLine2?: string | null;
city: string;
zip: string;
country: string;
state: string | null;
},
groupAddressShipping?: {
streetLine1: string;
streetLine2?: string | null;
city: string;
zip: string;
country: string;
state: string | null;
name: string;
phone: string;
};
cart?: {
items?: CartItems
};
purchases?: (string | Product)[] | null;
}
export type SubscriptionPlan = {
name: string
description: string
stripePriceId: string
}
export type UserSubscriptionPlan = SubscriptionPlan &
Pick<User, "stripeCustomerId" | "stripeSubscriptionId"> & {
stripeCurrentPeriodEnd: number
isPro: boolean
}
export interface Category {
id: string;
title: string;
description: string;
parent?: (string | null) | Category;
breadcrumbs?:
| {
doc?: (string | null) | Category;
url?: string | null;
label?: string | null;
id?: string | null;
}[]
| null;
updatedAt: Date;
createdAt: Date;
}
export interface Producer {
id: string;
title: string;
parent?: Producer;
}
export type SpecificationType =
"height" |
"width" |
"depth" |
"weight" |
"manufacturerCode" |
"accessories" |
"additionalInfo" |
"software" |
"processor" |
"ram" |
"graphicsCard" |
"operatingSystem" |
"warranty" |
"screenType" |
"screenSize" |
"resolution" |
"touchscreen" |
"color" |
"connectivity" |
"ports" |
"ssd_m2" |
"sensors" |
"security" |
"powerSupply"
export interface Product {
id: string;
title: string;
publishedOn?: string | null;
description?: string | null;
image?: Media | null;
slider?: { id: string; image: Media }[];
stripeProductID?: string | null;
priceJSON?: string | null;
price: number;
producer: Producer;
categories?: (Category)[];
relatedProducts?: (string | Product)[] | null;
slug?: string | null;
skipSync?: boolean | null;
meta?: {
title?: string | null;
description?: string | null;
image?: string | Media | null;
};
updatedAt: Date;
createdAt: Date;
countOfOrders: number;
specification?: {
id: string;
type: SpecificationType;
value: string;
}[];
stock: number;
_status?: ('draft' | 'published') | null;
}
export interface ShippingMethod {
id: string;
title: string;
price: number;
logo: Media;
deliveryDaysTime: number;
trackingUrl?: string | null;
freeFrom?: number | null;
type: ('courier' | 'parcel_locker' | 'pickup');
paymentType: ('cash_on_delivery' | 'prepayment');
}
export interface Order {
id: string
orderedBy?: (string | null) | User
stripePaymentIntentID?: string | null
total: number
status: ('created' | 'paid' | 'shipped' | 'processing' | 'delivered' | 'canceled')
trackingNumber?: string | null
trackingUrl?: string | null
items?:
| {
product: string | Product
price?: number | null
quantity?: number | null
id?: string | null
}[]
| null
updatedAt: Date
createdAt: Date
shippingMethod?: (string | null) | ShippingMethod
}
export interface NotificationType {
id: string
title: string
message: any
message_html: string
type: ('info' | 'warning' | 'error')
read: boolean
user: User
createdAt: Date
updatedAt: Date
}