@mivis/petmart-api 1.1.3 → 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 -69
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mivis/petmart-api",
3
- "version": "1.1.3",
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,45 +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
- photo: string;
32
36
  name: string;
33
- sex: string;
34
37
  birthday: Date;
35
- desc: string;
36
- country: string;
37
38
  email: string;
38
- role: 'admin' | 'user';
39
+ role: ERoles;
39
40
  password: string;
40
- createdDate: Date;
41
+ createdAt: Date;
42
+ updatedAt: Date;
41
43
  }
42
44
 
43
45
  export interface IAddress {
44
46
  _id: string;
45
- owner: string;
47
+ user_id: string;
46
48
  address: string;
47
49
  floor: number;
48
50
  intercom: number;
49
51
  entrance: number;
50
52
  index: number;
51
53
  flat: number;
54
+ createdAt: Date;
55
+ updatedAt: Date;
52
56
  }
53
57
 
54
58
  export interface IUpdateUser {
55
59
  name: string;
56
- desc: string;
57
- tel: string;
58
- photo: string;
60
+ tel: number;
59
61
  email: string;
60
- birthday: string;
61
- country: string;
62
- sex: 'Мужской' | 'Женский';
62
+ birthday?: Date;
63
+ password: string;
64
+ }
65
+
66
+ export enum EUserTransactionsType {
67
+ PURCHASE = 'PURCHASE',
68
+ REFUND = 'REFUND',
63
69
  }
64
70
 
65
71
  export interface ICreateAddress {
66
- userId: string;
72
+ user_id: string;
67
73
  floor: number;
68
74
  intercom: number;
69
75
  entrance: number;
@@ -82,52 +88,85 @@ declare namespace Components {
82
88
  address: string;
83
89
  }
84
90
 
85
- 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 {
86
109
  name: string;
87
110
  value: string;
88
111
  }
89
112
 
90
113
  export interface IProduct {
91
114
  _id: string;
92
- owner: string;
93
- company: string;
94
- photo: string[];
95
- weight: number[];
96
115
  name: string;
97
- 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[];
98
124
  desc: string;
99
- compound: ICompound[];
100
- category: string;
101
- price: number[];
125
+ characteristic: ICharacteristic[];
126
+ purchases_count: number;
127
+ viewed?: number;
128
+ createdAt: Date;
129
+ updatedAt: Date;
102
130
  }
103
131
 
104
- export interface IProductResponseWithCategory {
132
+ export interface IProductResponseWithSubCategory {
105
133
  _id: string;
106
- owner: string;
107
- company: string;
108
- photo: string[];
109
- weight: number[];
110
134
  name: string;
111
- rate: number;
112
- desc: string;
113
- compound: ICompound[];
114
- category: {
135
+ subCategory_id: {
115
136
  _id: string;
116
137
  name: string;
138
+ category_id: {
139
+ _id: string;
140
+ name: string;
141
+ photo: string;
142
+ };
117
143
  };
118
- 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;
119
157
  }
120
158
 
121
159
  export interface ICreateProduct {
122
- owner: string;
123
- company: string;
124
- photo: File;
125
- weight: number[];
126
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[];
127
168
  desc: string;
128
- compound: ICompound[];
129
- category: string;
130
- price: number[];
169
+ characteristic: ICharacteristic[];
131
170
  }
132
171
 
133
172
  export interface IUpdateProduct extends ICreateProduct {
@@ -135,69 +174,242 @@ declare namespace Components {
135
174
  }
136
175
 
137
176
  export interface ICreateCart {
138
- product: string;
139
- variation: IVariation;
177
+ product_id: string;
140
178
  count: number;
141
- }
142
-
143
- export interface IVariation {
144
- weight: number;
145
179
  price: number;
146
180
  }
181
+
147
182
  export interface ICart {
148
183
  _id: string;
149
- owner?: string;
150
- product: {
184
+ user_id: string;
185
+ product_id: {
151
186
  _id: string;
152
187
  name: string;
153
188
  photo: string[];
154
189
  };
155
190
  count: number;
156
- variation: IVariation;
191
+ price: number;
192
+ createdAt: Date;
193
+ updatedAt: Date;
157
194
  }
158
195
 
159
196
  export interface ICategory {
160
197
  _id: string;
161
198
  name: string;
162
199
  photo: string;
200
+ createdAt: Date;
201
+ updatedAt: Date;
163
202
  }
164
203
 
165
204
  export interface ICreateCategory {
166
205
  name: string;
167
- photo: File;
206
+ photo?: File;
168
207
  }
169
208
 
170
209
  export interface IUpdateCategory extends ICreateCategory {
171
210
  id: string;
172
211
  }
173
212
 
174
- export interface IOrderItem {
175
- product: string;
176
- count: number;
177
- 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;
178
223
  }
179
224
 
180
- export type OrderAddress = Omit<IAddress, 'owner'>;
225
+ export interface ICreateSubCategory {
226
+ name: string;
227
+ category_id: string;
228
+ }
181
229
 
182
- export interface ICreateOrder {
183
- orderItems: IOrderItem[];
184
- 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;
185
318
  address: OrderAddress;
319
+ tel: number;
186
320
  name: string;
187
- tel: string;
188
- user?: string;
189
321
  }
190
322
 
191
- export interface IOrder {
192
- user: string;
193
- orderItems: IOrderItem[];
194
- 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;
195
332
  price: number;
196
- owner: string;
197
- tel: number;
198
- address: IAddress;
199
- status: number;
200
- 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;
201
413
  }
202
414
  }
203
415
  }