@mivis/petmart-api 1.1.4 → 1.2.5

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