@mivis/petmart-api 1.2.248 → 1.2.250

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 (3) hide show
  1. package/index.js +1 -1
  2. package/package.json +11 -11
  3. package/type.d.ts +2300 -2298
package/type.d.ts CHANGED
@@ -1,2298 +1,2300 @@
1
- declare namespace Components {
2
- namespace Schemas {
3
- export interface FilterBaseQuery {
4
- skip: string;
5
- limit: string;
6
- }
7
- export interface ITokensResponse {
8
- access_token: string;
9
- refresh_token: string;
10
- }
11
- export interface ILoginRequest {
12
- email: string;
13
- password: string;
14
- type: ELoginTypes;
15
- }
16
- export interface ISignUpRequest {
17
- email: string;
18
- password: string;
19
- }
20
- export interface ILoginResponse extends ITokensResponse {
21
- isSeller: boolean;
22
- user_id: string;
23
- isActivated: boolean;
24
- isExistPassword: boolean;
25
- role: ERoles;
26
- }
27
-
28
- export type ISignUpResponse = ITokensResponse;
29
-
30
- export interface IRecoveryRequest {
31
- email: string;
32
- password: string;
33
- }
34
-
35
- export interface IRecoveryResponse {
36
- message: string;
37
- }
38
-
39
- export interface IActivationRequest {
40
- email: string;
41
- activation_code: number;
42
- }
43
-
44
- export interface IActivationResponse {
45
- message: string;
46
- }
47
-
48
- export interface IRefreshRequest {
49
- refreshToken: string;
50
- }
51
-
52
- export type IRefreshResponse = ITokensResponse & { is_activated: boolean };
53
-
54
- export enum ELoginTypes {
55
- SELLER = 'SELLER',
56
- USER = 'USER',
57
- WEB = 'WEB',
58
- }
59
-
60
- export interface ISendEmailRequest {
61
- email: string;
62
- }
63
-
64
- export interface ISendEmailResponse {
65
- message: string;
66
- }
67
-
68
- export interface ISignUpGoogleRequest {
69
- access_token: string;
70
- auth_type: ELoginTypes;
71
- }
72
-
73
- export type ISignUpGoogleResponse = ILoginResponse;
74
-
75
- export interface ISignUpAppleRequest {
76
- code: string;
77
- auth_type: ELoginTypes;
78
- }
79
-
80
- export type ISignUpAppleResponse = ILoginResponse;
81
-
82
- export interface ISignUpVkRequest {
83
- silent_token: string;
84
- uuid: string;
85
- auth_type: ELoginTypes;
86
- }
87
-
88
- export type ISignUpVkResponse = ILoginResponse;
89
-
90
- export enum ERoles {
91
- ADMIN = 'ADMIN',
92
- USER = 'USER',
93
- }
94
-
95
- export interface IActionsProductRequest {
96
- toDelete: string;
97
- toPublish: string;
98
- toCopy: string;
99
- toDraft: string;
100
- toReject: string;
101
- }
102
-
103
- export enum EActions {
104
- DELETE = 'toDelete',
105
- PUBLISH = 'toPublish',
106
- COPY = 'toCopy',
107
- DRAFT = 'toDraft',
108
- REJECT = 'toReject',
109
- }
110
-
111
- export interface IActionsProductResponse {
112
- message: string;
113
- }
114
-
115
- export interface IUser {
116
- _id: string;
117
- tel?: number;
118
- name?: string;
119
- surname?: string;
120
- patronymic?: string;
121
- full_name?: string;
122
- birthday?: Date;
123
- email?: string;
124
- role: ERoles;
125
- vk_id?: number;
126
- expo_push_token?: string;
127
- number: number;
128
- is_activated: boolean;
129
- createdAt: Date;
130
- updatedAt: Date;
131
- }
132
-
133
- export interface IShortUser {
134
- _id: string;
135
- tel?: number;
136
- name?: string;
137
- surname?: string;
138
- patronymic?: string;
139
- full_name?: string;
140
- birthday?: Date;
141
- email?: string;
142
- number: number;
143
- }
144
-
145
- export interface IAdminUserQueryResponse {
146
- users: IShortUser[];
147
- count: number;
148
- }
149
-
150
- export interface IAdminUsersQueryRequest extends FilterBaseQuery {
151
- tel?: string;
152
- full_name?: string;
153
- email?: string;
154
- number?: string;
155
- all_fields?: string;
156
- }
157
-
158
- export interface IAdminCreateUser {
159
- name: string;
160
- surname: string;
161
- patronymic?: string;
162
- email: string;
163
- tel: number;
164
- password: string;
165
- }
166
-
167
- export interface IAdminUpdateUser {
168
- _id: string;
169
- name: string;
170
- surname: string;
171
- patronymic?: string;
172
- tel: number;
173
- email: string;
174
- }
175
-
176
- export interface IActionsUsersRequest {
177
- toDelete: string;
178
- }
179
-
180
- export interface IAddress {
181
- _id: string;
182
- address: string;
183
- floor: number;
184
- intercom?: string;
185
- entrance: number;
186
- index?: number;
187
- flat: number;
188
- createdAt: Date;
189
- updatedAt: Date;
190
- }
191
-
192
- export interface IUserAddress extends IAddress {
193
- user_id: string;
194
- }
195
-
196
- export interface IUpdateUser {
197
- name: string;
198
- surname: string;
199
- patronymic?: string;
200
- tel: number;
201
- email: string;
202
- birthday?: Date;
203
- password?: string;
204
- expo_push_token?: string;
205
- }
206
-
207
- export enum EUserTransactionsType {
208
- PURCHASE = 'PURCHASE',
209
- REFUND = 'REFUND',
210
- }
211
-
212
- export interface ICreateAddress {
213
- user_id: string;
214
- floor: number;
215
- intercom: string;
216
- entrance: number;
217
- index: number;
218
- flat: number;
219
- address: string;
220
- }
221
-
222
- export interface IUpdateAddress {
223
- id: string;
224
- floor: number;
225
- intercom: string;
226
- entrance: number;
227
- index: number;
228
- flat: number;
229
- address: string;
230
- }
231
-
232
- export enum EUnit {
233
- KG = 'KG',
234
- GR = 'GR',
235
- }
236
-
237
- export interface IDimension {
238
- width: number;
239
- height: number;
240
- length: number;
241
- weight: number;
242
- in_stock: number;
243
- unit: EUnit;
244
- }
245
-
246
- export interface ICharacteristic {
247
- name: string;
248
- value: string;
249
- }
250
-
251
- export enum EProductType {
252
- PRODUCT = 'PRODUCT',
253
- VARIATION = 'VARIATION',
254
- }
255
-
256
- export interface IProduct {
257
- _id: string;
258
- type: EProductType;
259
- parent_id?: string | null; // Ссылка на родителя (исключительно для вариаций)
260
- name: string;
261
- status: EProductStatus; // Для вариаций статус всегда PUBLISHED
262
- subCategory_id: string;
263
- category_id: string;
264
- seller_id: string;
265
- vendor_code: string;
266
- price: number;
267
- discount?: number;
268
- tax: number;
269
- dimension: IDimension;
270
- photo: string[];
271
- desc: string;
272
- characteristic: ICharacteristic[];
273
- external_item_id: string | null;
274
- variations?: IProduct[];
275
- purchases_count: number;
276
- number: number;
277
- slug: string;
278
- published_at?: Date;
279
- entityAnalytics?: IEntityAnalytics;
280
- createdAt: Date;
281
- updatedAt: Date;
282
- }
283
-
284
- export interface IProductQueryRequest extends FilterBaseQuery {
285
- category_id?: string;
286
- subCategory_id?: string;
287
- seller_id?: string;
288
- name?: string;
289
- status?: EProductStatus;
290
- all_fields?: string;
291
- type?: EProductType;
292
- isHaveParent?: boolean;
293
- excludeProductId?: string;
294
- }
295
-
296
- export interface IUserProductQueryRequest extends FilterBaseQuery {
297
- user_id?: string;
298
- category_id?: string;
299
- subCategory_id?: string;
300
- seller_id?: string;
301
- name?: string;
302
- priceMin?: string;
303
- priceMax?: string;
304
- colors?: string;
305
- brands?: string;
306
- sizes?: string;
307
- materials?: string;
308
- sortBy?: EProductsSortOptions;
309
- }
310
-
311
- export interface IProductQueryResponse {
312
- products: IProductDraftResponse[];
313
- count: number;
314
- }
315
-
316
- export interface IUserProductQueryResponse {
317
- products: IProductResponse[];
318
- subCategories: ISubCategory[];
319
- }
320
-
321
- export enum EProductStatus {
322
- DRAFT = 'DRAFT',
323
- MODERATION = 'MODERATION',
324
- PUBLISHED = 'PUBLISHED',
325
- REJECTED = 'REJECTED',
326
- ARCHIVED = 'ARCHIVED',
327
- }
328
-
329
- export interface IProductResponse {
330
- _id: string;
331
- name: string;
332
- type: EProductType;
333
- parent_id?: string | null;
334
- status: EProductStatus;
335
- subCategory_id: {
336
- _id: string;
337
- name: string;
338
- category_id: string;
339
- slug: string;
340
- };
341
- category_id: {
342
- _id: string;
343
- photo: string;
344
- name: string;
345
- slug: string;
346
- };
347
- seller_id?: {
348
- _id: string;
349
- shop_details: IShopDetails;
350
- delivery_ways: IDeliveryWays;
351
- slug: string;
352
- };
353
- vendor_code: string;
354
- price: number;
355
- discount?: number;
356
- tax: number;
357
- dimension: IDimension;
358
- photo: string[];
359
- desc: string;
360
- characteristic: ICharacteristic[];
361
- variations?: IProduct[];
362
- purchases_count: number;
363
- number: number;
364
- slug: string;
365
- createdAt: Date;
366
- updatedAt: Date;
367
- is_favorite?: boolean;
368
- reviewsData?: IReviewsData;
369
- published_at?: Date;
370
- entityAnalytics?: IEntityAnalytics;
371
- }
372
-
373
- type OptionalDimension = {
374
- width?: number;
375
- height?: number;
376
- length?: number;
377
- weight?: number;
378
- in_stock: number;
379
- unit?: EUnit;
380
- };
381
-
382
- type TOptionalProperties = Pick<
383
- IProductResponse,
384
- | 'category_id'
385
- | 'subCategory_id'
386
- | 'vendor_code'
387
- | 'desc'
388
- | 'characteristic'
389
- | 'tax'
390
- | 'photo'
391
- | 'price'
392
- > & {
393
- dimension?: OptionalDimension;
394
- };
395
-
396
- type TRemainingProductResponseProperties = Omit<
397
- IProductResponse,
398
- keyof TOptionalProperties
399
- >;
400
-
401
- export interface IProductDraftResponse
402
- extends TRemainingProductResponseProperties,
403
- Partial<TOptionalProperties> {}
404
-
405
- export interface IProductWithReviewResponse {
406
- product: IProductResponse;
407
- reviewsData: IReviewsData;
408
- }
409
-
410
- export interface IAddVariation {
411
- _id: string;
412
- characteristic: ICharacteristic[];
413
- }
414
-
415
- export interface ICreateProduct {
416
- name: string;
417
- status?:
418
- | EProductStatus.DRAFT
419
- | EProductStatus.PUBLISHED
420
- | EProductStatus.REJECTED;
421
- category_id: string;
422
- subCategory_id: string;
423
- vendor_code: string;
424
- price: number;
425
- tax: number;
426
- dimension: IDimension;
427
- photo: File[];
428
- desc: string;
429
- characteristic?: ICharacteristic[];
430
- variations?: IAddVariation[];
431
- }
432
-
433
- export interface ICreateVariation
434
- extends Omit<
435
- ICreateProduct,
436
- | 'status'
437
- | 'category_id'
438
- | 'subCategory_id'
439
- | 'variations'
440
- | 'photo'
441
- | 'desc'
442
- | 'characteristic'
443
- > {
444
- photo?: File[];
445
- desc?: string;
446
- seller_id: string;
447
- }
448
-
449
- export interface IUpdateProduct extends ICreateProduct {
450
- id: string;
451
- type?: EProductType;
452
- toDeletePhotos?: string[];
453
- toDeleteVariations?: string[];
454
- }
455
-
456
- export interface ICreateCart {
457
- product_id: string;
458
- count: number;
459
- price: number;
460
- }
461
-
462
- export interface IDeleteCartRequest {
463
- toDelete?: string;
464
- }
465
-
466
- export interface ICart {
467
- _id: string;
468
- user_id?: string | null;
469
- session_id?: string | null;
470
- product_id: {
471
- _id: string;
472
- name: string;
473
- photo: string[];
474
- dimension: IDimension;
475
- price: number;
476
- slug: string;
477
- category_id: {
478
- _id: string;
479
- name: string;
480
- slug: string;
481
- };
482
- subCategory_id: {
483
- _id: string;
484
- name: string;
485
- slug: string;
486
- };
487
- seller_id: {
488
- _id: string;
489
- shop_details: IShopDetails;
490
- delivery_ways: IDeliveryWays;
491
- shops_info: IShop[];
492
- slug: string;
493
- };
494
- };
495
- count: number;
496
- price: number;
497
- createdAt: Date;
498
- updatedAt: Date;
499
- }
500
-
501
- export interface ICreateCartResponse {
502
- message?: string;
503
- cartItem: ICart;
504
- }
505
-
506
- export interface ISetCartItemCountRequest {
507
- count: number;
508
- }
509
-
510
- export interface ICategory {
511
- _id: string;
512
- name: string;
513
- seoInfo?: ISeoInfo;
514
- photo: string;
515
- slug: string;
516
- createdAt: Date;
517
- updatedAt: Date;
518
- }
519
-
520
- export interface ISeoInfo {
521
- title?: string;
522
- desc?: string;
523
- h1?: string;
524
- seoText?: string;
525
- }
526
-
527
- export interface IAdminCategoryQueryRequest {
528
- name?: string;
529
- parsed: string;
530
- }
531
-
532
- export interface IGetCategoryQuery extends FilterBaseQuery {
533
- parsed?: string;
534
- }
535
-
536
- export interface IParsedCategory {
537
- value: string;
538
- title: string;
539
- type: string;
540
- photo: string;
541
- seoInfo?: ISeoInfo;
542
- slug: string;
543
- updatedAt: Date;
544
- children: IParsedSubCategory[];
545
- }
546
-
547
- export interface IParsedSubCategory {
548
- value: string;
549
- title: string;
550
- type: string;
551
- seoInfo?: ISeoInfo;
552
- slug: string;
553
- updatedAt: Date;
554
- status: ESubCategoryStatus;
555
- }
556
-
557
- export type ICategoryQueryResponse = ICategory[] | IParsedCategory[];
558
-
559
- export interface ICreateCategoryRequest {
560
- name: string;
561
- title?: string;
562
- desc?: string;
563
- h1?: string;
564
- seoText?: string;
565
- photo: File;
566
- }
567
-
568
- export interface IUpdateCategoryRequest
569
- extends Partial<ICreateCategoryRequest> {
570
- toDeletePhoto?: string;
571
- }
572
-
573
- export interface ISubCategory {
574
- _id: string;
575
- name: string;
576
- category_id: ICategory;
577
- status: ESubCategoryStatus;
578
- seoInfo?: ISeoInfo;
579
- slug: string;
580
- createdAt: Date;
581
- updatedAt: Date;
582
- }
583
-
584
- export interface IUserSubCategoryResponse {
585
- subCategories: ISubCategory[];
586
- productsCount: number;
587
- }
588
-
589
- export interface ICreateSubCategoryRequest {
590
- name: string;
591
- category_id: string;
592
- title?: string;
593
- desc?: string;
594
- h1?: string;
595
- seoText?: string;
596
- }
597
-
598
- export interface IUpdateSubCategoryRequest
599
- extends Partial<ICreateSubCategoryRequest> {}
600
-
601
- export enum ESubCategoryStatus {
602
- MODERATION = 'MODERATION',
603
- ACTIVE = 'ACTIVE',
604
- ARCHIVED = 'ARCHIVED',
605
- }
606
-
607
- export interface IBankingDetails {
608
- name: string;
609
- INN: string;
610
- BIK: string;
611
- KPP: string;
612
- PC: string;
613
- KC: string;
614
- legal_address: string;
615
- }
616
-
617
- export type ILegalBankingDetails = Omit<
618
- IBankingDetails,
619
- 'KPP' | 'legal_address'
620
- >;
621
- export type IPhysicalBankingDetails = Partial<
622
- Omit<IBankingDetails, 'legal_address'>
623
- > & { INN: string };
624
-
625
- export interface IShopDetails {
626
- shop_name: string;
627
- logo: string;
628
- banner: string;
629
- desc: string;
630
- }
631
-
632
- export interface IDeliveryWays {
633
- pickup: boolean;
634
- // own_delivery: boolean; // Появится в ближайшем будущем
635
- delivery_to_point: boolean;
636
- courier: boolean;
637
- yandex_express: boolean;
638
- }
639
-
640
- export enum ESellerStatus {
641
- WAITING_APPROVE = 'WAITING_APPROVE',
642
- APPROVED = 'APPROVED',
643
- DECLINED = 'DECLINED',
644
- ARCHIVED = 'ARCHIVED',
645
- }
646
-
647
- export interface IUserSellerStatusResponse {
648
- status: ESellerStatus | 'NOT_CREATED';
649
- }
650
-
651
- export interface IBalanceInfo {
652
- balance: number;
653
- total_turnover: number;
654
- withdrawn: number;
655
- }
656
-
657
- export interface IShopAddress {
658
- name: string;
659
- lat: number;
660
- lng: number;
661
- }
662
-
663
- export interface IShopWorkTime {
664
- time: string;
665
- }
666
-
667
- export interface IShop {
668
- _id: string;
669
- name: string;
670
- address: IShopAddress;
671
- nearest_metro_station: string;
672
- work_time?: IShopWorkTime[];
673
- createdAt: Date;
674
- updatedAt: Date;
675
- }
676
-
677
- export interface INearestPointOfCdek {
678
- code: string;
679
- name: string;
680
- location: {
681
- country_code: string;
682
- region_code: number;
683
- region: string;
684
- city_code: number;
685
- city: string;
686
- postal_code: string;
687
- longitude: number;
688
- latitude: number;
689
- address: string;
690
- address_full: string;
691
- };
692
- }
693
-
694
- export interface IMoySklad {
695
- account_id: string | null;
696
- api_token: string | null;
697
- }
698
-
699
- export interface ISeller {
700
- _id: string;
701
- type: ESellerTypes;
702
- user_id: {
703
- _id: string;
704
- tel: number;
705
- name: string;
706
- surname: string;
707
- full_name: string;
708
- patronymic?: string;
709
- email: string;
710
- birthday: Date;
711
- };
712
- shops_info: IShop[];
713
- nearest_point_of_cdek: INearestPointOfCdek;
714
- banking_details: IBankingDetails;
715
- additional_info?: ISellerAdditionalInfo;
716
- company_info?: ISellerCompanyInfo;
717
- shop_details: IShopDetails;
718
- delivery_ways: IDeliveryWays;
719
- balance_info: IBalanceInfo;
720
- moy_sklad?: IMoySklad;
721
- commission: number;
722
- status: ESellerStatus;
723
- telegram_message_id: number | null;
724
- api_token: string | null;
725
- slug: string;
726
- telegram_chat_id: number | null;
727
- telegram_api_token: string;
728
- number: number;
729
- createdAt: Date;
730
- updatedAt: Date;
731
- }
732
-
733
- export interface ISellerShowcaseResponse {
734
- purchasesCount: number;
735
- averageRating: string;
736
- reviewsCount: number;
737
- seller: ISeller;
738
- }
739
-
740
- export interface ISellerSearchQueryRequest {
741
- name?: string;
742
- }
743
-
744
- export interface IAdminSellersQueryRequest extends FilterBaseQuery {
745
- number?: string;
746
- status?: string;
747
- full_name?: string;
748
- shop_name?: string;
749
- tel?: string;
750
- all_fields?: string;
751
- }
752
-
753
- export interface IAdminSellersQueryResponse {
754
- sellers: ISeller[];
755
- count: number;
756
- }
757
-
758
- export interface ISellerInfo {
759
- name: string;
760
- surname: string;
761
- patronymic?: string;
762
- email: string;
763
- tel: number;
764
- type: ESellerTypes;
765
- opt_otch: boolean;
766
- birthday?: string;
767
- }
768
-
769
- export interface ICreateSellerInfo extends ISellerInfo {
770
- password: string;
771
- }
772
-
773
- export type ICreateShopDetails = Omit<IShopDetails, 'logo' | 'banner'>;
774
-
775
- export interface IAdminCreateSellerRequest {
776
- seller_info: ICreateSellerInfo;
777
- banking_details: ILegalBankingDetails;
778
- shop_details: ICreateShopDetails;
779
- logo: File | File[];
780
- banner: File | File[];
781
- }
782
-
783
- export interface ICreateSellerRequest {
784
- type: ESellerTypes;
785
- name: string;
786
- surname: string;
787
- patronymic?: string;
788
- tel: number;
789
- INN: string;
790
- shop_name: string;
791
- send_email?: boolean;
792
- opt_otch: boolean;
793
- }
794
-
795
- export interface IUpdateSellerRequest {
796
- seller_info: Partial<ISellerInfo>;
797
- banking_details: Partial<IBankingDetails>;
798
- shop_details: ICreateShopDetails;
799
- company_info: Partial<ISellerCompanyInfo>;
800
- logo: File | File[] | string;
801
- banner: File | File[] | string;
802
- seller_id: string;
803
- toDeletePhotos?: string[];
804
- passport_details?: string;
805
- passport_photo?: File | File[] | string;
806
- card_number?: string;
807
- }
808
-
809
- export interface IActionsSellersRequest {
810
- toDelete: string;
811
- }
812
-
813
- export interface ICreateSellerShopRequest {
814
- seller_id: string;
815
- name: string;
816
- address: {
817
- name: string;
818
- lat: number;
819
- lng: number;
820
- };
821
- work_time?: IShopWorkTime[];
822
- }
823
-
824
- export interface IAdminUpdateNearestPointOfCdekRequest
825
- extends INearestPointOfCdek {
826
- seller_id: string;
827
- }
828
-
829
- export interface IAdminUpdateDeliveryWaysRequest extends IDeliveryWays {
830
- seller_id: string;
831
- }
832
-
833
- export interface IAdminChangeOrderStatus {
834
- orderId: string;
835
- status: EOrderStatus;
836
- reason_of_cancel?: string;
837
- }
838
-
839
- export interface IAdminDenyItem {
840
- item_id: string;
841
- }
842
-
843
- export interface IAdminRemoveOrderItemRequest {
844
- current_items: IPopulatedOrderItem[];
845
- }
846
-
847
- export interface IAdminOrdersQueryRequest extends FilterBaseQuery {
848
- name?: string;
849
- from?: string;
850
- to?: string;
851
- number?: string;
852
- sum?: 'asc' | 'desc';
853
- status?: EOrderStatus;
854
- tel?: string;
855
- seller_id?: string;
856
- }
857
-
858
- export type IPopulatedOrderSeller = Pick<
859
- ISeller,
860
- '_id' | 'shop_details' | 'user_id' | 'nearest_point_of_cdek' | 'slug'
861
- >;
862
-
863
- export type IPopulatedOrderUser = Pick<
864
- IUser,
865
- | '_id'
866
- | 'name'
867
- | 'full_name'
868
- | 'surname'
869
- | 'patronymic'
870
- | 'tel'
871
- | 'email'
872
- | 'birthday'
873
- >;
874
-
875
- export type TPopulatedProductId = Pick<
876
- IProduct,
877
- '_id' | 'name' | 'vendor_code' | 'photo' | 'discount'
878
- >;
879
-
880
- export interface IPopulatedOrderItem
881
- extends Omit<IOrderItem, 'product_id'> {
882
- product_id: IProductResponse;
883
- }
884
-
885
- export type IPopulatedOrder = Omit<
886
- IOrder,
887
- 'items' | 'seller_id' | 'user_id' | 'shop_id'
888
- > & {
889
- items: IPopulatedOrderItem[];
890
- seller_id?: IPopulatedOrderSeller;
891
- user_id?: IPopulatedOrderUser;
892
- shop_id: IShop;
893
- };
894
-
895
- export interface IAdminGetOrderResponse {
896
- order: IPopulatedOrder;
897
- commission: number;
898
- }
899
-
900
- export interface IAdminOrdersQueryResponse {
901
- orders: IPopulatedOrder[];
902
- count: number;
903
- }
904
-
905
- export interface IAdminDeliveryInfo {
906
- receive_method: ERecieveMethod;
907
- preparation_date: Date;
908
- address?: string;
909
- shop_id?: string;
910
- }
911
-
912
- export interface IAdminCdekInfo {
913
- delivery_sum: number;
914
- tracking: string;
915
- }
916
-
917
- export interface IAdminUpdateOrderRequest {
918
- note?: string;
919
- delivery_info: Partial<IAdminDeliveryInfo>;
920
- cdek_info?: Partial<IAdminCdekInfo>;
921
- invoice?: File;
922
- items: IPopulatedOrderItem[];
923
- }
924
-
925
- export type OrderAddress = Omit<
926
- IAddress,
927
- 'user_id' | '_id' | 'createdAt' | 'updatedAt'
928
- >;
929
-
930
- export enum EOrderStatus {
931
- NOT_PAID = 'NOT_PAID',
932
- ON_CONFIRMATION = 'ON_CONFIRMATION',
933
- CONFIRMED_BY_SELLER = 'CONFIRMED_BY_SELLER',
934
- IN_DELIVERY = 'IN_DELIVERY',
935
- WAITING_IN_POINT = 'WAITING_IN_POINT',
936
- FINISHED = 'FINISHED',
937
- CANCELED = 'CANCELED',
938
- ARCHIVED = 'ARCHIVED',
939
- }
940
-
941
- export interface IDeliveryAddress extends OrderAddress {
942
- lat: number;
943
- lng: number;
944
- }
945
-
946
- export interface IDeliveryInfo {
947
- delivery_sum: number;
948
- address: IDeliveryAddress;
949
- tel: number;
950
- full_name: string;
951
- yandex_uuid?: string;
952
- cdek_barcode?: string;
953
- type?: DeliveryTypes;
954
- yandex_offer?: OfferDto;
955
- comment?: string;
956
- }
957
-
958
- export interface IPVZ {
959
- code: string;
960
- name: string;
961
- location: {
962
- country_code: string;
963
- region_code: number;
964
- region: string;
965
- city_code: number;
966
- city: string;
967
- postal_code: string;
968
- longitude: number;
969
- latitude: number;
970
- address: string;
971
- address_full: string;
972
- };
973
- phones: [
974
- {
975
- number: string;
976
- }
977
- ];
978
- email: string;
979
- delivery_sum: number;
980
- }
981
-
982
- export interface IPickUpPoint {
983
- shop_id: string;
984
- }
985
-
986
- export enum ERecieveMethod {
987
- PICKUP_POINT = 'PICKUP_POINT',
988
- COURIER = 'COURIER',
989
- PVZ = 'PVZ',
990
- EXPRESS = 'EXPRESS',
991
- }
992
-
993
- export enum EOrderItemsStatus {
994
- AGREED = 'AGREED',
995
- DENIED = 'DENIED',
996
- }
997
-
998
- export interface IOrderItem {
999
- _id: string;
1000
- product_id: string;
1001
- count: number;
1002
- price: number; // Сумма за одну единицу товара * количество товаров
1003
- dimension: IDimension; // Габариты за единицу товара
1004
- items_status: EOrderItemsStatus;
1005
- }
1006
-
1007
- export interface ICheckIsAlsoInStock {
1008
- cartItems: ICart[];
1009
- }
1010
-
1011
- export interface ICreateOrder {
1012
- items: Omit<IOrderItem, '_id' | 'items_status'>[];
1013
- receive_method: ERecieveMethod;
1014
- receive_method_data: IDeliveryInfo | IPVZ | IPickUpPoint;
1015
- seller_id: string;
1016
- }
1017
-
1018
- export interface IGetAllOrders {
1019
- user_id: string;
1020
- skip: number;
1021
- limit: number;
1022
- }
1023
-
1024
- export type IPopulatedOrderShop = IShop;
1025
-
1026
- export interface IPopulatedOrderItemApp
1027
- extends Omit<IOrderItem, 'product_id'> {
1028
- product_id: Pick<
1029
- IProduct,
1030
- '_id' | 'name' | 'photo' | 'discount' | 'slug' | 'status'
1031
- >;
1032
- }
1033
-
1034
- export type IPopulatedOrderUserApp = Pick<
1035
- IUser,
1036
- | '_id'
1037
- | 'name'
1038
- | 'full_name'
1039
- | 'surname'
1040
- | 'patronymic'
1041
- | 'tel'
1042
- | 'email'
1043
- | 'birthday'
1044
- >;
1045
-
1046
- export type IPopulatedOrderApp = Omit<
1047
- IOrder,
1048
- 'items' | 'shop_id' | 'user_id'
1049
- > & {
1050
- items: IPopulatedOrderItemApp[];
1051
- user_id: IPopulatedOrderUserApp;
1052
- shop_id: IPopulatedOrderShop;
1053
- };
1054
-
1055
- export enum EReasonOfCancel {
1056
- CHANGED_DELIVERY_DATE = 'Перенесли срок доставки',
1057
- INCORRECT_CREATED_ORDER = 'Хочу изменить заказ и оформить заново',
1058
- FOUND_CHEAPER = 'Нашел дешевле',
1059
- WRONG_ADDRESS = 'Указал неверный адрес',
1060
- OTHER = 'Другое',
1061
- }
1062
-
1063
- export interface ICancelOrderRequest {
1064
- orderId: string;
1065
- reason_of_cancel: EReasonOfCancel;
1066
- }
1067
-
1068
- export interface ICreateMultiOrder {
1069
- orders: ICreateOrder[];
1070
- sum: number;
1071
- tel: number;
1072
- email: string;
1073
- name: string;
1074
- surname: string;
1075
- patronymic?: string;
1076
- }
1077
-
1078
- export interface IDeliveryFullInfo extends IDeliveryInfo {
1079
- tracking: string;
1080
- invoice: string;
1081
- }
1082
-
1083
- export interface IGetCDEKOffices {
1084
- weight_max?: string;
1085
- city: string; // city or city_district from dadata
1086
- }
1087
-
1088
- export interface ICDEKOffice {
1089
- code: string;
1090
- name: string;
1091
- uuid: string;
1092
- address_comment: string;
1093
- nearest_metro_station: string;
1094
- work_time: string;
1095
- phones: [
1096
- {
1097
- number: string;
1098
- }
1099
- ];
1100
- email: string;
1101
- note: string;
1102
- type: string;
1103
- owner_code: string;
1104
- take_only: boolean;
1105
- is_handout: boolean;
1106
- is_reception: boolean;
1107
- is_dressing_room: boolean;
1108
- is_ltl: boolean;
1109
- have_cashless: boolean;
1110
- have_cash: boolean;
1111
- allowed_cod: boolean;
1112
- site: string;
1113
- work_time_list: [
1114
- {
1115
- day: number;
1116
- time: string;
1117
- }
1118
- ];
1119
- weight_min: number;
1120
- weight_max: number;
1121
- location: {
1122
- country_code: string;
1123
- region_code: number;
1124
- region: string;
1125
- city_code: number;
1126
- city: string;
1127
- fias_guid: string;
1128
- postal_code: string;
1129
- longitude: number;
1130
- latitude: number;
1131
- address: string;
1132
- address_full: string;
1133
- };
1134
- fulfillment: boolean;
1135
- }
1136
-
1137
- export interface GetDeliverySum {
1138
- address: string;
1139
- type: ERecieveMethod.COURIER | ERecieveMethod.PVZ;
1140
- items: Omit<IOrderItem, '_id' | 'items_status'>[];
1141
- seller_id: string;
1142
- }
1143
-
1144
- export interface IDeliverySum {
1145
- delivery_sum: number;
1146
- period_min: number;
1147
- period_max: number;
1148
- calendar_min: number;
1149
- calendar_max: number;
1150
- weight_calc: number;
1151
- services: [
1152
- {
1153
- code: string;
1154
- sum: number;
1155
- }
1156
- ];
1157
- total_sum: number;
1158
- currency: string;
1159
- }
1160
-
1161
- export interface IOrder {
1162
- _id: string;
1163
- total_received: number; // Сколько всего заплатил покупатель за этот заказ (сумма товаров + доставки)
1164
- current_commission: number; // Текущая комиссия продавца за заказ (Сумма товаров * комиссию продавца / 100)
1165
- sum: number;
1166
- full_sum: number; // Сумма с учетом доставки и коммиссии сервиса
1167
- weight: number; // Общий вес в граммах
1168
- user_id?: string;
1169
- items: IOrderItem[];
1170
- seller_id?: string;
1171
- receive_method: ERecieveMethod;
1172
- delivery_info?: Partial<IDeliveryFullInfo>;
1173
- shop_id?: string;
1174
- pvz?: Partial<IPVZ>;
1175
- status: EOrderStatus;
1176
- preparation_date?: Date;
1177
- note?: string;
1178
- reason_of_cancel?: string;
1179
- number: number;
1180
- createdAt: Date;
1181
- updatedAt: Date;
1182
- type?: DeliveryTypes;
1183
- yandex_offer?: OfferDto;
1184
- }
1185
-
1186
- export interface IAdminMultiOrderResponse
1187
- extends Omit<IMultiOrder, 'orders'> {
1188
- orders: IPopulatedOrder[];
1189
- }
1190
-
1191
- export interface IMultiOrder {
1192
- _id: string;
1193
- user_id: string;
1194
- sum: number;
1195
- orders: string[];
1196
- payment_id: string | null;
1197
- number: number;
1198
- status: EMultiOrderStatus;
1199
- createdAt: Date;
1200
- updatedAt: Date;
1201
- }
1202
-
1203
- export interface IPaymentCheckResponse {
1204
- id: string;
1205
- status: string;
1206
- amount: {
1207
- value: string;
1208
- currency: string;
1209
- };
1210
- description: string;
1211
- captured_at: string;
1212
- created_at: string;
1213
- metadata: {
1214
- multiOrderId: string;
1215
- multiOrderNumber: string;
1216
- };
1217
- confirmation: IConfirmation;
1218
- purchase_unique: boolean;
1219
- }
1220
-
1221
- export type IConfirmationType = 'embedded' | 'external' | 'qr' | 'redirect';
1222
-
1223
- export interface IConfirmation {
1224
- type: IConfirmationType;
1225
- locale?: string;
1226
- confirmation_token?: string;
1227
- confirmation_data?: string;
1228
- confirmation_url?: string;
1229
- enforce?: boolean;
1230
- return_url?: string;
1231
- }
1232
-
1233
- export interface IPaymentResponse {
1234
- id: string;
1235
- status: string;
1236
- amount: {
1237
- value: string;
1238
- currency: string;
1239
- };
1240
- description: string;
1241
- created_at: string;
1242
- confirmation: IConfirmation;
1243
- metadata: {
1244
- multiOrderId: string;
1245
- multiOrderNumber: string;
1246
- };
1247
- }
1248
-
1249
- export enum EMultiOrderStatus {
1250
- CANCELED = 'CANCELED',
1251
- PAID = 'PAID',
1252
- PENDING = 'PENDING',
1253
- }
1254
-
1255
- export enum EComplaintsReason {
1256
- NOT_MATCH_TO_DESC = 'NOT_MATCH_TO_DESC',
1257
- INCORRECT_PHOTO = 'INCORRECT_PHOTO',
1258
- DAMAGED_GOODS = 'DAMAGED_GOODS',
1259
- POOR_QUALITY = 'POOR_QUALITY',
1260
- FRAUD = 'FRAUD',
1261
- OTHER = 'OTHER',
1262
- }
1263
-
1264
- export interface IComplaints {
1265
- _id: string;
1266
- user_id: string;
1267
- product_id: string;
1268
- text?: string;
1269
- reason: EComplaintsReason;
1270
- }
1271
-
1272
- export interface ICreateComplaints {
1273
- product_id: string;
1274
- text?: string;
1275
- reason: EComplaintsReason;
1276
- }
1277
-
1278
- export enum EReviewEntityType {
1279
- PRODUCT = 'PRODUCT',
1280
- HORSE = 'HORSE',
1281
- SERVICE = 'SERVICE',
1282
- }
1283
-
1284
- export enum ECreatorType {
1285
- SELLER = 'SELLER',
1286
- USER = 'USER',
1287
- }
1288
-
1289
- export interface IReview {
1290
- _id: string;
1291
- user_id?: string;
1292
- entity_id: string;
1293
- entity_type: EReviewEntityType;
1294
- creator_id: string;
1295
- creator_type: ECreatorType;
1296
- rating: number;
1297
- text: string;
1298
- anonymity: boolean;
1299
- }
1300
-
1301
- export interface IReviewsRequest {
1302
- entity_id: string;
1303
- entity_type: EReviewEntityType;
1304
- creator_id: string;
1305
- creator_type: ECreatorType;
1306
- }
1307
-
1308
- export interface IGetReviewsRequest
1309
- extends Partial<FilterBaseQuery & IReviewsRequest> {}
1310
-
1311
- export interface IReviewResponse {
1312
- _id: string;
1313
- user_id: {
1314
- _id: string;
1315
- tel: number;
1316
- name: string;
1317
- birthday: Date;
1318
- email: string;
1319
- full_name: string;
1320
- patronymic: string;
1321
- surname: string;
1322
- };
1323
- entity_id: string; // ID сущности, к которой привязан отзыв (например, Product или Horse)
1324
- entity_type: EReviewEntityType; // Тип сущности (Product, Horse и т.д.)
1325
- creator_id: string; // ID создателя сущности (продавец или пользователь)
1326
- creator_type: ECreatorType; // Тип создателя (SELLER или USER)
1327
- rating: number;
1328
- text?: string;
1329
- anonymity: boolean;
1330
- createdAt: Date;
1331
- updatedAt: Date;
1332
- }
1333
-
1334
- export interface IGetReviewDataRequest extends Partial<IReviewsRequest> {}
1335
-
1336
- export interface IReviewsData {
1337
- count: number;
1338
- averageRating: string;
1339
- sellerName?: string;
1340
- }
1341
-
1342
- export interface ICreateReviewRequest {
1343
- entity_id: string;
1344
- entity_type: EReviewEntityType;
1345
- text?: string;
1346
- anonymity: boolean;
1347
- rating: number;
1348
- }
1349
-
1350
- export interface IDeleteReviewQuery {
1351
- toDelete: string;
1352
- }
1353
-
1354
- export enum ESellerTransactionsType {
1355
- SALE = 'SALE',
1356
- FINE = 'FINE',
1357
- WITHDRAW = 'WITHDRAW',
1358
- REFUND = 'REFUND',
1359
- }
1360
-
1361
- export interface ISellerTransactions {
1362
- _id: string;
1363
- total_received: number; // Сумма которую оплатил покупатель за этот заказ (сумма товаров + сумма доставки)
1364
- type: ESellerTransactionsType;
1365
- sum: number;
1366
- admin_id?: string;
1367
- order_id: string;
1368
- comment?: string;
1369
- commission: number;
1370
- delivery_sum?: number;
1371
- payment_id: string;
1372
- seller_id: string;
1373
- createdAt: Date;
1374
- updatedAt: Date;
1375
- }
1376
-
1377
- export interface ICreateSellerTransactions {
1378
- type: ESellerTransactionsType;
1379
- sum: number;
1380
- comment?: string;
1381
- }
1382
-
1383
- export interface IAdminGetTransactionsRequest extends FilterBaseQuery {
1384
- type?: ESellerTransactionsType;
1385
- sum?: 'asc' | 'desc';
1386
- from?: string;
1387
- to?: string;
1388
- seller_id?: string;
1389
- order_id?: string;
1390
- }
1391
-
1392
- export interface IAdminTransactionsQueryResponse {
1393
- transactions: ISellerTransactions[];
1394
- count: number;
1395
- }
1396
-
1397
- export interface IAdminTopSalesQueryRequest extends FilterBaseQuery {
1398
- seller_id: string;
1399
- }
1400
-
1401
- export interface IAdminTopSalesResponse {
1402
- products: IProduct[];
1403
- count: number;
1404
- }
1405
-
1406
- export interface IAdminChangeCommissionRequest {
1407
- commission: number;
1408
- }
1409
-
1410
- export interface IAdminChangeCommissionResponse {
1411
- commission: number;
1412
- }
1413
-
1414
- export interface IAdminGetChartDataQueryRequest {
1415
- year: string;
1416
- seller_id: string;
1417
- }
1418
-
1419
- export interface IAdminGetChartDataResponse {
1420
- [key: string]: number;
1421
- }
1422
-
1423
- export interface IAdminCreateSellerTransactionRequest {
1424
- type: ESellerTransactionsType;
1425
- sum: number;
1426
- }
1427
-
1428
- export interface IAdminAddCustomRefundTransactionRequest {
1429
- custom_sum: number;
1430
- comment: string;
1431
- }
1432
-
1433
- export enum ENotificationType {
1434
- ORDER = 'ORDER',
1435
- PRODUCT = 'PRODUCT',
1436
- COLLECTION = 'COLLECTION',
1437
- }
1438
-
1439
- export interface IAdminChangeSellerStatusRequest {
1440
- status: ESellerStatus.APPROVED | ESellerStatus.DECLINED;
1441
- }
1442
-
1443
- export enum ESellerTypes {
1444
- PHYSICAL = 'PHYSICAL', // Физическое лицо
1445
- LEGAL = 'LEGAL', // Юридическое лицо
1446
- }
1447
-
1448
- export enum ESellerLegalTypes {
1449
- LEGAL = 'LEGAL',
1450
- INDIVIDUAL = 'INDIVIDUAL',
1451
- }
1452
-
1453
- export enum ESellerLocaleTypes {
1454
- PHYSICAL = 'Физическое лицо',
1455
- LEGAL = 'Юридическое лицо',
1456
- }
1457
-
1458
- export interface IGetInfoOfLegalRequest {
1459
- INN: string;
1460
- }
1461
-
1462
- export interface IСheckCleanOfPassportRequest {
1463
- passport_details: string;
1464
- }
1465
-
1466
- export interface ICleanPassportResponse {
1467
- source: string;
1468
- series: string;
1469
- number: string;
1470
- qc: number; // Check EPassportQc
1471
- }
1472
-
1473
- export enum EPassportQc {
1474
- 'Действующий паспорт' = 0,
1475
- 'Неправильный формат серии или номера' = 1,
1476
- 'Исходное значение пустое' = 2,
1477
- 'Недействительный паспорт' = 10,
1478
- }
1479
-
1480
- export enum ECompanyStatus {
1481
- 'ACTIVE' = 'ACTIVE',
1482
- 'LIQUIDATING' = 'LIQUIDATING',
1483
- 'LIQUIDATED' = 'LIQUIDATED',
1484
- 'BANKRUPT' = 'BANKRUPT',
1485
- 'REORGANIZING' = 'REORGANIZING',
1486
- }
1487
-
1488
- export interface ISuggestion {
1489
- value: string; // Название компании
1490
- unrestricted_value: string;
1491
- data: {
1492
- kpp: string;
1493
- branch_type: string;
1494
- type: ESellerLegalTypes;
1495
- state: {
1496
- status: ECompanyStatus;
1497
- code: null;
1498
- };
1499
- name: {
1500
- full_with_opf: string;
1501
- short_with_opf: string;
1502
- };
1503
- inn: string;
1504
- ogrn: string;
1505
- okpo: string;
1506
- address: {
1507
- value: string;
1508
- };
1509
- };
1510
- }
1511
-
1512
- export interface ICreatePhysicalSellerRequest extends ICreateSellerRequest {
1513
- birthday: string;
1514
- passport_details: string;
1515
- passport_photo: File;
1516
- }
1517
-
1518
- export interface ISellerAdditionalInfo {
1519
- passport_details?: string;
1520
- passport_photo?: string;
1521
- card_number?: string;
1522
- }
1523
-
1524
- export interface ISellerCompanyInfo {
1525
- name: string;
1526
- okpo: string;
1527
- ogrn: string;
1528
- type: ESellerLegalTypes;
1529
- }
1530
-
1531
- export interface IGetInfoOfPhysicRequest {
1532
- name: string;
1533
- surname: string;
1534
- patronymic?: string;
1535
- birthday: Date;
1536
- passport_details: string;
1537
- opt_otch: boolean;
1538
- INN: string;
1539
- }
1540
-
1541
- export interface IGetInfoOfPhysicResponse {
1542
- inn?: string;
1543
- captcha_required: boolean;
1544
- code: string; // 0 - Не найден, 1 - Все окей
1545
- }
1546
-
1547
- export interface ICheckSellerDataForCorrectness {
1548
- name: string;
1549
- surname: string;
1550
- patronymic?: string;
1551
- opt_otch: boolean;
1552
- INN: string;
1553
- birthday: Date;
1554
- passport_details: string;
1555
- }
1556
-
1557
- export enum ECheckSellerDataErrors {
1558
- 'INVALID_PASSPORT' = 'INVALID_PASSPORT',
1559
- 'INCORRECT_INN' = 'INCORRECT_INN',
1560
- 'INN_NOT_FOUND' = 'INN_NOT_FOUND',
1561
- }
1562
-
1563
- export interface IAdminCreatePhysicalSellerRequest
1564
- extends Omit<IAdminCreateSellerRequest, 'banking_details'> {
1565
- banking_details: IPhysicalBankingDetails;
1566
- passport_details: string;
1567
- passport_photo: File | File[];
1568
- card_number?: string;
1569
- }
1570
-
1571
- export interface IUserWithSellerType extends IUser {
1572
- type: EUserSellerType;
1573
- }
1574
-
1575
- export enum EUserSellerType {
1576
- 'PHYSICAL' = 'PHYSICAL',
1577
- 'LEGAL' = 'LEGAL',
1578
- 'NOT_SELLER' = 'NOT_SELLER',
1579
- }
1580
-
1581
- export interface IUpdateMultiOrderStatusRequest {
1582
- _id: string;
1583
- status: EMultiOrderStatus;
1584
- reason_of_cancel: EReasonOfCancel;
1585
- }
1586
-
1587
- export interface IUserRandomProductQueryRequest extends OptionalUserQuery {
1588
- size: string;
1589
- category_id?: string;
1590
- subCategory_id?: string;
1591
- }
1592
-
1593
- export enum ECheckForFillingSellerDataError {
1594
- SHOP_IS_NOT_EXIST = 'SHOP_IS_NOT_EXIST',
1595
- CDEK_POINT_IS_NOT_EXIST = 'CDEK_POINT_IS_NOT_EXIST',
1596
- DELIVERY_WAYS_IS_NOT_EXIST = 'DELIVERY_WAYS_IS_NOT_EXIST',
1597
- SELLER_INFO_IS_NOT_FILLED_OUT = 'SELLER_INFO_IS_NOT_FILLED_OUT',
1598
- BANKING_DETAILS_IS_NOT_FILLED_OUT = 'BANKING_DETAILS_IS_NOT_FILLED_OUT',
1599
- }
1600
-
1601
- export interface IAdminCreateWithdrawalRequest {
1602
- sum: number;
1603
- }
1604
-
1605
- export interface IAddressSuggestionRequest {
1606
- address: string;
1607
- isCityOnly?: 'true' | 'false';
1608
- }
1609
-
1610
- export interface IAddressSuggestion {
1611
- value: string;
1612
- unrestricted_value: string;
1613
- data: {
1614
- city: string;
1615
- city_district: string;
1616
- region_fias_id: string;
1617
- city_fias_id: string;
1618
- city_kladr_id: string;
1619
- fias_id: string;
1620
- fias_code: null;
1621
- fias_level: string;
1622
- kladr_id: string;
1623
- geo_lat: string | null;
1624
- geo_lon: string | null;
1625
- };
1626
- }
1627
-
1628
- export interface IAddressSuggestionResponse {
1629
- suggestions: IAddressSuggestion[];
1630
- }
1631
-
1632
- export interface IBanner {
1633
- _id: string;
1634
- photo: string;
1635
- position: number;
1636
- seller_id: string;
1637
- createdAt: Date;
1638
- updatedAt: Date;
1639
- }
1640
-
1641
- export interface IMoySkladLinkerRequest {
1642
- updateData: {
1643
- linker_id: string;
1644
- category_id: string;
1645
- subCategory_id: string;
1646
- }[];
1647
- }
1648
-
1649
- export interface IMoySkladLinker {
1650
- pathName: string;
1651
- seller_id: string;
1652
- product_ids: string[];
1653
- }
1654
-
1655
- export interface IVersion {
1656
- version: string;
1657
- isForceToUpdate: boolean;
1658
- }
1659
-
1660
- export interface IAppVersion {
1661
- ios: IVersion;
1662
- android: IVersion;
1663
- }
1664
-
1665
- export interface NotificationData {
1666
- body: string;
1667
- data?: InternalPushMessageData | ExternalPushMessageData;
1668
- title: string;
1669
- }
1670
-
1671
- export interface INotification {
1672
- _id: string;
1673
- user_id?: string;
1674
- push_token_id: string;
1675
- message: NotificationData;
1676
- status: ENotificationStatus;
1677
- createdAt: Date;
1678
- }
1679
-
1680
- export enum ENotificationStatus {
1681
- READ = 'READ',
1682
- UNREAD = 'UNREAD',
1683
- }
1684
-
1685
- export interface ISendNotifications {
1686
- to: ENotificationRecipients;
1687
- notificationData: NotificationData;
1688
- }
1689
-
1690
- export enum ENotificationRecipients {
1691
- ALL = 'ALL',
1692
- SELLERS = 'SELLERS',
1693
- USERS = 'USERS',
1694
- }
1695
-
1696
- export interface IHintCharacteristics {
1697
- name: string;
1698
- values: string[];
1699
- }
1700
-
1701
- export interface IPossibleCombinations {
1702
- combinations: ICharacteristic[][];
1703
- characteristics: { name: string; values: string[] }[];
1704
- }
1705
-
1706
- export interface IGetVariationByCharacteristics {
1707
- product_id: string;
1708
- characteristics: ICharacteristic[];
1709
- }
1710
-
1711
- export enum ESex {
1712
- STALLION = 'stallion',
1713
- MARE = 'mare',
1714
- GELDING = 'gelding',
1715
- }
1716
-
1717
- export interface ICompetitionHistory {
1718
- name: string;
1719
- place: string;
1720
- }
1721
-
1722
- export interface ILocation {
1723
- name: string;
1724
- coordinates?: number[]; // [lng, lat]
1725
- lat: number;
1726
- lng: number;
1727
- }
1728
-
1729
- export interface IPreferredCommunication {
1730
- telegram: boolean;
1731
- whatsapp: boolean;
1732
- calls: boolean;
1733
- sms: boolean;
1734
- }
1735
-
1736
- export interface ICommunication {
1737
- tel: number;
1738
- preferredCommunication: IPreferredCommunication;
1739
- }
1740
-
1741
- export interface ICreateHorse {
1742
- name: string;
1743
- sex: ESex;
1744
- breed: string;
1745
- suit: string;
1746
- category: string;
1747
- birthDate: string;
1748
- withersHeight: number;
1749
- price: number;
1750
- location: ILocation;
1751
- images: File | File[];
1752
- video_cover?: File;
1753
- desc?: string;
1754
- reg_number?: string;
1755
- genealogy?: string;
1756
- birthplace?: string;
1757
- documents?: File | File[];
1758
- documentsNames?: string[];
1759
- competition_history?: ICompetitionHistory[];
1760
- communication: ICommunication;
1761
- }
1762
-
1763
- export interface IUpdateHorse extends Partial<ICreateHorse> {
1764
- toRemoveImages?: string[];
1765
- toRemoveVideoCover?: string;
1766
- toRemoveDocuments?: string[]; // Array of documents.fileName
1767
- }
1768
-
1769
- export enum EHorseStatus {
1770
- MODERATION = 'MODERATION',
1771
- PUBLISHED = 'PUBLISHED',
1772
- REJECTED = 'REJECTED',
1773
- ARCHIVED = 'ARCHIVED',
1774
- }
1775
-
1776
- export interface IHorse {
1777
- _id: string;
1778
- user_id: string;
1779
- status: EHorseStatus;
1780
- name: string;
1781
- sex: ESex;
1782
- breed: string;
1783
- suit: string;
1784
- birthDate: Date;
1785
- category: string;
1786
- withersHeight: number;
1787
- price: number;
1788
- location: ILocation;
1789
- images: string[];
1790
- video_cover: string | null;
1791
- desc: string | null;
1792
- reg_number: string | null;
1793
- genealogy: string | null;
1794
- birthplace: string | null;
1795
- documents: IDocument[] | null;
1796
- competition_history: ICompetitionHistory[] | null;
1797
- communication: ICommunication;
1798
- reason_of_cancel?: string;
1799
- distance?: number; // Расстояние пользователя до лошади (если передано гео)
1800
- archived_reason?: string;
1801
- telegram_message_id: string | null;
1802
- slug: string;
1803
- number: number;
1804
- published_at?: Date;
1805
- entityAnalytics?: IEntityAnalytics;
1806
- createdAt: Date;
1807
- updatedAt: Date;
1808
- }
1809
-
1810
- export interface IDocument {
1811
- name: string;
1812
- fileName: string;
1813
- }
1814
-
1815
- export interface IPopulatedHorse
1816
- extends Omit<IHorse, 'user_id' | 'breed' | 'suit' | 'category'> {
1817
- user_id: IPopulatedOrderUserApp;
1818
- breed: IBreed;
1819
- suit: ISuit;
1820
- category: IHorseCategory;
1821
- is_favorite?: boolean;
1822
- }
1823
-
1824
- export interface IBreed {
1825
- _id: string;
1826
- name: string;
1827
- createdAt: Date;
1828
- updatedAt: Date;
1829
- }
1830
-
1831
- export interface ISuit {
1832
- _id: string;
1833
- name: string;
1834
- createdAt: Date;
1835
- updatedAt: Date;
1836
- }
1837
-
1838
- export interface IHorseCategory {
1839
- _id: string;
1840
- name: string;
1841
- createdAt: Date;
1842
- updatedAt: Date;
1843
- }
1844
-
1845
- export interface IHorseFormInformation {
1846
- breeds: IBreed[];
1847
- suits: ISuit[];
1848
- categories: IHorseCategory[];
1849
- }
1850
-
1851
- export enum EViewCountEntityType {
1852
- HORSE = 'HORSE',
1853
- PRODUCT = 'PRODUCT',
1854
- SERVICE = 'SERVICE',
1855
- }
1856
-
1857
- export interface IViewCount {
1858
- entity_type: EViewCountEntityType;
1859
- entity_id: string;
1860
- count: number;
1861
- createdAt: Date;
1862
- updatedAt: Date;
1863
- }
1864
-
1865
- export interface IPopulatedHorseWViewCount extends IPopulatedHorse {
1866
- viewCount: IViewCount;
1867
- }
1868
-
1869
- export interface IGetCombinedHorses {
1870
- user_id?: string; // objectid
1871
- sex?: 'stallion' | 'mare' | 'gelding';
1872
- breed?: string; // objectid
1873
- suit?: string; // objectid
1874
- ageMin?: string;
1875
- ageMax?: string;
1876
- withersHeightMin?: string;
1877
- withersHeightMax?: string;
1878
- priceMin?: string;
1879
- priceMax?: string;
1880
- category?: string; // objectid
1881
- lat?: string; // user lat
1882
- lng?: string; // user lng
1883
- radius?: string;
1884
- }
1885
-
1886
- export interface IReverseGeocodingRequest {
1887
- lat: number;
1888
- lon: number;
1889
- count?: number;
1890
- radius_meters?: number;
1891
- }
1892
-
1893
- export interface IHorseQueryRequest extends FilterBaseQuery {}
1894
-
1895
- export interface IAdminHorsesQueryResponse {
1896
- horses: IPopulatedHorse[];
1897
- count: number;
1898
- }
1899
-
1900
- export interface IActionsHorseRequest {
1901
- toDelete: string;
1902
- }
1903
-
1904
- export interface IAdminChangeHorseStatusRequest {
1905
- status: EHorseStatus;
1906
- reason_of_cancel?: string;
1907
- }
1908
-
1909
- export interface InternalPushMessageData {
1910
- type: ENotificationType;
1911
- typeId: string;
1912
- typeSlug?: string | null;
1913
- }
1914
-
1915
- export interface ExternalPushMessageData {
1916
- url: string;
1917
- }
1918
-
1919
- export interface IGetHorseViewHistory extends FilterBaseQuery {
1920
- lat?: string; // user lat
1921
- lng?: string; // user lng
1922
- }
1923
- export interface IPriceHistorySearch {
1924
- priceMin?: number;
1925
- priceMax?: number;
1926
- }
1927
-
1928
- export enum ECollectionStatus {
1929
- PUBLISHED = 'PUBLISHED',
1930
- ARCHIVED = 'ARCHIVED',
1931
- }
1932
- export interface IPopulatedCollection
1933
- extends Omit<ICollection, 'products'> {
1934
- products: IProductResponse[];
1935
- }
1936
-
1937
- export interface ICollectionQueryRequest {
1938
- title?: string;
1939
- desc?: string;
1940
- slug?: string;
1941
- deeplink?: string;
1942
- photo?: string;
1943
- products?: string;
1944
- status?: string;
1945
- position?: number;
1946
- all_fields?: string;
1947
- skip: string;
1948
- limit: string;
1949
- }
1950
-
1951
- export interface ICreateCollection {
1952
- title: string;
1953
- desc?: string;
1954
- deeplink?: string;
1955
- photo: File;
1956
- products: string[];
1957
- status: ECollectionStatus;
1958
- position: number;
1959
- }
1960
-
1961
- export interface IUpdateCollection {
1962
- title?: string;
1963
- desc?: string;
1964
- deeplink?: string;
1965
- photo?: File;
1966
- products?: string[];
1967
- status?: ECollectionStatus;
1968
- position?: number;
1969
- }
1970
-
1971
- export interface ICollection {
1972
- _id: string;
1973
- title: string;
1974
- desc?: string;
1975
- slug: string;
1976
- deeplink?: string;
1977
- photo: string;
1978
- products: string[];
1979
- status: ECollectionStatus;
1980
- position: number;
1981
- }
1982
- export interface IPickupPoints {
1983
- lat: string;
1984
-
1985
- lng: string;
1986
- }
1987
-
1988
- export interface ICalculateFastDeliveryPrice {
1989
- lat: string;
1990
-
1991
- lng: string;
1992
-
1993
- items: IOrderItem[];
1994
- }
1995
-
1996
- export interface ItemSizeDto {
1997
- // product.dimension: length, width, height
1998
- length: number;
1999
- width: number;
2000
- height: number;
2001
- }
2002
-
2003
- export interface ItemDto {
2004
- size?: ItemSizeDto;
2005
- weight?: number;
2006
- quantity: number;
2007
- pickup_point: number;
2008
- dropoff_point: number;
2009
- }
2010
-
2011
- export interface RoutePointDto {
2012
- id: number; // 1, 2, 3...
2013
- fullname?: string;
2014
- coordinates: number[]; // 37.617298, 55.755825
2015
- }
2016
-
2017
- export interface DeliveryInterval {
2018
- from: string;
2019
- to: string;
2020
- }
2021
- export interface SameDayData {
2022
- delivery_interval: DeliveryInterval;
2023
- }
2024
- export interface RequirementsDto {
2025
- taxi_classes?: string[];
2026
- cargo_type?: string;
2027
- cargo_loaders?: number;
2028
- pro_courier?: boolean;
2029
- cargo_options?: string[];
2030
- skip_door_to_door?: boolean;
2031
- due?: string;
2032
- same_day_data?: SameDayData;
2033
- delivery_interval: DeliveryInterval;
2034
- }
2035
-
2036
- export interface YandexDeliveryRequestDto {
2037
- items: ItemDto[];
2038
- route_points: RoutePointDto[];
2039
- requirements: RequirementsDto;
2040
- }
2041
- export interface PriceDto {
2042
- total_price: string;
2043
- total_price_with_vat: string;
2044
- surge_ratio: number;
2045
- currency: string;
2046
- }
2047
-
2048
- export interface IntervalDto {
2049
- from: string;
2050
- to: string;
2051
- }
2052
-
2053
- export interface OfferDto {
2054
- price: PriceDto;
2055
- taxi_class: string;
2056
- pickup_interval: IntervalDto;
2057
- delivery_interval: IntervalDto;
2058
- description: string;
2059
- payload: string;
2060
- offer_ttl: string;
2061
- }
2062
-
2063
- export enum EProductsSortOptions {
2064
- NEWEST = 'Новинки',
2065
- POPULAR = 'Популярные',
2066
- CHEAPEST = 'Дешевле',
2067
- EXPENSIVE = 'Дороже',
2068
- }
2069
-
2070
- export interface PriceDto {
2071
- total_price: string;
2072
- total_price_with_vat: string;
2073
- surge_ratio: number;
2074
- currency: string;
2075
- }
2076
-
2077
- export interface IntervalDto {
2078
- from: string;
2079
- to: string;
2080
- }
2081
-
2082
- export interface OfferDto {
2083
- price: PriceDto;
2084
- taxi_class: string;
2085
- pickup_interval: IntervalDto;
2086
- delivery_interval: IntervalDto;
2087
- description: string;
2088
- payload: string;
2089
- offer_ttl: string;
2090
- }
2091
- export enum DeliveryTypes {
2092
- CDEK = 'CDEK',
2093
- YANDEX_EXPRESS = 'YANDEX_EXPRESS',
2094
- }
2095
-
2096
- export interface GetFastDeliveryPriceDto {
2097
- items: IPopulatedOrderItem[];
2098
-
2099
- delivery_info: Partial<IDeliveryFullInfo>;
2100
- }
2101
-
2102
- // Favorites (Избранное) - Начало
2103
-
2104
- export enum EFavoritesEntityType {
2105
- PRODUCT = 'PRODUCT',
2106
- HORSE = 'HORSE',
2107
- SERVICE = 'SERVICE',
2108
- }
2109
-
2110
- export interface IFavorite {
2111
- user_id?: string | null; // ID пользователя, который добавил в избранное
2112
- session_id?: string | null;
2113
- entity_id: string; // ID сущности, к которой привязано избранное (например, Product или Horse)
2114
- entity_type: EFavoritesEntityType; // Тип сущности (PRODUCT, HORSE и т.д.)
2115
- }
2116
-
2117
- export interface IPopulatedFavorite extends Omit<IFavorite, 'entity_id'> {
2118
- _id: string;
2119
- entity_id: IProductResponse | IPopulatedHorse | IPopulatedService; // В зависимости от entity_type присваивать entity_id as IProductResponse или IPopulatedHorse
2120
- }
2121
-
2122
- export enum EFavoriteToggleActions {
2123
- ADDED = 'ADDED', // Добавлен в базу
2124
- REMOVED = 'REMOVED', // Убран из базы
2125
- }
2126
-
2127
- export interface IToggleFavoriteRequest
2128
- extends Omit<IFavorite, 'user_id' | 'session_id'> {}
2129
-
2130
- export interface IGetFavoritesRequest
2131
- extends Omit<IFavorite, 'entity_id' | 'user_id' | 'session_id'> {}
2132
-
2133
- export interface IToggleFavoriteResponse {
2134
- action: EFavoriteToggleActions;
2135
- }
2136
-
2137
- // Favorites (Избранное) - Конец
2138
-
2139
- // Services (Услуги) - Начало
2140
-
2141
- export interface IGetServicesQuery extends FilterBaseQuery {
2142
- creator_id?: string;
2143
- user_id?: string;
2144
- category?: string;
2145
- priceMin?: string;
2146
- priceMax?: string;
2147
- lat?: string; // user lat
2148
- lng?: string; // user lng
2149
- radius?: string;
2150
- }
2151
-
2152
- export interface ICreateService {
2153
- name: string;
2154
- description?: string;
2155
- category: string;
2156
- price: number;
2157
- location: ILocation;
2158
- communication: ICommunication;
2159
- photo: File;
2160
- }
2161
-
2162
- export interface IUpdateService extends Partial<ICreateService> {}
2163
-
2164
- export enum EServiceStatus {
2165
- MODERATION = 'MODERATION',
2166
- PUBLISHED = 'PUBLISHED',
2167
- REJECTED = 'REJECTED',
2168
- ARCHIVED = 'ARCHIVED',
2169
- }
2170
-
2171
- export interface IServiceCategory {
2172
- _id: string;
2173
- name: string;
2174
- photo: string;
2175
- createdAt: Date;
2176
- updatedAt: Date;
2177
- }
2178
-
2179
- export interface IService {
2180
- user_id: string;
2181
- name: string;
2182
- description?: string;
2183
- category: string;
2184
- price: number;
2185
- status: EServiceStatus;
2186
- location: ILocation;
2187
- communication: ICommunication;
2188
- photo: string;
2189
- telegram_message_id: number | null;
2190
- slug: string;
2191
- distance?: number; // Расстояние пользователя до лошади (если передано гео)
2192
- number: number;
2193
- published_at?: Date;
2194
- entityAnalytics?: IEntityAnalytics;
2195
- createdAt: Date;
2196
- updatedAt: Date;
2197
- }
2198
-
2199
- export interface IPopulatedServicesWithReviewDataResponse {
2200
- services: IPopulatedService[];
2201
- reviewsData: IReviewsData;
2202
- }
2203
-
2204
- export interface IPopulatedService
2205
- extends Omit<IService, 'category' | 'user_id'> {
2206
- _id: string;
2207
- category: IServiceCategory;
2208
- user_id: IPopulatedOrderUserApp;
2209
- is_favorite?: boolean;
2210
- reviewsData?: IReviewsData;
2211
- }
2212
-
2213
- export interface IPopulatedServiceWViewCount extends IPopulatedService {
2214
- viewCount: IViewCount;
2215
- }
2216
-
2217
- // Services (Услуги) - Конец
2218
-
2219
- export interface OptionalUserQuery {
2220
- user_id?: string;
2221
- }
2222
-
2223
- export interface OptionalLocationQuery {
2224
- lat?: string;
2225
- lng?: string;
2226
- }
2227
-
2228
- export interface OptionalUserLocationQuery
2229
- extends OptionalUserQuery,
2230
- OptionalLocationQuery {}
2231
-
2232
- export interface CombinedUserLocationFilterQuery
2233
- extends OptionalUserLocationQuery,
2234
- FilterBaseQuery {}
2235
-
2236
- export interface ISavePushToken {
2237
- token: string;
2238
- userId?: string;
2239
- }
2240
-
2241
- export enum EEntityType {
2242
- PRODUCT = 'PRODUCT',
2243
- HORSE = 'HORSE',
2244
- SERVICE = 'SERVICE',
2245
- }
2246
-
2247
- export interface IGetUnreviewedProductsResponse {
2248
- products: IProductResponse[];
2249
- count: number;
2250
- }
2251
-
2252
- export enum EArchivedReason {
2253
- HORSESMART = 'На HorseSmart',
2254
- OTHER_PLATFORM = 'На другой площадке',
2255
- PERSONAL = 'Лично',
2256
- NOT_SOLD = 'Не продал',
2257
- }
2258
-
2259
- export interface IDeleteHorse {
2260
- archived_reason: EArchivedReason;
2261
- }
2262
-
2263
- export interface SellerSlugResponse {
2264
- _id: string;
2265
- slug: string;
2266
- updatedAt: Date;
2267
- }
2268
-
2269
- export interface IEntityAnalytics {
2270
- entity_type: EEntityType;
2271
- entity_id: string;
2272
- views_count: number;
2273
- favorites_count: number;
2274
- purchases_count: number;
2275
- cart_count: number;
2276
- createdAt: Date;
2277
- updatedAt: Date;
2278
- }
2279
-
2280
- export interface ISendOtpRequest {
2281
- email: string;
2282
- }
2283
-
2284
- export interface IVerifyOtpRequest {
2285
- email: string;
2286
- code: number;
2287
- }
2288
-
2289
- export interface IVerifyOtpResponse extends ITokensResponse {
2290
- user_id: string;
2291
- }
2292
-
2293
- export interface ICreateMultiOrderResponse {
2294
- payment: IPaymentResponse;
2295
- tokens?: ITokensResponse;
2296
- }
2297
- }
2298
- }
1
+ declare namespace Components {
2
+ namespace Schemas {
3
+ export interface FilterBaseQuery {
4
+ skip: string;
5
+ limit: string;
6
+ }
7
+ export interface ITokensResponse {
8
+ access_token: string;
9
+ refresh_token: string;
10
+ }
11
+ export interface ILoginRequest {
12
+ email: string;
13
+ password: string;
14
+ type: ELoginTypes;
15
+ }
16
+ export interface ISignUpRequest {
17
+ email: string;
18
+ password: string;
19
+ }
20
+ export interface ILoginResponse extends ITokensResponse {
21
+ isSeller: boolean;
22
+ user_id: string;
23
+ isActivated: boolean;
24
+ isExistPassword: boolean;
25
+ role: ERoles;
26
+ isNewUser: boolean;
27
+ }
28
+
29
+ export type ISignUpResponse = ITokensResponse;
30
+
31
+ export interface IRecoveryRequest {
32
+ email: string;
33
+ password: string;
34
+ }
35
+
36
+ export interface IRecoveryResponse {
37
+ message: string;
38
+ }
39
+
40
+ export interface IActivationRequest {
41
+ email: string;
42
+ activation_code: number;
43
+ }
44
+
45
+ export interface IActivationResponse {
46
+ message: string;
47
+ }
48
+
49
+ export interface IRefreshRequest {
50
+ refreshToken: string;
51
+ }
52
+
53
+ export type IRefreshResponse = ITokensResponse & { is_activated: boolean };
54
+
55
+ export enum ELoginTypes {
56
+ SELLER = 'SELLER',
57
+ USER = 'USER',
58
+ WEB = 'WEB',
59
+ }
60
+
61
+ export interface ISendEmailRequest {
62
+ email: string;
63
+ }
64
+
65
+ export interface ISendEmailResponse {
66
+ message: string;
67
+ }
68
+
69
+ export interface ISignUpGoogleRequest {
70
+ access_token: string;
71
+ auth_type: ELoginTypes;
72
+ }
73
+
74
+ export type ISignUpGoogleResponse = ILoginResponse;
75
+
76
+ export interface ISignUpAppleRequest {
77
+ code: string;
78
+ auth_type: ELoginTypes;
79
+ }
80
+
81
+ export type ISignUpAppleResponse = ILoginResponse;
82
+
83
+ export interface ISignUpVkRequest {
84
+ silent_token: string;
85
+ uuid: string;
86
+ auth_type: ELoginTypes;
87
+ }
88
+
89
+ export type ISignUpVkResponse = ILoginResponse;
90
+
91
+ export enum ERoles {
92
+ ADMIN = 'ADMIN',
93
+ USER = 'USER',
94
+ }
95
+
96
+ export interface IActionsProductRequest {
97
+ toDelete: string;
98
+ toPublish: string;
99
+ toCopy: string;
100
+ toDraft: string;
101
+ toReject: string;
102
+ }
103
+
104
+ export enum EActions {
105
+ DELETE = 'toDelete',
106
+ PUBLISH = 'toPublish',
107
+ COPY = 'toCopy',
108
+ DRAFT = 'toDraft',
109
+ REJECT = 'toReject',
110
+ }
111
+
112
+ export interface IActionsProductResponse {
113
+ message: string;
114
+ }
115
+
116
+ export interface IUser {
117
+ _id: string;
118
+ tel?: number;
119
+ name?: string;
120
+ surname?: string;
121
+ patronymic?: string;
122
+ full_name?: string;
123
+ birthday?: Date;
124
+ email?: string;
125
+ role: ERoles;
126
+ vk_id?: number;
127
+ expo_push_token?: string;
128
+ number: number;
129
+ is_activated: boolean;
130
+ createdAt: Date;
131
+ updatedAt: Date;
132
+ }
133
+
134
+ export interface IShortUser {
135
+ _id: string;
136
+ tel?: number;
137
+ name?: string;
138
+ surname?: string;
139
+ patronymic?: string;
140
+ full_name?: string;
141
+ birthday?: Date;
142
+ email?: string;
143
+ number: number;
144
+ }
145
+
146
+ export interface IAdminUserQueryResponse {
147
+ users: IShortUser[];
148
+ count: number;
149
+ }
150
+
151
+ export interface IAdminUsersQueryRequest extends FilterBaseQuery {
152
+ tel?: string;
153
+ full_name?: string;
154
+ email?: string;
155
+ number?: string;
156
+ all_fields?: string;
157
+ }
158
+
159
+ export interface IAdminCreateUser {
160
+ name: string;
161
+ surname: string;
162
+ patronymic?: string;
163
+ email: string;
164
+ tel: number;
165
+ password: string;
166
+ }
167
+
168
+ export interface IAdminUpdateUser {
169
+ _id: string;
170
+ name: string;
171
+ surname: string;
172
+ patronymic?: string;
173
+ tel: number;
174
+ email: string;
175
+ }
176
+
177
+ export interface IActionsUsersRequest {
178
+ toDelete: string;
179
+ }
180
+
181
+ export interface IAddress {
182
+ _id: string;
183
+ address: string;
184
+ floor: number;
185
+ intercom?: string;
186
+ entrance: number;
187
+ index?: number;
188
+ flat: number;
189
+ createdAt: Date;
190
+ updatedAt: Date;
191
+ }
192
+
193
+ export interface IUserAddress extends IAddress {
194
+ user_id: string;
195
+ }
196
+
197
+ export interface IUpdateUser {
198
+ name: string;
199
+ surname: string;
200
+ patronymic?: string;
201
+ tel: number;
202
+ email: string;
203
+ birthday?: Date;
204
+ password?: string;
205
+ expo_push_token?: string;
206
+ }
207
+
208
+ export enum EUserTransactionsType {
209
+ PURCHASE = 'PURCHASE',
210
+ REFUND = 'REFUND',
211
+ }
212
+
213
+ export interface ICreateAddress {
214
+ user_id: string;
215
+ floor: number;
216
+ intercom: string;
217
+ entrance: number;
218
+ index: number;
219
+ flat: number;
220
+ address: string;
221
+ }
222
+
223
+ export interface IUpdateAddress {
224
+ id: string;
225
+ floor: number;
226
+ intercom: string;
227
+ entrance: number;
228
+ index: number;
229
+ flat: number;
230
+ address: string;
231
+ }
232
+
233
+ export enum EUnit {
234
+ KG = 'KG',
235
+ GR = 'GR',
236
+ }
237
+
238
+ export interface IDimension {
239
+ width: number;
240
+ height: number;
241
+ length: number;
242
+ weight: number;
243
+ in_stock: number;
244
+ unit: EUnit;
245
+ }
246
+
247
+ export interface ICharacteristic {
248
+ name: string;
249
+ value: string;
250
+ }
251
+
252
+ export enum EProductType {
253
+ PRODUCT = 'PRODUCT',
254
+ VARIATION = 'VARIATION',
255
+ }
256
+
257
+ export interface IProduct {
258
+ _id: string;
259
+ type: EProductType;
260
+ parent_id?: string | null; // Ссылка на родителя (исключительно для вариаций)
261
+ name: string;
262
+ status: EProductStatus; // Для вариаций статус всегда PUBLISHED
263
+ subCategory_id: string;
264
+ category_id: string;
265
+ seller_id: string;
266
+ vendor_code: string;
267
+ price: number;
268
+ discount?: number;
269
+ tax: number;
270
+ dimension: IDimension;
271
+ photo: string[];
272
+ desc: string;
273
+ characteristic: ICharacteristic[];
274
+ external_item_id: string | null;
275
+ variations?: IProduct[];
276
+ purchases_count: number;
277
+ number: number;
278
+ slug: string;
279
+ published_at?: Date;
280
+ entityAnalytics?: IEntityAnalytics;
281
+ createdAt: Date;
282
+ updatedAt: Date;
283
+ }
284
+
285
+ export interface IProductQueryRequest extends FilterBaseQuery {
286
+ category_id?: string;
287
+ subCategory_id?: string;
288
+ seller_id?: string;
289
+ name?: string;
290
+ status?: EProductStatus;
291
+ all_fields?: string;
292
+ type?: EProductType;
293
+ isHaveParent?: boolean;
294
+ excludeProductId?: string;
295
+ }
296
+
297
+ export interface IUserProductQueryRequest extends FilterBaseQuery {
298
+ user_id?: string;
299
+ category_id?: string;
300
+ subCategory_id?: string;
301
+ seller_id?: string;
302
+ name?: string;
303
+ priceMin?: string;
304
+ priceMax?: string;
305
+ colors?: string;
306
+ brands?: string;
307
+ sizes?: string;
308
+ materials?: string;
309
+ sortBy?: EProductsSortOptions;
310
+ }
311
+
312
+ export interface IProductQueryResponse {
313
+ products: IProductDraftResponse[];
314
+ count: number;
315
+ }
316
+
317
+ export interface IUserProductQueryResponse {
318
+ products: IProductResponse[];
319
+ subCategories: ISubCategory[];
320
+ }
321
+
322
+ export enum EProductStatus {
323
+ DRAFT = 'DRAFT',
324
+ MODERATION = 'MODERATION',
325
+ PUBLISHED = 'PUBLISHED',
326
+ REJECTED = 'REJECTED',
327
+ ARCHIVED = 'ARCHIVED',
328
+ }
329
+
330
+ export interface IProductResponse {
331
+ _id: string;
332
+ name: string;
333
+ type: EProductType;
334
+ parent_id?: string | null;
335
+ status: EProductStatus;
336
+ subCategory_id: {
337
+ _id: string;
338
+ name: string;
339
+ category_id: string;
340
+ slug: string;
341
+ };
342
+ category_id: {
343
+ _id: string;
344
+ photo: string;
345
+ name: string;
346
+ slug: string;
347
+ };
348
+ seller_id?: {
349
+ _id: string;
350
+ shop_details: IShopDetails;
351
+ delivery_ways: IDeliveryWays;
352
+ slug: string;
353
+ };
354
+ vendor_code: string;
355
+ price: number;
356
+ discount?: number;
357
+ tax: number;
358
+ dimension: IDimension;
359
+ photo: string[];
360
+ desc: string;
361
+ characteristic: ICharacteristic[];
362
+ variations?: IProduct[];
363
+ purchases_count: number;
364
+ number: number;
365
+ slug: string;
366
+ createdAt: Date;
367
+ updatedAt: Date;
368
+ is_favorite?: boolean;
369
+ reviewsData?: IReviewsData;
370
+ published_at?: Date;
371
+ entityAnalytics?: IEntityAnalytics;
372
+ }
373
+
374
+ type OptionalDimension = {
375
+ width?: number;
376
+ height?: number;
377
+ length?: number;
378
+ weight?: number;
379
+ in_stock: number;
380
+ unit?: EUnit;
381
+ };
382
+
383
+ type TOptionalProperties = Pick<
384
+ IProductResponse,
385
+ | 'category_id'
386
+ | 'subCategory_id'
387
+ | 'vendor_code'
388
+ | 'desc'
389
+ | 'characteristic'
390
+ | 'tax'
391
+ | 'photo'
392
+ | 'price'
393
+ > & {
394
+ dimension?: OptionalDimension;
395
+ };
396
+
397
+ type TRemainingProductResponseProperties = Omit<
398
+ IProductResponse,
399
+ keyof TOptionalProperties
400
+ >;
401
+
402
+ export interface IProductDraftResponse
403
+ extends TRemainingProductResponseProperties,
404
+ Partial<TOptionalProperties> {}
405
+
406
+ export interface IProductWithReviewResponse {
407
+ product: IProductResponse;
408
+ reviewsData: IReviewsData;
409
+ }
410
+
411
+ export interface IAddVariation {
412
+ _id: string;
413
+ characteristic: ICharacteristic[];
414
+ }
415
+
416
+ export interface ICreateProduct {
417
+ name: string;
418
+ status?:
419
+ | EProductStatus.DRAFT
420
+ | EProductStatus.PUBLISHED
421
+ | EProductStatus.REJECTED;
422
+ category_id: string;
423
+ subCategory_id: string;
424
+ vendor_code: string;
425
+ price: number;
426
+ tax: number;
427
+ dimension: IDimension;
428
+ photo: File[];
429
+ desc: string;
430
+ characteristic?: ICharacteristic[];
431
+ variations?: IAddVariation[];
432
+ }
433
+
434
+ export interface ICreateVariation
435
+ extends Omit<
436
+ ICreateProduct,
437
+ | 'status'
438
+ | 'category_id'
439
+ | 'subCategory_id'
440
+ | 'variations'
441
+ | 'photo'
442
+ | 'desc'
443
+ | 'characteristic'
444
+ > {
445
+ photo?: File[];
446
+ desc?: string;
447
+ seller_id: string;
448
+ }
449
+
450
+ export interface IUpdateProduct extends ICreateProduct {
451
+ id: string;
452
+ type?: EProductType;
453
+ toDeletePhotos?: string[];
454
+ toDeleteVariations?: string[];
455
+ }
456
+
457
+ export interface ICreateCart {
458
+ product_id: string;
459
+ count: number;
460
+ price: number;
461
+ }
462
+
463
+ export interface IDeleteCartRequest {
464
+ toDelete?: string;
465
+ }
466
+
467
+ export interface ICart {
468
+ _id: string;
469
+ user_id?: string | null;
470
+ session_id?: string | null;
471
+ product_id: {
472
+ _id: string;
473
+ name: string;
474
+ photo: string[];
475
+ dimension: IDimension;
476
+ price: number;
477
+ slug: string;
478
+ category_id: {
479
+ _id: string;
480
+ name: string;
481
+ slug: string;
482
+ };
483
+ subCategory_id: {
484
+ _id: string;
485
+ name: string;
486
+ slug: string;
487
+ };
488
+ seller_id: {
489
+ _id: string;
490
+ shop_details: IShopDetails;
491
+ delivery_ways: IDeliveryWays;
492
+ shops_info: IShop[];
493
+ slug: string;
494
+ };
495
+ };
496
+ count: number;
497
+ price: number;
498
+ createdAt: Date;
499
+ updatedAt: Date;
500
+ }
501
+
502
+ export interface ICreateCartResponse {
503
+ message?: string;
504
+ cartItem: ICart;
505
+ }
506
+
507
+ export interface ISetCartItemCountRequest {
508
+ count: number;
509
+ }
510
+
511
+ export interface ICategory {
512
+ _id: string;
513
+ name: string;
514
+ seoInfo?: ISeoInfo;
515
+ photo: string;
516
+ slug: string;
517
+ createdAt: Date;
518
+ updatedAt: Date;
519
+ }
520
+
521
+ export interface ISeoInfo {
522
+ title?: string;
523
+ desc?: string;
524
+ h1?: string;
525
+ seoText?: string;
526
+ }
527
+
528
+ export interface IAdminCategoryQueryRequest {
529
+ name?: string;
530
+ parsed: string;
531
+ }
532
+
533
+ export interface IGetCategoryQuery extends FilterBaseQuery {
534
+ parsed?: string;
535
+ }
536
+
537
+ export interface IParsedCategory {
538
+ value: string;
539
+ title: string;
540
+ type: string;
541
+ photo: string;
542
+ seoInfo?: ISeoInfo;
543
+ slug: string;
544
+ updatedAt: Date;
545
+ children: IParsedSubCategory[];
546
+ }
547
+
548
+ export interface IParsedSubCategory {
549
+ value: string;
550
+ title: string;
551
+ type: string;
552
+ seoInfo?: ISeoInfo;
553
+ slug: string;
554
+ updatedAt: Date;
555
+ status: ESubCategoryStatus;
556
+ }
557
+
558
+ export type ICategoryQueryResponse = ICategory[] | IParsedCategory[];
559
+
560
+ export interface ICreateCategoryRequest {
561
+ name: string;
562
+ title?: string;
563
+ desc?: string;
564
+ h1?: string;
565
+ seoText?: string;
566
+ photo: File;
567
+ }
568
+
569
+ export interface IUpdateCategoryRequest
570
+ extends Partial<ICreateCategoryRequest> {
571
+ toDeletePhoto?: string;
572
+ }
573
+
574
+ export interface ISubCategory {
575
+ _id: string;
576
+ name: string;
577
+ category_id: ICategory;
578
+ status: ESubCategoryStatus;
579
+ seoInfo?: ISeoInfo;
580
+ slug: string;
581
+ createdAt: Date;
582
+ updatedAt: Date;
583
+ }
584
+
585
+ export interface IUserSubCategoryResponse {
586
+ subCategories: ISubCategory[];
587
+ productsCount: number;
588
+ }
589
+
590
+ export interface ICreateSubCategoryRequest {
591
+ name: string;
592
+ category_id: string;
593
+ title?: string;
594
+ desc?: string;
595
+ h1?: string;
596
+ seoText?: string;
597
+ }
598
+
599
+ export interface IUpdateSubCategoryRequest
600
+ extends Partial<ICreateSubCategoryRequest> {}
601
+
602
+ export enum ESubCategoryStatus {
603
+ MODERATION = 'MODERATION',
604
+ ACTIVE = 'ACTIVE',
605
+ ARCHIVED = 'ARCHIVED',
606
+ }
607
+
608
+ export interface IBankingDetails {
609
+ name: string;
610
+ INN: string;
611
+ BIK: string;
612
+ KPP: string;
613
+ PC: string;
614
+ KC: string;
615
+ legal_address: string;
616
+ }
617
+
618
+ export type ILegalBankingDetails = Omit<
619
+ IBankingDetails,
620
+ 'KPP' | 'legal_address'
621
+ >;
622
+ export type IPhysicalBankingDetails = Partial<
623
+ Omit<IBankingDetails, 'legal_address'>
624
+ > & { INN: string };
625
+
626
+ export interface IShopDetails {
627
+ shop_name: string;
628
+ logo: string;
629
+ banner: string;
630
+ desc: string;
631
+ }
632
+
633
+ export interface IDeliveryWays {
634
+ pickup: boolean;
635
+ // own_delivery: boolean; // Появится в ближайшем будущем
636
+ delivery_to_point: boolean;
637
+ courier: boolean;
638
+ yandex_express: boolean;
639
+ }
640
+
641
+ export enum ESellerStatus {
642
+ WAITING_APPROVE = 'WAITING_APPROVE',
643
+ APPROVED = 'APPROVED',
644
+ DECLINED = 'DECLINED',
645
+ ARCHIVED = 'ARCHIVED',
646
+ }
647
+
648
+ export interface IUserSellerStatusResponse {
649
+ status: ESellerStatus | 'NOT_CREATED';
650
+ }
651
+
652
+ export interface IBalanceInfo {
653
+ balance: number;
654
+ total_turnover: number;
655
+ withdrawn: number;
656
+ }
657
+
658
+ export interface IShopAddress {
659
+ name: string;
660
+ lat: number;
661
+ lng: number;
662
+ }
663
+
664
+ export interface IShopWorkTime {
665
+ time: string;
666
+ }
667
+
668
+ export interface IShop {
669
+ _id: string;
670
+ name: string;
671
+ address: IShopAddress;
672
+ nearest_metro_station: string;
673
+ work_time?: IShopWorkTime[];
674
+ createdAt: Date;
675
+ updatedAt: Date;
676
+ }
677
+
678
+ export interface INearestPointOfCdek {
679
+ code: string;
680
+ name: string;
681
+ location: {
682
+ country_code: string;
683
+ region_code: number;
684
+ region: string;
685
+ city_code: number;
686
+ city: string;
687
+ postal_code: string;
688
+ longitude: number;
689
+ latitude: number;
690
+ address: string;
691
+ address_full: string;
692
+ };
693
+ }
694
+
695
+ export interface IMoySklad {
696
+ account_id: string | null;
697
+ api_token: string | null;
698
+ }
699
+
700
+ export interface ISeller {
701
+ _id: string;
702
+ type: ESellerTypes;
703
+ user_id: {
704
+ _id: string;
705
+ tel: number;
706
+ name: string;
707
+ surname: string;
708
+ full_name: string;
709
+ patronymic?: string;
710
+ email: string;
711
+ birthday: Date;
712
+ };
713
+ shops_info: IShop[];
714
+ nearest_point_of_cdek: INearestPointOfCdek;
715
+ banking_details: IBankingDetails;
716
+ additional_info?: ISellerAdditionalInfo;
717
+ company_info?: ISellerCompanyInfo;
718
+ shop_details: IShopDetails;
719
+ delivery_ways: IDeliveryWays;
720
+ balance_info: IBalanceInfo;
721
+ moy_sklad?: IMoySklad;
722
+ commission: number;
723
+ status: ESellerStatus;
724
+ telegram_message_id: number | null;
725
+ api_token: string | null;
726
+ slug: string;
727
+ telegram_chat_id: number | null;
728
+ telegram_api_token: string;
729
+ number: number;
730
+ createdAt: Date;
731
+ updatedAt: Date;
732
+ }
733
+
734
+ export interface ISellerShowcaseResponse {
735
+ purchasesCount: number;
736
+ averageRating: string;
737
+ reviewsCount: number;
738
+ seller: ISeller;
739
+ }
740
+
741
+ export interface ISellerSearchQueryRequest {
742
+ name?: string;
743
+ }
744
+
745
+ export interface IAdminSellersQueryRequest extends FilterBaseQuery {
746
+ number?: string;
747
+ status?: string;
748
+ full_name?: string;
749
+ shop_name?: string;
750
+ tel?: string;
751
+ all_fields?: string;
752
+ }
753
+
754
+ export interface IAdminSellersQueryResponse {
755
+ sellers: ISeller[];
756
+ count: number;
757
+ }
758
+
759
+ export interface ISellerInfo {
760
+ name: string;
761
+ surname: string;
762
+ patronymic?: string;
763
+ email: string;
764
+ tel: number;
765
+ type: ESellerTypes;
766
+ opt_otch: boolean;
767
+ birthday?: string;
768
+ }
769
+
770
+ export interface ICreateSellerInfo extends ISellerInfo {
771
+ password: string;
772
+ }
773
+
774
+ export type ICreateShopDetails = Omit<IShopDetails, 'logo' | 'banner'>;
775
+
776
+ export interface IAdminCreateSellerRequest {
777
+ seller_info: ICreateSellerInfo;
778
+ banking_details: ILegalBankingDetails;
779
+ shop_details: ICreateShopDetails;
780
+ logo: File | File[];
781
+ banner: File | File[];
782
+ }
783
+
784
+ export interface ICreateSellerRequest {
785
+ type: ESellerTypes;
786
+ name: string;
787
+ surname: string;
788
+ patronymic?: string;
789
+ tel: number;
790
+ INN: string;
791
+ shop_name: string;
792
+ send_email?: boolean;
793
+ opt_otch: boolean;
794
+ }
795
+
796
+ export interface IUpdateSellerRequest {
797
+ seller_info: Partial<ISellerInfo>;
798
+ banking_details: Partial<IBankingDetails>;
799
+ shop_details: ICreateShopDetails;
800
+ company_info: Partial<ISellerCompanyInfo>;
801
+ logo: File | File[] | string;
802
+ banner: File | File[] | string;
803
+ seller_id: string;
804
+ toDeletePhotos?: string[];
805
+ passport_details?: string;
806
+ passport_photo?: File | File[] | string;
807
+ card_number?: string;
808
+ }
809
+
810
+ export interface IActionsSellersRequest {
811
+ toDelete: string;
812
+ }
813
+
814
+ export interface ICreateSellerShopRequest {
815
+ seller_id: string;
816
+ name: string;
817
+ address: {
818
+ name: string;
819
+ lat: number;
820
+ lng: number;
821
+ };
822
+ work_time?: IShopWorkTime[];
823
+ }
824
+
825
+ export interface IAdminUpdateNearestPointOfCdekRequest
826
+ extends INearestPointOfCdek {
827
+ seller_id: string;
828
+ }
829
+
830
+ export interface IAdminUpdateDeliveryWaysRequest extends IDeliveryWays {
831
+ seller_id: string;
832
+ }
833
+
834
+ export interface IAdminChangeOrderStatus {
835
+ orderId: string;
836
+ status: EOrderStatus;
837
+ reason_of_cancel?: string;
838
+ }
839
+
840
+ export interface IAdminDenyItem {
841
+ item_id: string;
842
+ }
843
+
844
+ export interface IAdminRemoveOrderItemRequest {
845
+ current_items: IPopulatedOrderItem[];
846
+ }
847
+
848
+ export interface IAdminOrdersQueryRequest extends FilterBaseQuery {
849
+ name?: string;
850
+ from?: string;
851
+ to?: string;
852
+ number?: string;
853
+ sum?: 'asc' | 'desc';
854
+ status?: EOrderStatus;
855
+ tel?: string;
856
+ seller_id?: string;
857
+ }
858
+
859
+ export type IPopulatedOrderSeller = Pick<
860
+ ISeller,
861
+ '_id' | 'shop_details' | 'user_id' | 'nearest_point_of_cdek' | 'slug'
862
+ >;
863
+
864
+ export type IPopulatedOrderUser = Pick<
865
+ IUser,
866
+ | '_id'
867
+ | 'name'
868
+ | 'full_name'
869
+ | 'surname'
870
+ | 'patronymic'
871
+ | 'tel'
872
+ | 'email'
873
+ | 'birthday'
874
+ >;
875
+
876
+ export type TPopulatedProductId = Pick<
877
+ IProduct,
878
+ '_id' | 'name' | 'vendor_code' | 'photo' | 'discount'
879
+ >;
880
+
881
+ export interface IPopulatedOrderItem
882
+ extends Omit<IOrderItem, 'product_id'> {
883
+ product_id: IProductResponse;
884
+ }
885
+
886
+ export type IPopulatedOrder = Omit<
887
+ IOrder,
888
+ 'items' | 'seller_id' | 'user_id' | 'shop_id'
889
+ > & {
890
+ items: IPopulatedOrderItem[];
891
+ seller_id?: IPopulatedOrderSeller;
892
+ user_id?: IPopulatedOrderUser;
893
+ shop_id: IShop;
894
+ };
895
+
896
+ export interface IAdminGetOrderResponse {
897
+ order: IPopulatedOrder;
898
+ commission: number;
899
+ }
900
+
901
+ export interface IAdminOrdersQueryResponse {
902
+ orders: IPopulatedOrder[];
903
+ count: number;
904
+ }
905
+
906
+ export interface IAdminDeliveryInfo {
907
+ receive_method: ERecieveMethod;
908
+ preparation_date: Date;
909
+ address?: string;
910
+ shop_id?: string;
911
+ }
912
+
913
+ export interface IAdminCdekInfo {
914
+ delivery_sum: number;
915
+ tracking: string;
916
+ }
917
+
918
+ export interface IAdminUpdateOrderRequest {
919
+ note?: string;
920
+ delivery_info: Partial<IAdminDeliveryInfo>;
921
+ cdek_info?: Partial<IAdminCdekInfo>;
922
+ invoice?: File;
923
+ items: IPopulatedOrderItem[];
924
+ }
925
+
926
+ export type OrderAddress = Omit<
927
+ IAddress,
928
+ 'user_id' | '_id' | 'createdAt' | 'updatedAt'
929
+ >;
930
+
931
+ export enum EOrderStatus {
932
+ NOT_PAID = 'NOT_PAID',
933
+ ON_CONFIRMATION = 'ON_CONFIRMATION',
934
+ CONFIRMED_BY_SELLER = 'CONFIRMED_BY_SELLER',
935
+ IN_DELIVERY = 'IN_DELIVERY',
936
+ WAITING_IN_POINT = 'WAITING_IN_POINT',
937
+ FINISHED = 'FINISHED',
938
+ CANCELED = 'CANCELED',
939
+ ARCHIVED = 'ARCHIVED',
940
+ }
941
+
942
+ export interface IDeliveryAddress extends OrderAddress {
943
+ lat: number;
944
+ lng: number;
945
+ }
946
+
947
+ export interface IDeliveryInfo {
948
+ delivery_sum: number;
949
+ address: IDeliveryAddress;
950
+ tel: number;
951
+ full_name: string;
952
+ yandex_uuid?: string;
953
+ cdek_barcode?: string;
954
+ type?: DeliveryTypes;
955
+ yandex_offer?: OfferDto;
956
+ comment?: string;
957
+ }
958
+
959
+ export interface IPVZ {
960
+ code: string;
961
+ name: string;
962
+ location: {
963
+ country_code: string;
964
+ region_code: number;
965
+ region: string;
966
+ city_code: number;
967
+ city: string;
968
+ postal_code: string;
969
+ longitude: number;
970
+ latitude: number;
971
+ address: string;
972
+ address_full: string;
973
+ };
974
+ phones: [
975
+ {
976
+ number: string;
977
+ }
978
+ ];
979
+ email: string;
980
+ delivery_sum: number;
981
+ }
982
+
983
+ export interface IPickUpPoint {
984
+ shop_id: string;
985
+ }
986
+
987
+ export enum ERecieveMethod {
988
+ PICKUP_POINT = 'PICKUP_POINT',
989
+ COURIER = 'COURIER',
990
+ PVZ = 'PVZ',
991
+ EXPRESS = 'EXPRESS',
992
+ }
993
+
994
+ export enum EOrderItemsStatus {
995
+ AGREED = 'AGREED',
996
+ DENIED = 'DENIED',
997
+ }
998
+
999
+ export interface IOrderItem {
1000
+ _id: string;
1001
+ product_id: string;
1002
+ count: number;
1003
+ price: number; // Сумма за одну единицу товара * количество товаров
1004
+ dimension: IDimension; // Габариты за единицу товара
1005
+ items_status: EOrderItemsStatus;
1006
+ }
1007
+
1008
+ export interface ICheckIsAlsoInStock {
1009
+ cartItems: ICart[];
1010
+ }
1011
+
1012
+ export interface ICreateOrder {
1013
+ items: Omit<IOrderItem, '_id' | 'items_status'>[];
1014
+ receive_method: ERecieveMethod;
1015
+ receive_method_data: IDeliveryInfo | IPVZ | IPickUpPoint;
1016
+ seller_id: string;
1017
+ }
1018
+
1019
+ export interface IGetAllOrders {
1020
+ user_id: string;
1021
+ skip: number;
1022
+ limit: number;
1023
+ }
1024
+
1025
+ export type IPopulatedOrderShop = IShop;
1026
+
1027
+ export interface IPopulatedOrderItemApp
1028
+ extends Omit<IOrderItem, 'product_id'> {
1029
+ product_id: Pick<
1030
+ IProduct,
1031
+ '_id' | 'name' | 'photo' | 'discount' | 'slug' | 'status'
1032
+ >;
1033
+ }
1034
+
1035
+ export type IPopulatedOrderUserApp = Pick<
1036
+ IUser,
1037
+ | '_id'
1038
+ | 'name'
1039
+ | 'full_name'
1040
+ | 'surname'
1041
+ | 'patronymic'
1042
+ | 'tel'
1043
+ | 'email'
1044
+ | 'birthday'
1045
+ >;
1046
+
1047
+ export type IPopulatedOrderApp = Omit<
1048
+ IOrder,
1049
+ 'items' | 'shop_id' | 'user_id'
1050
+ > & {
1051
+ items: IPopulatedOrderItemApp[];
1052
+ user_id: IPopulatedOrderUserApp;
1053
+ shop_id: IPopulatedOrderShop;
1054
+ };
1055
+
1056
+ export enum EReasonOfCancel {
1057
+ CHANGED_DELIVERY_DATE = 'Перенесли срок доставки',
1058
+ INCORRECT_CREATED_ORDER = 'Хочу изменить заказ и оформить заново',
1059
+ FOUND_CHEAPER = 'Нашел дешевле',
1060
+ WRONG_ADDRESS = 'Указал неверный адрес',
1061
+ OTHER = 'Другое',
1062
+ }
1063
+
1064
+ export interface ICancelOrderRequest {
1065
+ orderId: string;
1066
+ reason_of_cancel: EReasonOfCancel;
1067
+ }
1068
+
1069
+ export interface ICreateMultiOrder {
1070
+ orders: ICreateOrder[];
1071
+ sum: number;
1072
+ tel: number;
1073
+ email: string;
1074
+ name: string;
1075
+ surname: string;
1076
+ patronymic?: string;
1077
+ }
1078
+
1079
+ export interface IDeliveryFullInfo extends IDeliveryInfo {
1080
+ tracking: string;
1081
+ invoice: string;
1082
+ }
1083
+
1084
+ export interface IGetCDEKOffices {
1085
+ weight_max?: string;
1086
+ city: string; // city or city_district from dadata
1087
+ }
1088
+
1089
+ export interface ICDEKOffice {
1090
+ code: string;
1091
+ name: string;
1092
+ uuid: string;
1093
+ address_comment: string;
1094
+ nearest_metro_station: string;
1095
+ work_time: string;
1096
+ phones: [
1097
+ {
1098
+ number: string;
1099
+ }
1100
+ ];
1101
+ email: string;
1102
+ note: string;
1103
+ type: string;
1104
+ owner_code: string;
1105
+ take_only: boolean;
1106
+ is_handout: boolean;
1107
+ is_reception: boolean;
1108
+ is_dressing_room: boolean;
1109
+ is_ltl: boolean;
1110
+ have_cashless: boolean;
1111
+ have_cash: boolean;
1112
+ allowed_cod: boolean;
1113
+ site: string;
1114
+ work_time_list: [
1115
+ {
1116
+ day: number;
1117
+ time: string;
1118
+ }
1119
+ ];
1120
+ weight_min: number;
1121
+ weight_max: number;
1122
+ location: {
1123
+ country_code: string;
1124
+ region_code: number;
1125
+ region: string;
1126
+ city_code: number;
1127
+ city: string;
1128
+ fias_guid: string;
1129
+ postal_code: string;
1130
+ longitude: number;
1131
+ latitude: number;
1132
+ address: string;
1133
+ address_full: string;
1134
+ };
1135
+ fulfillment: boolean;
1136
+ }
1137
+
1138
+ export interface GetDeliverySum {
1139
+ address: string;
1140
+ type: ERecieveMethod.COURIER | ERecieveMethod.PVZ;
1141
+ items: Omit<IOrderItem, '_id' | 'items_status'>[];
1142
+ seller_id: string;
1143
+ }
1144
+
1145
+ export interface IDeliverySum {
1146
+ delivery_sum: number;
1147
+ period_min: number;
1148
+ period_max: number;
1149
+ calendar_min: number;
1150
+ calendar_max: number;
1151
+ weight_calc: number;
1152
+ services: [
1153
+ {
1154
+ code: string;
1155
+ sum: number;
1156
+ }
1157
+ ];
1158
+ total_sum: number;
1159
+ currency: string;
1160
+ }
1161
+
1162
+ export interface IOrder {
1163
+ _id: string;
1164
+ total_received: number; // Сколько всего заплатил покупатель за этот заказ (сумма товаров + доставки)
1165
+ current_commission: number; // Текущая комиссия продавца за заказ (Сумма товаров * комиссию продавца / 100)
1166
+ sum: number;
1167
+ full_sum: number; // Сумма с учетом доставки и коммиссии сервиса
1168
+ weight: number; // Общий вес в граммах
1169
+ user_id?: string;
1170
+ items: IOrderItem[];
1171
+ seller_id?: string;
1172
+ receive_method: ERecieveMethod;
1173
+ delivery_info?: Partial<IDeliveryFullInfo>;
1174
+ shop_id?: string;
1175
+ pvz?: Partial<IPVZ>;
1176
+ status: EOrderStatus;
1177
+ preparation_date?: Date;
1178
+ note?: string;
1179
+ reason_of_cancel?: string;
1180
+ number: number;
1181
+ createdAt: Date;
1182
+ updatedAt: Date;
1183
+ type?: DeliveryTypes;
1184
+ yandex_offer?: OfferDto;
1185
+ }
1186
+
1187
+ export interface IAdminMultiOrderResponse
1188
+ extends Omit<IMultiOrder, 'orders'> {
1189
+ orders: IPopulatedOrder[];
1190
+ }
1191
+
1192
+ export interface IMultiOrder {
1193
+ _id: string;
1194
+ user_id: string;
1195
+ sum: number;
1196
+ orders: string[];
1197
+ payment_id: string | null;
1198
+ number: number;
1199
+ status: EMultiOrderStatus;
1200
+ createdAt: Date;
1201
+ updatedAt: Date;
1202
+ }
1203
+
1204
+ export interface IPaymentCheckResponse {
1205
+ id: string;
1206
+ status: string;
1207
+ amount: {
1208
+ value: string;
1209
+ currency: string;
1210
+ };
1211
+ description: string;
1212
+ captured_at: string;
1213
+ created_at: string;
1214
+ metadata: {
1215
+ multiOrderId: string;
1216
+ multiOrderNumber: string;
1217
+ };
1218
+ confirmation: IConfirmation;
1219
+ purchase_unique: boolean;
1220
+ }
1221
+
1222
+ export type IConfirmationType = 'embedded' | 'external' | 'qr' | 'redirect';
1223
+
1224
+ export interface IConfirmation {
1225
+ type: IConfirmationType;
1226
+ locale?: string;
1227
+ confirmation_token?: string;
1228
+ confirmation_data?: string;
1229
+ confirmation_url?: string;
1230
+ enforce?: boolean;
1231
+ return_url?: string;
1232
+ }
1233
+
1234
+ export interface IPaymentResponse {
1235
+ id: string;
1236
+ status: string;
1237
+ amount: {
1238
+ value: string;
1239
+ currency: string;
1240
+ };
1241
+ description: string;
1242
+ created_at: string;
1243
+ confirmation: IConfirmation;
1244
+ metadata: {
1245
+ multiOrderId: string;
1246
+ multiOrderNumber: string;
1247
+ };
1248
+ }
1249
+
1250
+ export enum EMultiOrderStatus {
1251
+ CANCELED = 'CANCELED',
1252
+ PAID = 'PAID',
1253
+ PENDING = 'PENDING',
1254
+ }
1255
+
1256
+ export enum EComplaintsReason {
1257
+ NOT_MATCH_TO_DESC = 'NOT_MATCH_TO_DESC',
1258
+ INCORRECT_PHOTO = 'INCORRECT_PHOTO',
1259
+ DAMAGED_GOODS = 'DAMAGED_GOODS',
1260
+ POOR_QUALITY = 'POOR_QUALITY',
1261
+ FRAUD = 'FRAUD',
1262
+ OTHER = 'OTHER',
1263
+ }
1264
+
1265
+ export interface IComplaints {
1266
+ _id: string;
1267
+ user_id: string;
1268
+ product_id: string;
1269
+ text?: string;
1270
+ reason: EComplaintsReason;
1271
+ }
1272
+
1273
+ export interface ICreateComplaints {
1274
+ product_id: string;
1275
+ text?: string;
1276
+ reason: EComplaintsReason;
1277
+ }
1278
+
1279
+ export enum EReviewEntityType {
1280
+ PRODUCT = 'PRODUCT',
1281
+ HORSE = 'HORSE',
1282
+ SERVICE = 'SERVICE',
1283
+ }
1284
+
1285
+ export enum ECreatorType {
1286
+ SELLER = 'SELLER',
1287
+ USER = 'USER',
1288
+ }
1289
+
1290
+ export interface IReview {
1291
+ _id: string;
1292
+ user_id?: string;
1293
+ entity_id: string;
1294
+ entity_type: EReviewEntityType;
1295
+ creator_id: string;
1296
+ creator_type: ECreatorType;
1297
+ rating: number;
1298
+ text: string;
1299
+ anonymity: boolean;
1300
+ }
1301
+
1302
+ export interface IReviewsRequest {
1303
+ entity_id: string;
1304
+ entity_type: EReviewEntityType;
1305
+ creator_id: string;
1306
+ creator_type: ECreatorType;
1307
+ }
1308
+
1309
+ export interface IGetReviewsRequest
1310
+ extends Partial<FilterBaseQuery & IReviewsRequest> {}
1311
+
1312
+ export interface IReviewResponse {
1313
+ _id: string;
1314
+ user_id: {
1315
+ _id: string;
1316
+ tel: number;
1317
+ name: string;
1318
+ birthday: Date;
1319
+ email: string;
1320
+ full_name: string;
1321
+ patronymic: string;
1322
+ surname: string;
1323
+ };
1324
+ entity_id: string; // ID сущности, к которой привязан отзыв (например, Product или Horse)
1325
+ entity_type: EReviewEntityType; // Тип сущности (Product, Horse и т.д.)
1326
+ creator_id: string; // ID создателя сущности (продавец или пользователь)
1327
+ creator_type: ECreatorType; // Тип создателя (SELLER или USER)
1328
+ rating: number;
1329
+ text?: string;
1330
+ anonymity: boolean;
1331
+ createdAt: Date;
1332
+ updatedAt: Date;
1333
+ }
1334
+
1335
+ export interface IGetReviewDataRequest extends Partial<IReviewsRequest> {}
1336
+
1337
+ export interface IReviewsData {
1338
+ count: number;
1339
+ averageRating: string;
1340
+ sellerName?: string;
1341
+ }
1342
+
1343
+ export interface ICreateReviewRequest {
1344
+ entity_id: string;
1345
+ entity_type: EReviewEntityType;
1346
+ text?: string;
1347
+ anonymity: boolean;
1348
+ rating: number;
1349
+ }
1350
+
1351
+ export interface IDeleteReviewQuery {
1352
+ toDelete: string;
1353
+ }
1354
+
1355
+ export enum ESellerTransactionsType {
1356
+ SALE = 'SALE',
1357
+ FINE = 'FINE',
1358
+ WITHDRAW = 'WITHDRAW',
1359
+ REFUND = 'REFUND',
1360
+ }
1361
+
1362
+ export interface ISellerTransactions {
1363
+ _id: string;
1364
+ total_received: number; // Сумма которую оплатил покупатель за этот заказ (сумма товаров + сумма доставки)
1365
+ type: ESellerTransactionsType;
1366
+ sum: number;
1367
+ admin_id?: string;
1368
+ order_id: string;
1369
+ comment?: string;
1370
+ commission: number;
1371
+ delivery_sum?: number;
1372
+ payment_id: string;
1373
+ seller_id: string;
1374
+ createdAt: Date;
1375
+ updatedAt: Date;
1376
+ }
1377
+
1378
+ export interface ICreateSellerTransactions {
1379
+ type: ESellerTransactionsType;
1380
+ sum: number;
1381
+ comment?: string;
1382
+ }
1383
+
1384
+ export interface IAdminGetTransactionsRequest extends FilterBaseQuery {
1385
+ type?: ESellerTransactionsType;
1386
+ sum?: 'asc' | 'desc';
1387
+ from?: string;
1388
+ to?: string;
1389
+ seller_id?: string;
1390
+ order_id?: string;
1391
+ }
1392
+
1393
+ export interface IAdminTransactionsQueryResponse {
1394
+ transactions: ISellerTransactions[];
1395
+ count: number;
1396
+ }
1397
+
1398
+ export interface IAdminTopSalesQueryRequest extends FilterBaseQuery {
1399
+ seller_id: string;
1400
+ }
1401
+
1402
+ export interface IAdminTopSalesResponse {
1403
+ products: IProduct[];
1404
+ count: number;
1405
+ }
1406
+
1407
+ export interface IAdminChangeCommissionRequest {
1408
+ commission: number;
1409
+ }
1410
+
1411
+ export interface IAdminChangeCommissionResponse {
1412
+ commission: number;
1413
+ }
1414
+
1415
+ export interface IAdminGetChartDataQueryRequest {
1416
+ year: string;
1417
+ seller_id: string;
1418
+ }
1419
+
1420
+ export interface IAdminGetChartDataResponse {
1421
+ [key: string]: number;
1422
+ }
1423
+
1424
+ export interface IAdminCreateSellerTransactionRequest {
1425
+ type: ESellerTransactionsType;
1426
+ sum: number;
1427
+ }
1428
+
1429
+ export interface IAdminAddCustomRefundTransactionRequest {
1430
+ custom_sum: number;
1431
+ comment: string;
1432
+ }
1433
+
1434
+ export enum ENotificationType {
1435
+ ORDER = 'ORDER',
1436
+ PRODUCT = 'PRODUCT',
1437
+ COLLECTION = 'COLLECTION',
1438
+ FAVORITES = 'FAVORITES',
1439
+ }
1440
+
1441
+ export interface IAdminChangeSellerStatusRequest {
1442
+ status: ESellerStatus.APPROVED | ESellerStatus.DECLINED;
1443
+ }
1444
+
1445
+ export enum ESellerTypes {
1446
+ PHYSICAL = 'PHYSICAL', // Физическое лицо
1447
+ LEGAL = 'LEGAL', // Юридическое лицо
1448
+ }
1449
+
1450
+ export enum ESellerLegalTypes {
1451
+ LEGAL = 'LEGAL',
1452
+ INDIVIDUAL = 'INDIVIDUAL',
1453
+ }
1454
+
1455
+ export enum ESellerLocaleTypes {
1456
+ PHYSICAL = 'Физическое лицо',
1457
+ LEGAL = 'Юридическое лицо',
1458
+ }
1459
+
1460
+ export interface IGetInfoOfLegalRequest {
1461
+ INN: string;
1462
+ }
1463
+
1464
+ export interface IСheckCleanOfPassportRequest {
1465
+ passport_details: string;
1466
+ }
1467
+
1468
+ export interface ICleanPassportResponse {
1469
+ source: string;
1470
+ series: string;
1471
+ number: string;
1472
+ qc: number; // Check EPassportQc
1473
+ }
1474
+
1475
+ export enum EPassportQc {
1476
+ 'Действующий паспорт' = 0,
1477
+ 'Неправильный формат серии или номера' = 1,
1478
+ 'Исходное значение пустое' = 2,
1479
+ 'Недействительный паспорт' = 10,
1480
+ }
1481
+
1482
+ export enum ECompanyStatus {
1483
+ 'ACTIVE' = 'ACTIVE',
1484
+ 'LIQUIDATING' = 'LIQUIDATING',
1485
+ 'LIQUIDATED' = 'LIQUIDATED',
1486
+ 'BANKRUPT' = 'BANKRUPT',
1487
+ 'REORGANIZING' = 'REORGANIZING',
1488
+ }
1489
+
1490
+ export interface ISuggestion {
1491
+ value: string; // Название компании
1492
+ unrestricted_value: string;
1493
+ data: {
1494
+ kpp: string;
1495
+ branch_type: string;
1496
+ type: ESellerLegalTypes;
1497
+ state: {
1498
+ status: ECompanyStatus;
1499
+ code: null;
1500
+ };
1501
+ name: {
1502
+ full_with_opf: string;
1503
+ short_with_opf: string;
1504
+ };
1505
+ inn: string;
1506
+ ogrn: string;
1507
+ okpo: string;
1508
+ address: {
1509
+ value: string;
1510
+ };
1511
+ };
1512
+ }
1513
+
1514
+ export interface ICreatePhysicalSellerRequest extends ICreateSellerRequest {
1515
+ birthday: string;
1516
+ passport_details: string;
1517
+ passport_photo: File;
1518
+ }
1519
+
1520
+ export interface ISellerAdditionalInfo {
1521
+ passport_details?: string;
1522
+ passport_photo?: string;
1523
+ card_number?: string;
1524
+ }
1525
+
1526
+ export interface ISellerCompanyInfo {
1527
+ name: string;
1528
+ okpo: string;
1529
+ ogrn: string;
1530
+ type: ESellerLegalTypes;
1531
+ }
1532
+
1533
+ export interface IGetInfoOfPhysicRequest {
1534
+ name: string;
1535
+ surname: string;
1536
+ patronymic?: string;
1537
+ birthday: Date;
1538
+ passport_details: string;
1539
+ opt_otch: boolean;
1540
+ INN: string;
1541
+ }
1542
+
1543
+ export interface IGetInfoOfPhysicResponse {
1544
+ inn?: string;
1545
+ captcha_required: boolean;
1546
+ code: string; // 0 - Не найден, 1 - Все окей
1547
+ }
1548
+
1549
+ export interface ICheckSellerDataForCorrectness {
1550
+ name: string;
1551
+ surname: string;
1552
+ patronymic?: string;
1553
+ opt_otch: boolean;
1554
+ INN: string;
1555
+ birthday: Date;
1556
+ passport_details: string;
1557
+ }
1558
+
1559
+ export enum ECheckSellerDataErrors {
1560
+ 'INVALID_PASSPORT' = 'INVALID_PASSPORT',
1561
+ 'INCORRECT_INN' = 'INCORRECT_INN',
1562
+ 'INN_NOT_FOUND' = 'INN_NOT_FOUND',
1563
+ }
1564
+
1565
+ export interface IAdminCreatePhysicalSellerRequest
1566
+ extends Omit<IAdminCreateSellerRequest, 'banking_details'> {
1567
+ banking_details: IPhysicalBankingDetails;
1568
+ passport_details: string;
1569
+ passport_photo: File | File[];
1570
+ card_number?: string;
1571
+ }
1572
+
1573
+ export interface IUserWithSellerType extends IUser {
1574
+ type: EUserSellerType;
1575
+ }
1576
+
1577
+ export enum EUserSellerType {
1578
+ 'PHYSICAL' = 'PHYSICAL',
1579
+ 'LEGAL' = 'LEGAL',
1580
+ 'NOT_SELLER' = 'NOT_SELLER',
1581
+ }
1582
+
1583
+ export interface IUpdateMultiOrderStatusRequest {
1584
+ _id: string;
1585
+ status: EMultiOrderStatus;
1586
+ reason_of_cancel: EReasonOfCancel;
1587
+ }
1588
+
1589
+ export interface IUserRandomProductQueryRequest extends OptionalUserQuery {
1590
+ size: string;
1591
+ category_id?: string;
1592
+ subCategory_id?: string;
1593
+ }
1594
+
1595
+ export enum ECheckForFillingSellerDataError {
1596
+ SHOP_IS_NOT_EXIST = 'SHOP_IS_NOT_EXIST',
1597
+ CDEK_POINT_IS_NOT_EXIST = 'CDEK_POINT_IS_NOT_EXIST',
1598
+ DELIVERY_WAYS_IS_NOT_EXIST = 'DELIVERY_WAYS_IS_NOT_EXIST',
1599
+ SELLER_INFO_IS_NOT_FILLED_OUT = 'SELLER_INFO_IS_NOT_FILLED_OUT',
1600
+ BANKING_DETAILS_IS_NOT_FILLED_OUT = 'BANKING_DETAILS_IS_NOT_FILLED_OUT',
1601
+ }
1602
+
1603
+ export interface IAdminCreateWithdrawalRequest {
1604
+ sum: number;
1605
+ }
1606
+
1607
+ export interface IAddressSuggestionRequest {
1608
+ address: string;
1609
+ isCityOnly?: 'true' | 'false';
1610
+ }
1611
+
1612
+ export interface IAddressSuggestion {
1613
+ value: string;
1614
+ unrestricted_value: string;
1615
+ data: {
1616
+ city: string;
1617
+ city_district: string;
1618
+ region_fias_id: string;
1619
+ city_fias_id: string;
1620
+ city_kladr_id: string;
1621
+ fias_id: string;
1622
+ fias_code: null;
1623
+ fias_level: string;
1624
+ kladr_id: string;
1625
+ geo_lat: string | null;
1626
+ geo_lon: string | null;
1627
+ };
1628
+ }
1629
+
1630
+ export interface IAddressSuggestionResponse {
1631
+ suggestions: IAddressSuggestion[];
1632
+ }
1633
+
1634
+ export interface IBanner {
1635
+ _id: string;
1636
+ photo: string;
1637
+ position: number;
1638
+ seller_id: string;
1639
+ createdAt: Date;
1640
+ updatedAt: Date;
1641
+ }
1642
+
1643
+ export interface IMoySkladLinkerRequest {
1644
+ updateData: {
1645
+ linker_id: string;
1646
+ category_id: string;
1647
+ subCategory_id: string;
1648
+ }[];
1649
+ }
1650
+
1651
+ export interface IMoySkladLinker {
1652
+ pathName: string;
1653
+ seller_id: string;
1654
+ product_ids: string[];
1655
+ }
1656
+
1657
+ export interface IVersion {
1658
+ version: string;
1659
+ isForceToUpdate: boolean;
1660
+ }
1661
+
1662
+ export interface IAppVersion {
1663
+ ios: IVersion;
1664
+ android: IVersion;
1665
+ }
1666
+
1667
+ export interface NotificationData {
1668
+ body: string;
1669
+ data?: InternalPushMessageData | ExternalPushMessageData;
1670
+ title: string;
1671
+ }
1672
+
1673
+ export interface INotification {
1674
+ _id: string;
1675
+ user_id?: string;
1676
+ push_token_id: string;
1677
+ message: NotificationData;
1678
+ status: ENotificationStatus;
1679
+ createdAt: Date;
1680
+ }
1681
+
1682
+ export enum ENotificationStatus {
1683
+ READ = 'READ',
1684
+ UNREAD = 'UNREAD',
1685
+ }
1686
+
1687
+ export interface ISendNotifications {
1688
+ to: ENotificationRecipients;
1689
+ notificationData: NotificationData;
1690
+ }
1691
+
1692
+ export enum ENotificationRecipients {
1693
+ ALL = 'ALL',
1694
+ SELLERS = 'SELLERS',
1695
+ USERS = 'USERS',
1696
+ }
1697
+
1698
+ export interface IHintCharacteristics {
1699
+ name: string;
1700
+ values: string[];
1701
+ }
1702
+
1703
+ export interface IPossibleCombinations {
1704
+ combinations: ICharacteristic[][];
1705
+ characteristics: { name: string; values: string[] }[];
1706
+ }
1707
+
1708
+ export interface IGetVariationByCharacteristics {
1709
+ product_id: string;
1710
+ characteristics: ICharacteristic[];
1711
+ }
1712
+
1713
+ export enum ESex {
1714
+ STALLION = 'stallion',
1715
+ MARE = 'mare',
1716
+ GELDING = 'gelding',
1717
+ }
1718
+
1719
+ export interface ICompetitionHistory {
1720
+ name: string;
1721
+ place: string;
1722
+ }
1723
+
1724
+ export interface ILocation {
1725
+ name: string;
1726
+ coordinates?: number[]; // [lng, lat]
1727
+ lat: number;
1728
+ lng: number;
1729
+ }
1730
+
1731
+ export interface IPreferredCommunication {
1732
+ telegram: boolean;
1733
+ whatsapp: boolean;
1734
+ calls: boolean;
1735
+ sms: boolean;
1736
+ }
1737
+
1738
+ export interface ICommunication {
1739
+ tel: number;
1740
+ preferredCommunication: IPreferredCommunication;
1741
+ }
1742
+
1743
+ export interface ICreateHorse {
1744
+ name: string;
1745
+ sex: ESex;
1746
+ breed: string;
1747
+ suit: string;
1748
+ category: string;
1749
+ birthDate: string;
1750
+ withersHeight: number;
1751
+ price: number;
1752
+ location: ILocation;
1753
+ images: File | File[];
1754
+ video_cover?: File;
1755
+ desc?: string;
1756
+ reg_number?: string;
1757
+ genealogy?: string;
1758
+ birthplace?: string;
1759
+ documents?: File | File[];
1760
+ documentsNames?: string[];
1761
+ competition_history?: ICompetitionHistory[];
1762
+ communication: ICommunication;
1763
+ }
1764
+
1765
+ export interface IUpdateHorse extends Partial<ICreateHorse> {
1766
+ toRemoveImages?: string[];
1767
+ toRemoveVideoCover?: string;
1768
+ toRemoveDocuments?: string[]; // Array of documents.fileName
1769
+ }
1770
+
1771
+ export enum EHorseStatus {
1772
+ MODERATION = 'MODERATION',
1773
+ PUBLISHED = 'PUBLISHED',
1774
+ REJECTED = 'REJECTED',
1775
+ ARCHIVED = 'ARCHIVED',
1776
+ }
1777
+
1778
+ export interface IHorse {
1779
+ _id: string;
1780
+ user_id: string;
1781
+ status: EHorseStatus;
1782
+ name: string;
1783
+ sex: ESex;
1784
+ breed: string;
1785
+ suit: string;
1786
+ birthDate: Date;
1787
+ category: string;
1788
+ withersHeight: number;
1789
+ price: number;
1790
+ location: ILocation;
1791
+ images: string[];
1792
+ video_cover: string | null;
1793
+ desc: string | null;
1794
+ reg_number: string | null;
1795
+ genealogy: string | null;
1796
+ birthplace: string | null;
1797
+ documents: IDocument[] | null;
1798
+ competition_history: ICompetitionHistory[] | null;
1799
+ communication: ICommunication;
1800
+ reason_of_cancel?: string;
1801
+ distance?: number; // Расстояние пользователя до лошади (если передано гео)
1802
+ archived_reason?: string;
1803
+ telegram_message_id: string | null;
1804
+ slug: string;
1805
+ number: number;
1806
+ published_at?: Date;
1807
+ entityAnalytics?: IEntityAnalytics;
1808
+ createdAt: Date;
1809
+ updatedAt: Date;
1810
+ }
1811
+
1812
+ export interface IDocument {
1813
+ name: string;
1814
+ fileName: string;
1815
+ }
1816
+
1817
+ export interface IPopulatedHorse
1818
+ extends Omit<IHorse, 'user_id' | 'breed' | 'suit' | 'category'> {
1819
+ user_id: IPopulatedOrderUserApp;
1820
+ breed: IBreed;
1821
+ suit: ISuit;
1822
+ category: IHorseCategory;
1823
+ is_favorite?: boolean;
1824
+ }
1825
+
1826
+ export interface IBreed {
1827
+ _id: string;
1828
+ name: string;
1829
+ createdAt: Date;
1830
+ updatedAt: Date;
1831
+ }
1832
+
1833
+ export interface ISuit {
1834
+ _id: string;
1835
+ name: string;
1836
+ createdAt: Date;
1837
+ updatedAt: Date;
1838
+ }
1839
+
1840
+ export interface IHorseCategory {
1841
+ _id: string;
1842
+ name: string;
1843
+ createdAt: Date;
1844
+ updatedAt: Date;
1845
+ }
1846
+
1847
+ export interface IHorseFormInformation {
1848
+ breeds: IBreed[];
1849
+ suits: ISuit[];
1850
+ categories: IHorseCategory[];
1851
+ }
1852
+
1853
+ export enum EViewCountEntityType {
1854
+ HORSE = 'HORSE',
1855
+ PRODUCT = 'PRODUCT',
1856
+ SERVICE = 'SERVICE',
1857
+ }
1858
+
1859
+ export interface IViewCount {
1860
+ entity_type: EViewCountEntityType;
1861
+ entity_id: string;
1862
+ count: number;
1863
+ createdAt: Date;
1864
+ updatedAt: Date;
1865
+ }
1866
+
1867
+ export interface IPopulatedHorseWViewCount extends IPopulatedHorse {
1868
+ viewCount: IViewCount;
1869
+ }
1870
+
1871
+ export interface IGetCombinedHorses {
1872
+ user_id?: string; // objectid
1873
+ sex?: 'stallion' | 'mare' | 'gelding';
1874
+ breed?: string; // objectid
1875
+ suit?: string; // objectid
1876
+ ageMin?: string;
1877
+ ageMax?: string;
1878
+ withersHeightMin?: string;
1879
+ withersHeightMax?: string;
1880
+ priceMin?: string;
1881
+ priceMax?: string;
1882
+ category?: string; // objectid
1883
+ lat?: string; // user lat
1884
+ lng?: string; // user lng
1885
+ radius?: string;
1886
+ }
1887
+
1888
+ export interface IReverseGeocodingRequest {
1889
+ lat: number;
1890
+ lon: number;
1891
+ count?: number;
1892
+ radius_meters?: number;
1893
+ }
1894
+
1895
+ export interface IHorseQueryRequest extends FilterBaseQuery {}
1896
+
1897
+ export interface IAdminHorsesQueryResponse {
1898
+ horses: IPopulatedHorse[];
1899
+ count: number;
1900
+ }
1901
+
1902
+ export interface IActionsHorseRequest {
1903
+ toDelete: string;
1904
+ }
1905
+
1906
+ export interface IAdminChangeHorseStatusRequest {
1907
+ status: EHorseStatus;
1908
+ reason_of_cancel?: string;
1909
+ }
1910
+
1911
+ export interface InternalPushMessageData {
1912
+ type: ENotificationType;
1913
+ typeId: string;
1914
+ typeSlug?: string | null;
1915
+ }
1916
+
1917
+ export interface ExternalPushMessageData {
1918
+ url: string;
1919
+ }
1920
+
1921
+ export interface IGetHorseViewHistory extends FilterBaseQuery {
1922
+ lat?: string; // user lat
1923
+ lng?: string; // user lng
1924
+ }
1925
+ export interface IPriceHistorySearch {
1926
+ priceMin?: number;
1927
+ priceMax?: number;
1928
+ }
1929
+
1930
+ export enum ECollectionStatus {
1931
+ PUBLISHED = 'PUBLISHED',
1932
+ ARCHIVED = 'ARCHIVED',
1933
+ }
1934
+ export interface IPopulatedCollection
1935
+ extends Omit<ICollection, 'products'> {
1936
+ products: IProductResponse[];
1937
+ }
1938
+
1939
+ export interface ICollectionQueryRequest {
1940
+ title?: string;
1941
+ desc?: string;
1942
+ slug?: string;
1943
+ deeplink?: string;
1944
+ photo?: string;
1945
+ products?: string;
1946
+ status?: string;
1947
+ position?: number;
1948
+ all_fields?: string;
1949
+ skip: string;
1950
+ limit: string;
1951
+ }
1952
+
1953
+ export interface ICreateCollection {
1954
+ title: string;
1955
+ desc?: string;
1956
+ deeplink?: string;
1957
+ photo: File;
1958
+ products: string[];
1959
+ status: ECollectionStatus;
1960
+ position: number;
1961
+ }
1962
+
1963
+ export interface IUpdateCollection {
1964
+ title?: string;
1965
+ desc?: string;
1966
+ deeplink?: string;
1967
+ photo?: File;
1968
+ products?: string[];
1969
+ status?: ECollectionStatus;
1970
+ position?: number;
1971
+ }
1972
+
1973
+ export interface ICollection {
1974
+ _id: string;
1975
+ title: string;
1976
+ desc?: string;
1977
+ slug: string;
1978
+ deeplink?: string;
1979
+ photo: string;
1980
+ products: string[];
1981
+ status: ECollectionStatus;
1982
+ position: number;
1983
+ }
1984
+ export interface IPickupPoints {
1985
+ lat: string;
1986
+
1987
+ lng: string;
1988
+ }
1989
+
1990
+ export interface ICalculateFastDeliveryPrice {
1991
+ lat: string;
1992
+
1993
+ lng: string;
1994
+
1995
+ items: IOrderItem[];
1996
+ }
1997
+
1998
+ export interface ItemSizeDto {
1999
+ // product.dimension: length, width, height
2000
+ length: number;
2001
+ width: number;
2002
+ height: number;
2003
+ }
2004
+
2005
+ export interface ItemDto {
2006
+ size?: ItemSizeDto;
2007
+ weight?: number;
2008
+ quantity: number;
2009
+ pickup_point: number;
2010
+ dropoff_point: number;
2011
+ }
2012
+
2013
+ export interface RoutePointDto {
2014
+ id: number; // 1, 2, 3...
2015
+ fullname?: string;
2016
+ coordinates: number[]; // 37.617298, 55.755825
2017
+ }
2018
+
2019
+ export interface DeliveryInterval {
2020
+ from: string;
2021
+ to: string;
2022
+ }
2023
+ export interface SameDayData {
2024
+ delivery_interval: DeliveryInterval;
2025
+ }
2026
+ export interface RequirementsDto {
2027
+ taxi_classes?: string[];
2028
+ cargo_type?: string;
2029
+ cargo_loaders?: number;
2030
+ pro_courier?: boolean;
2031
+ cargo_options?: string[];
2032
+ skip_door_to_door?: boolean;
2033
+ due?: string;
2034
+ same_day_data?: SameDayData;
2035
+ delivery_interval: DeliveryInterval;
2036
+ }
2037
+
2038
+ export interface YandexDeliveryRequestDto {
2039
+ items: ItemDto[];
2040
+ route_points: RoutePointDto[];
2041
+ requirements: RequirementsDto;
2042
+ }
2043
+ export interface PriceDto {
2044
+ total_price: string;
2045
+ total_price_with_vat: string;
2046
+ surge_ratio: number;
2047
+ currency: string;
2048
+ }
2049
+
2050
+ export interface IntervalDto {
2051
+ from: string;
2052
+ to: string;
2053
+ }
2054
+
2055
+ export interface OfferDto {
2056
+ price: PriceDto;
2057
+ taxi_class: string;
2058
+ pickup_interval: IntervalDto;
2059
+ delivery_interval: IntervalDto;
2060
+ description: string;
2061
+ payload: string;
2062
+ offer_ttl: string;
2063
+ }
2064
+
2065
+ export enum EProductsSortOptions {
2066
+ NEWEST = 'Новинки',
2067
+ POPULAR = 'Популярные',
2068
+ CHEAPEST = 'Дешевле',
2069
+ EXPENSIVE = 'Дороже',
2070
+ }
2071
+
2072
+ export interface PriceDto {
2073
+ total_price: string;
2074
+ total_price_with_vat: string;
2075
+ surge_ratio: number;
2076
+ currency: string;
2077
+ }
2078
+
2079
+ export interface IntervalDto {
2080
+ from: string;
2081
+ to: string;
2082
+ }
2083
+
2084
+ export interface OfferDto {
2085
+ price: PriceDto;
2086
+ taxi_class: string;
2087
+ pickup_interval: IntervalDto;
2088
+ delivery_interval: IntervalDto;
2089
+ description: string;
2090
+ payload: string;
2091
+ offer_ttl: string;
2092
+ }
2093
+ export enum DeliveryTypes {
2094
+ CDEK = 'CDEK',
2095
+ YANDEX_EXPRESS = 'YANDEX_EXPRESS',
2096
+ }
2097
+
2098
+ export interface GetFastDeliveryPriceDto {
2099
+ items: IPopulatedOrderItem[];
2100
+
2101
+ delivery_info: Partial<IDeliveryFullInfo>;
2102
+ }
2103
+
2104
+ // Favorites (Избранное) - Начало
2105
+
2106
+ export enum EFavoritesEntityType {
2107
+ PRODUCT = 'PRODUCT',
2108
+ HORSE = 'HORSE',
2109
+ SERVICE = 'SERVICE',
2110
+ }
2111
+
2112
+ export interface IFavorite {
2113
+ user_id?: string | null; // ID пользователя, который добавил в избранное
2114
+ session_id?: string | null;
2115
+ entity_id: string; // ID сущности, к которой привязано избранное (например, Product или Horse)
2116
+ entity_type: EFavoritesEntityType; // Тип сущности (PRODUCT, HORSE и т.д.)
2117
+ }
2118
+
2119
+ export interface IPopulatedFavorite extends Omit<IFavorite, 'entity_id'> {
2120
+ _id: string;
2121
+ entity_id: IProductResponse | IPopulatedHorse | IPopulatedService; // В зависимости от entity_type присваивать entity_id as IProductResponse или IPopulatedHorse
2122
+ }
2123
+
2124
+ export enum EFavoriteToggleActions {
2125
+ ADDED = 'ADDED', // Добавлен в базу
2126
+ REMOVED = 'REMOVED', // Убран из базы
2127
+ }
2128
+
2129
+ export interface IToggleFavoriteRequest
2130
+ extends Omit<IFavorite, 'user_id' | 'session_id'> {}
2131
+
2132
+ export interface IGetFavoritesRequest
2133
+ extends Omit<IFavorite, 'entity_id' | 'user_id' | 'session_id'> {}
2134
+
2135
+ export interface IToggleFavoriteResponse {
2136
+ action: EFavoriteToggleActions;
2137
+ }
2138
+
2139
+ // Favorites (Избранное) - Конец
2140
+
2141
+ // Services (Услуги) - Начало
2142
+
2143
+ export interface IGetServicesQuery extends FilterBaseQuery {
2144
+ creator_id?: string;
2145
+ user_id?: string;
2146
+ category?: string;
2147
+ priceMin?: string;
2148
+ priceMax?: string;
2149
+ lat?: string; // user lat
2150
+ lng?: string; // user lng
2151
+ radius?: string;
2152
+ }
2153
+
2154
+ export interface ICreateService {
2155
+ name: string;
2156
+ description?: string;
2157
+ category: string;
2158
+ price: number;
2159
+ location: ILocation;
2160
+ communication: ICommunication;
2161
+ photo: File;
2162
+ }
2163
+
2164
+ export interface IUpdateService extends Partial<ICreateService> {}
2165
+
2166
+ export enum EServiceStatus {
2167
+ MODERATION = 'MODERATION',
2168
+ PUBLISHED = 'PUBLISHED',
2169
+ REJECTED = 'REJECTED',
2170
+ ARCHIVED = 'ARCHIVED',
2171
+ }
2172
+
2173
+ export interface IServiceCategory {
2174
+ _id: string;
2175
+ name: string;
2176
+ photo: string;
2177
+ createdAt: Date;
2178
+ updatedAt: Date;
2179
+ }
2180
+
2181
+ export interface IService {
2182
+ user_id: string;
2183
+ name: string;
2184
+ description?: string;
2185
+ category: string;
2186
+ price: number;
2187
+ status: EServiceStatus;
2188
+ location: ILocation;
2189
+ communication: ICommunication;
2190
+ photo: string;
2191
+ telegram_message_id: number | null;
2192
+ slug: string;
2193
+ distance?: number; // Расстояние пользователя до лошади (если передано гео)
2194
+ number: number;
2195
+ published_at?: Date;
2196
+ entityAnalytics?: IEntityAnalytics;
2197
+ createdAt: Date;
2198
+ updatedAt: Date;
2199
+ }
2200
+
2201
+ export interface IPopulatedServicesWithReviewDataResponse {
2202
+ services: IPopulatedService[];
2203
+ reviewsData: IReviewsData;
2204
+ }
2205
+
2206
+ export interface IPopulatedService
2207
+ extends Omit<IService, 'category' | 'user_id'> {
2208
+ _id: string;
2209
+ category: IServiceCategory;
2210
+ user_id: IPopulatedOrderUserApp;
2211
+ is_favorite?: boolean;
2212
+ reviewsData?: IReviewsData;
2213
+ }
2214
+
2215
+ export interface IPopulatedServiceWViewCount extends IPopulatedService {
2216
+ viewCount: IViewCount;
2217
+ }
2218
+
2219
+ // Services (Услуги) - Конец
2220
+
2221
+ export interface OptionalUserQuery {
2222
+ user_id?: string;
2223
+ }
2224
+
2225
+ export interface OptionalLocationQuery {
2226
+ lat?: string;
2227
+ lng?: string;
2228
+ }
2229
+
2230
+ export interface OptionalUserLocationQuery
2231
+ extends OptionalUserQuery,
2232
+ OptionalLocationQuery {}
2233
+
2234
+ export interface CombinedUserLocationFilterQuery
2235
+ extends OptionalUserLocationQuery,
2236
+ FilterBaseQuery {}
2237
+
2238
+ export interface ISavePushToken {
2239
+ token: string;
2240
+ userId?: string;
2241
+ }
2242
+
2243
+ export enum EEntityType {
2244
+ PRODUCT = 'PRODUCT',
2245
+ HORSE = 'HORSE',
2246
+ SERVICE = 'SERVICE',
2247
+ }
2248
+
2249
+ export interface IGetUnreviewedProductsResponse {
2250
+ products: IProductResponse[];
2251
+ count: number;
2252
+ }
2253
+
2254
+ export enum EArchivedReason {
2255
+ HORSESMART = 'На HorseSmart',
2256
+ OTHER_PLATFORM = 'На другой площадке',
2257
+ PERSONAL = 'Лично',
2258
+ NOT_SOLD = 'Не продал',
2259
+ }
2260
+
2261
+ export interface IDeleteHorse {
2262
+ archived_reason: EArchivedReason;
2263
+ }
2264
+
2265
+ export interface SellerSlugResponse {
2266
+ _id: string;
2267
+ slug: string;
2268
+ updatedAt: Date;
2269
+ }
2270
+
2271
+ export interface IEntityAnalytics {
2272
+ entity_type: EEntityType;
2273
+ entity_id: string;
2274
+ views_count: number;
2275
+ favorites_count: number;
2276
+ purchases_count: number;
2277
+ cart_count: number;
2278
+ createdAt: Date;
2279
+ updatedAt: Date;
2280
+ }
2281
+
2282
+ export interface ISendOtpRequest {
2283
+ email: string;
2284
+ }
2285
+
2286
+ export interface IVerifyOtpRequest {
2287
+ email: string;
2288
+ code: number;
2289
+ }
2290
+
2291
+ export interface IVerifyOtpResponse extends ITokensResponse {
2292
+ user_id: string;
2293
+ }
2294
+
2295
+ export interface ICreateMultiOrderResponse {
2296
+ payment: IPaymentResponse;
2297
+ tokens?: ITokensResponse;
2298
+ }
2299
+ }
2300
+ }