@mivis/petmart-api 1.1.4 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/type.d.ts +281 -63
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mivis/petmart-api",
3
- "version": "1.1.4",
3
+ "version": "1.2.4",
4
4
  "main": "index.js",
5
5
  "types": "type.d.ts",
6
6
  "license": "ISC",
package/type.d.ts CHANGED
@@ -25,39 +25,51 @@ declare namespace Components {
25
25
 
26
26
  export type ISecureAuthResponse = IAuthResponse;
27
27
 
28
+ export enum ERoles {
29
+ ADMIN = 'ADMIN',
30
+ USER = 'USER',
31
+ }
32
+
28
33
  export interface IUser {
29
34
  _id: string;
30
35
  tel: number;
31
36
  name: string;
32
- sex: string;
33
37
  birthday: Date;
34
38
  email: string;
35
- role: 'admin' | 'user';
39
+ role: ERoles;
36
40
  password: string;
37
- createdDate: Date;
41
+ createdAt: Date;
42
+ updatedAt: Date;
38
43
  }
39
44
 
40
45
  export interface IAddress {
41
46
  _id: string;
42
- owner: string;
47
+ user_id: string;
43
48
  address: string;
44
49
  floor: number;
45
50
  intercom: number;
46
51
  entrance: number;
47
52
  index: number;
48
53
  flat: number;
54
+ createdAt: Date;
55
+ updatedAt: Date;
49
56
  }
50
57
 
51
58
  export interface IUpdateUser {
52
59
  name: string;
53
- tel: string;
60
+ tel: number;
54
61
  email: string;
55
- birthday: string;
56
- sex: 'Мужской' | 'Женский';
62
+ birthday?: Date;
63
+ password: string;
64
+ }
65
+
66
+ export enum EUserTransactionsType {
67
+ PURCHASE = 'PURCHASE',
68
+ REFUND = 'REFUND',
57
69
  }
58
70
 
59
71
  export interface ICreateAddress {
60
- userId: string;
72
+ user_id: string;
61
73
  floor: number;
62
74
  intercom: number;
63
75
  entrance: number;
@@ -76,52 +88,85 @@ declare namespace Components {
76
88
  address: string;
77
89
  }
78
90
 
79
- export interface ICompound {
91
+ export enum EUnit {
92
+ T = 'TON',
93
+ KG = 'KG',
94
+ GR = 'GR',
95
+ L = 'LITER',
96
+ ML = 'MILLILITER',
97
+ }
98
+
99
+ export interface IDimension {
100
+ width: number;
101
+ height: number;
102
+ length: number;
103
+ weight: number;
104
+ in_stock: number;
105
+ unit: EUnit;
106
+ }
107
+
108
+ export interface ICharacteristic {
80
109
  name: string;
81
110
  value: string;
82
111
  }
83
112
 
84
113
  export interface IProduct {
85
114
  _id: string;
86
- owner: string;
87
- company: string;
88
- photo: string[];
89
- weight: number[];
90
115
  name: string;
91
- rate: number;
116
+ subCategory_id: string;
117
+ seller_id: string;
118
+ vendor_code: string;
119
+ price: number;
120
+ discount?: number;
121
+ tax: number;
122
+ dimension: IDimension;
123
+ photo: string[];
92
124
  desc: string;
93
- compound: ICompound[];
94
- category: string;
95
- price: number[];
125
+ characteristic: ICharacteristic[];
126
+ purchases_count: number;
127
+ viewed?: number;
128
+ createdAt: Date;
129
+ updatedAt: Date;
96
130
  }
97
131
 
98
- export interface IProductResponseWithCategory {
132
+ export interface IProductResponseWithSubCategory {
99
133
  _id: string;
100
- owner: string;
101
- company: string;
102
- photo: string[];
103
- weight: number[];
104
134
  name: string;
105
- rate: number;
106
- desc: string;
107
- compound: ICompound[];
108
- category: {
135
+ subCategory_id: {
109
136
  _id: string;
110
137
  name: string;
138
+ category_id: {
139
+ _id: string;
140
+ name: string;
141
+ photo: string;
142
+ };
111
143
  };
112
- price: number[];
144
+ seller_id: string;
145
+ vendor_code: string;
146
+ price: number;
147
+ discount?: number;
148
+ tax: number;
149
+ dimension: IDimension;
150
+ photo: string[];
151
+ desc: string;
152
+ characteristic: ICharacteristic[];
153
+ purchases_count: number;
154
+ viewed?: number;
155
+ createdAt: Date;
156
+ updatedAt: Date;
113
157
  }
114
158
 
115
159
  export interface ICreateProduct {
116
- owner: string;
117
- company: string;
118
- photo: File;
119
- weight: number[];
120
160
  name: string;
161
+ seller_id: string;
162
+ subCategory_id: string;
163
+ vendor_code: string;
164
+ price: number;
165
+ tax: number;
166
+ dimension: IDimension;
167
+ photo: File | File[];
121
168
  desc: string;
122
- compound: ICompound[];
123
- category: string;
124
- price: number[];
169
+ characteristic: ICharacteristic[];
125
170
  }
126
171
 
127
172
  export interface IUpdateProduct extends ICreateProduct {
@@ -129,69 +174,242 @@ declare namespace Components {
129
174
  }
130
175
 
131
176
  export interface ICreateCart {
132
- product: string;
133
- variation: IVariation;
177
+ product_id: string;
134
178
  count: number;
135
- }
136
-
137
- export interface IVariation {
138
- weight: number;
139
179
  price: number;
140
180
  }
181
+
141
182
  export interface ICart {
142
183
  _id: string;
143
- owner?: string;
144
- product: {
184
+ user_id: string;
185
+ product_id: {
145
186
  _id: string;
146
187
  name: string;
147
188
  photo: string[];
148
189
  };
149
190
  count: number;
150
- variation: IVariation;
191
+ price: number;
192
+ createdAt: Date;
193
+ updatedAt: Date;
151
194
  }
152
195
 
153
196
  export interface ICategory {
154
197
  _id: string;
155
198
  name: string;
156
199
  photo: string;
200
+ createdAt: Date;
201
+ updatedAt: Date;
157
202
  }
158
203
 
159
204
  export interface ICreateCategory {
160
205
  name: string;
161
- photo: File;
206
+ photo?: File;
162
207
  }
163
208
 
164
209
  export interface IUpdateCategory extends ICreateCategory {
165
210
  id: string;
166
211
  }
167
212
 
168
- export interface IOrderItem {
169
- product: string;
170
- count: number;
171
- weight: number;
213
+ export interface ISubCategory {
214
+ _id: string;
215
+ name: string;
216
+ category_id: {
217
+ _id: string;
218
+ name: string;
219
+ photo: string;
220
+ };
221
+ createdAt: Date;
222
+ updatedAt: Date;
172
223
  }
173
224
 
174
- export type OrderAddress = Omit<IAddress, 'owner'>;
225
+ export interface ICreateSubCategory {
226
+ name: string;
227
+ category_id: string;
228
+ }
175
229
 
176
- export interface ICreateOrder {
177
- orderItems: IOrderItem[];
178
- price: number;
230
+ export interface IUpdateSubCategory {
231
+ id: string;
232
+ name: string;
233
+ category_id: string;
234
+ }
235
+
236
+ export interface IBankingDetails {
237
+ name: string;
238
+ INN: number;
239
+ BIK: number;
240
+ KPP: number;
241
+ PC: number;
242
+ KC: number;
243
+ legal_address: string;
244
+ }
245
+
246
+ export interface IShopDetails {
247
+ shop_name: string;
248
+ logo: string;
249
+ banner: string;
250
+ desc: string;
251
+ }
252
+
253
+ export interface IDeliveryWays {
254
+ pickup: boolean;
255
+ own_delivery: boolean;
256
+ delivery_to_point: boolean;
257
+ courier: boolean;
258
+ }
259
+
260
+ export interface ISeller {
261
+ _id: string;
262
+ user_id: {
263
+ _id: string;
264
+ tel: number;
265
+ name: string;
266
+ email: string;
267
+ };
268
+ banking_details: IBankingDetails;
269
+ shop_details: IShopDetails;
270
+ delivery_ways: IDeliveryWays;
271
+ balance: number;
272
+ commission: number;
273
+ createdAt: Date;
274
+ updatedAt: Date;
275
+ }
276
+
277
+ export interface ICreateSeller {
278
+ user_id: string;
279
+ banking_details?: IBankingDetails;
280
+ shop_details?: IShopDetails;
281
+ delivery_ways?: IDeliveryWays;
282
+ }
283
+
284
+ export interface IUpdateSeller {
285
+ id: string;
286
+ banking_details?: IBankingDetails;
287
+ shop_details?: IShopDetails;
288
+ delivery_ways?: IDeliveryWays;
289
+ commission?: number;
290
+ }
291
+
292
+ export type TUser_Data = Pick<IUser, 'email' | 'name' | 'tel' | 'password'>;
293
+
294
+ export interface IUpdateSeller {
295
+ id: string;
296
+ user_data?: TUser_Data;
297
+ banking_details?: IBankingDetails;
298
+ shop_details?: IShopDetails;
299
+ delivery_ways?: IDeliveryWays;
300
+ }
301
+
302
+ export type OrderAddress = Omit<IAddress, 'user_id'>;
303
+
304
+ export enum EDeliveryType {
305
+ PICKUP = 'PICKUP',
306
+ OWN_DELIVERY = 'OWN_DELIVERY',
307
+ DELIVERY_TO_POINT = 'DELIVERY_TO_POINT',
308
+ COURIER = 'COURIER',
309
+ }
310
+
311
+ export enum EOrderStatus {
312
+ DELIVERED = 'DELIVERED',
313
+ }
314
+
315
+ export interface IDeliveryInfo {
316
+ tracking: string;
317
+ invoice: string;
179
318
  address: OrderAddress;
319
+ tel: number;
180
320
  name: string;
181
- tel: string;
182
- user?: string;
183
321
  }
184
322
 
185
- export interface IOrder {
186
- user: string;
187
- orderItems: IOrderItem[];
188
- date: Date;
323
+ export interface ICreateOrder {
324
+ product_order: IProductOrder[];
325
+ delivery_type: EDeliveryType;
326
+ delivery_info: IDeliveryInfo;
327
+ }
328
+
329
+ export interface IProductOrder {
330
+ product_id: string;
331
+ count: number;
189
332
  price: number;
190
- owner: string;
191
- tel: number;
192
- address: IAddress;
193
- status: number;
194
- orderNumber: number;
333
+ }
334
+
335
+ export interface IOrder {
336
+ _id: string;
337
+ sum: number;
338
+ product_order: IProductOrder[];
339
+ status: EOrderStatus;
340
+ delivery_type: EDeliveryType;
341
+ preparation_date: Date;
342
+ multiOrder_id: string;
343
+ delivery_info: IDeliveryInfo;
344
+ note: string;
345
+ createdAt: Date;
346
+ updatedAt: Date;
347
+ }
348
+
349
+ export enum EComplaintsReason {
350
+ INADEQUATE_PRICING = 'INADEQUATE_PRICING',
351
+ DAMAGED_GOODS = 'DAMAGED_GOODS',
352
+ POOR_QUALITY = 'POOR_QUALITY',
353
+ FRAUD = 'FRAUD',
354
+ OTHER = 'OTHER',
355
+ }
356
+
357
+ export interface IComplaints {
358
+ _id: string;
359
+ user_id: string;
360
+ product_id: string;
361
+ text?: string;
362
+ reason: EComplaintsReason;
363
+ }
364
+
365
+ export interface ICreateComplaints {
366
+ product_id: string;
367
+ text?: string;
368
+ reason: EComplaintsReason;
369
+ }
370
+
371
+ export interface IMultiOrder {
372
+ _id: string;
373
+ user_id: string;
374
+ sum: number;
375
+ order_number: number;
376
+ }
377
+
378
+ export interface IReview {
379
+ _id: string;
380
+ user_id: string;
381
+ product_id: string;
382
+ rating: number;
383
+ text: string;
384
+ anonymity: boolean;
385
+ }
386
+
387
+ export interface ICreateReview {
388
+ product_id: string;
389
+ rating: number;
390
+ text: string;
391
+ anonymity: boolean;
392
+ }
393
+
394
+ export enum ESellerTransactionsType {
395
+ SALE = 'SALE',
396
+ FINE = 'FINE',
397
+ WITHDRAW = 'WITHDRAW',
398
+ }
399
+
400
+ export interface ISellerTransactions {
401
+ _id: string;
402
+ type: ESellerTransactionsType;
403
+ sum: number;
404
+ admin_id: string;
405
+ multiOrder_id: string;
406
+ comment?: string;
407
+ }
408
+
409
+ export interface ICreateSellerTransactions {
410
+ type: ESellerTransactionsType;
411
+ sum: number;
412
+ comment?: string;
195
413
  }
196
414
  }
197
415
  }