repzo 1.0.3 → 1.0.6

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.
@@ -15,6 +15,84 @@ export interface Headers {
15
15
  Accept: string;
16
16
  [key: string]: string;
17
17
  }
18
+
19
+ interface AdminCreator {
20
+ _id: string;
21
+ type: "admin";
22
+ name?: string;
23
+ admin?: string;
24
+ }
25
+ interface RepCreator {
26
+ _id: string;
27
+ type: "rep";
28
+ name?: string;
29
+ rep?: string;
30
+ }
31
+ interface ClientCreator {
32
+ _id: string;
33
+ type: "client";
34
+ name?: string;
35
+ client?: string;
36
+ }
37
+ interface SerialNumber {
38
+ identifier: string;
39
+ formatted: string;
40
+ count: number;
41
+ }
42
+ interface PaymentData {
43
+ payment_serial_number?: SerialNumber;
44
+ payment_id?: string;
45
+ invoice_serial_number?: SerialNumber;
46
+ return_serial_number?: SerialNumber;
47
+ fullinvoice_id?: string;
48
+ refund_serial_number?: SerialNumber;
49
+ refund_id?: string;
50
+ adjustment_serial_number?: SerialNumber;
51
+ adjustment_id?: string;
52
+ adjustment_account_id?: string;
53
+ view_serial_number?: SerialNumber;
54
+ type?: "invoice" | "payment" | "return_invoice" | "refund" | "adjustment";
55
+ amount: number;
56
+ is_linked_txn?: boolean;
57
+ }
58
+ interface Check {
59
+ _id: string;
60
+ drawer_name: string;
61
+ bank: string;
62
+ bank_branch: string;
63
+ check_number: number;
64
+ check_date: string;
65
+ photo?: string;
66
+ caption?: string;
67
+ photo_meta?: {
68
+ device_orientation?: number;
69
+ height?: number;
70
+ width?: number;
71
+ };
72
+ disabled?: boolean;
73
+ }
74
+
75
+ export interface DefaultPaginationQueryParams {
76
+ per_page?: number;
77
+ page?: number;
78
+ sort?: string;
79
+ sortPageOrder?: "asc" | "dsc";
80
+ }
81
+
82
+ export interface DefaultPaginationResult {
83
+ total_result: number;
84
+ current_count: number;
85
+ total_pages: number;
86
+ current_page: number;
87
+ per_page: number;
88
+ first_page_url: string;
89
+ last_page_url: string;
90
+ next_page_url: string | null;
91
+ prev_page_url: string | null;
92
+ path: string;
93
+ data: any[];
94
+ }
95
+
18
96
  // <reference path = "vehicle.ts" />
19
97
  export namespace Service {
20
98
  export namespace Client {
@@ -33,7 +111,7 @@ export namespace Service {
33
111
  order?: number;
34
112
  company_namespace: string[];
35
113
  }
36
- interface ShelfshareTarget {
114
+ interface ShelfShareTarget {
37
115
  msl: string;
38
116
  contracted_checkout: number;
39
117
  contracted_shelf_length: number;
@@ -44,7 +122,7 @@ export namespace Service {
44
122
  target: number;
45
123
  classification: string;
46
124
  }
47
- interface ClientSchema {
125
+ export interface ClientSchema {
48
126
  _id: string;
49
127
  local_name?: string;
50
128
  tags?: string[];
@@ -69,7 +147,7 @@ export namespace Service {
69
147
  tax_number?: string;
70
148
  sync_id?: string;
71
149
  rep_targets?: RepTarget[];
72
- shelf_share_targets?: ShelfshareTarget[];
150
+ shelf_share_targets?: ShelfShareTarget[];
73
151
  profile_pic?: string;
74
152
  logo?: string;
75
153
  website?: string;
@@ -129,7 +207,7 @@ export namespace Service {
129
207
  tax_number?: string;
130
208
  sync_id?: string;
131
209
  rep_targets?: RepTarget[];
132
- shelf_share_targets?: ShelfshareTarget[];
210
+ shelf_share_targets?: ShelfShareTarget[];
133
211
  profile_pic?: string;
134
212
  logo?: string;
135
213
  website?: string;
@@ -172,13 +250,31 @@ export namespace Service {
172
250
  | "msl"
173
251
  | "chain"
174
252
  | "channel"
175
- | "status"
176
253
  | "product"
177
254
  | "assigned_products"
178
255
  | "assigned_product_groups"
179
256
  | "speciality"
180
257
  | "teams";
181
258
 
259
+ type ClientSchemaWithPopulatedKeys = ClientSchema & {
260
+ assigned_products?:
261
+ | string[]
262
+ | Pick<Product.ProductSchema, "_id" | "name">[];
263
+ assigned_product_groups?:
264
+ | string
265
+ | Pick<ProductGroup.ProductGroupSchema, "_id" | "name">[];
266
+ teams?: string[] | Pick<Team.TeamSchema, "_id" | "name">[];
267
+ assigned_to?: string[] | Pick<Rep.RepSchema, "_id" | "name">[];
268
+ tags?: string[] | Tag.TagSchema[];
269
+ price_tag?: string | Tag.TagSchema;
270
+ job_category?: string[] | JobCategory.JobCategorySchema[];
271
+ sv_priceList?: string | Pick<PriceList.PriceListSchema, "_id" | "name">[];
272
+ chain?:
273
+ | string
274
+ | Pick<Client.ClientSchema, "_id" | "name" | "client_code">;
275
+ channel?: string | Channel.ChannelSchema;
276
+ };
277
+
182
278
  export namespace Find {
183
279
  export type Params = DefaultPaginationQueryParams & {
184
280
  from_updatedAt?: number;
@@ -187,7 +283,7 @@ export namespace Service {
187
283
  to_createdAt?: number;
188
284
  createdAt?: number;
189
285
  updatedAt?: number;
190
- name?: string;
286
+ name?: string[] | string;
191
287
  search?: string;
192
288
  disabled?: boolean;
193
289
  active?: boolean;
@@ -210,23 +306,24 @@ export namespace Service {
210
306
  assigned_media?: string[] | string;
211
307
  assigned_products?: string[] | string;
212
308
  teams?: string[] | string;
213
- integrated_client_balance?: number;
214
- tax_number?: string;
309
+ integrated_client_balance?: number[] | number;
310
+ tax_number?: string[] | string;
215
311
  speciality?: string[] | string;
216
312
  assigned_product_groups?: string[] | string;
217
313
  populatedKeys?: PopulatedKeys[];
314
+ [key: string]: any; // integration_meta. & customFields.
218
315
  };
219
316
  export interface Result extends DefaultPaginationResult {
220
- data: ClientSchema[];
317
+ data: ClientSchemaWithPopulatedKeys[];
221
318
  }
222
319
  }
223
320
 
224
321
  export namespace Get {
225
322
  export type ID = string;
226
323
  export interface Params {
227
- populatedKeys: PopulatedKeys[];
324
+ populatedKeys?: PopulatedKeys[];
228
325
  }
229
- export type Result = ClientSchema;
326
+ export type Result = ClientSchemaWithPopulatedKeys;
230
327
  }
231
328
 
232
329
  export namespace Create {
@@ -252,25 +349,3669 @@ export namespace Service {
252
349
  export type Result = ClientSchema;
253
350
  }
254
351
  }
255
- }
256
352
 
257
- export interface DefaultPaginationQueryParams {
258
- per_page?: number;
259
- page?: number;
260
- sort?: "name" | "client_code" | "createdAt" | "updatedAt";
261
- sortPageOrder?: "asc" | "dsc";
262
- }
353
+ export namespace Product {
354
+ export interface ProductSchema {
355
+ _id: string;
356
+ name: string;
357
+ category: string;
358
+ active: boolean;
359
+ company_namespace: string[];
360
+ local_name?: string;
361
+ sku?: string;
362
+ sub_category?: string[];
363
+ assigned_to?: string[];
364
+ auditable?: boolean;
365
+ barcode?: string;
366
+ sv_tax?: string;
367
+ sv_measureUnit?: string;
368
+ description?: string;
369
+ local_description?: string;
370
+ product_img?: string;
371
+ base_price?: string;
372
+ assigned_media?: string[];
373
+ html_description?: string;
374
+ modifiers_group?: string[];
375
+ featured?: boolean;
376
+ brand?: string;
377
+ rsp?: number;
378
+ measureunit_family?: string;
379
+ integration_meta?: { [key: string]: any };
380
+ teams?: string[];
381
+ position?: number;
382
+ product_groups?: string[];
383
+ frozen_pre_sales?: boolean;
384
+ frozen_sales?: boolean;
385
+ createdAt: string;
386
+ updatedAt: string;
387
+ __v: number;
388
+ }
389
+ interface ProductBody {
390
+ name?: string;
391
+ category?: string;
392
+ active?: boolean;
393
+ company_namespace?: string[];
394
+ local_name?: string;
395
+ sku?: string;
396
+ sub_category?: string[];
397
+ assigned_to?: string[];
398
+ auditable?: boolean;
399
+ barcode?: string;
400
+ sv_tax?: string;
401
+ sv_measureUnit?: string;
402
+ description?: string;
403
+ local_description?: string;
404
+ product_img?: string;
405
+ base_price?: string;
406
+ assigned_media?: string[];
407
+ html_description?: string;
408
+ modifiers_group?: string[];
409
+ featured?: boolean;
410
+ brand?: string;
411
+ rsp?: number;
412
+ measureunit_family?: string;
413
+ integration_meta?: { [key: string]: any };
414
+ teams?: string[];
415
+ position?: number;
416
+ product_groups?: string[];
417
+ frozen_pre_sales?: boolean;
418
+ frozen_sales?: boolean;
419
+ variants?: (Variant.VariantBody & {
420
+ name: string;
421
+ product?: string;
422
+ price: number;
423
+ _id?: string;
424
+ createdAt?: string;
425
+ updatedAt?: string;
426
+ __v?: number;
427
+ })[];
428
+ }
263
429
 
264
- export interface DefaultPaginationResult {
265
- total_result: number;
266
- current_count: number;
267
- total_pages: number;
268
- current_page: number;
269
- per_page: number;
270
- first_page_url: string;
271
- last_page_url: string;
272
- next_page_url: string | null;
273
- prev_page_url: string | null;
274
- path: string;
275
- data: any[];
276
- }
430
+ type ProductWithPopulatedKeys = ProductSchema & {
431
+ category: string | Category.CategorySchema;
432
+ sub_category?: string[] | SubCategory.SubCategorySchema[];
433
+ sv_tax?: string | Tax.TaxSchema | Pick<Tax.TaxSchema, "_id" | "name">;
434
+ sv_measureUnit?:
435
+ | string
436
+ | MeasureUnit.MeasureUnitSchema
437
+ | Pick<MeasureUnit.MeasureUnitSchema, "_id" | "name">;
438
+ brand?: string | Brand.BrandSchema;
439
+ measureunit_family?: string | MeasureUnitFamily.MeasureUnitFamilySchema;
440
+ product_groups?:
441
+ | string[]
442
+ | Pick<ProductGroup.ProductGroupSchema, "_id" | "name">[];
443
+ variants?: Variant.VariantSchema[];
444
+ defaultVariant?: Variant.VariantSchema;
445
+ assigned_media?: string | Media.MediaSchema;
446
+ };
447
+
448
+ type PopulatedKeys =
449
+ | "category"
450
+ | "sub_category"
451
+ | "tax"
452
+ | "sv_tax"
453
+ | "media"
454
+ | "measureunit_family"
455
+ | "measureunit"
456
+ | "sv_measureUnit"
457
+ | "brand"
458
+ | "product_groups";
459
+
460
+ export namespace Find {
461
+ export type Params = DefaultPaginationQueryParams & {
462
+ populatedKeys?: PopulatedKeys[];
463
+ _id?: string[] | string;
464
+ category?: string[] | string;
465
+ sub_category?: string[] | string;
466
+ name?: string[] | string;
467
+ search?: string;
468
+ active?: boolean;
469
+ disabled?: boolean;
470
+ sv_measureUnit?: string[] | string;
471
+ base_price?: number[] | number;
472
+ assigned_media?: string[] | string;
473
+ modifiers_group?: string[] | string;
474
+ brand?: string[] | string;
475
+ rsp?: number[] | number;
476
+ measureunit_family?: string[] | string;
477
+ teams?: string[] | string;
478
+ position?: number[] | number;
479
+ product_groups?: string[] | string;
480
+ sv_tax?: string[] | string;
481
+ createdAt?: number;
482
+ from_updatedAt?: number;
483
+ to_updatedAt?: number;
484
+ barcode?: string[] | string;
485
+ sku?: string[] | string;
486
+ local_name?: string[] | string;
487
+ frozen_pre_sales?: boolean;
488
+ frozen_sales?: boolean;
489
+ withMedia?: boolean;
490
+ withDefaultVariant?: boolean;
491
+ withVariants?: boolean;
492
+ [key: string]: any; // integration_meta.
493
+ };
494
+ export interface Result extends DefaultPaginationResult {
495
+ data: ProductWithPopulatedKeys[];
496
+ }
497
+ }
498
+
499
+ export namespace Get {
500
+ export type ID = string;
501
+ export interface Params {
502
+ populatedKeys?: PopulatedKeys[];
503
+ withVariants?: boolean;
504
+ }
505
+ export type Result = ProductWithPopulatedKeys;
506
+ }
507
+
508
+ export namespace Create {
509
+ export interface Body extends ProductBody {
510
+ name: string;
511
+ category: string;
512
+ }
513
+ export type Result = ProductSchema;
514
+ }
515
+
516
+ export namespace Update {
517
+ export type ID = string;
518
+ export interface Body extends ProductBody {
519
+ _id?: string;
520
+ createdAt?: string;
521
+ updatedAt?: string;
522
+ __v?: number;
523
+ }
524
+ export type Result = ProductSchema;
525
+ }
526
+
527
+ export namespace Remove {
528
+ export type ID = string;
529
+ export type Result = ProductSchema;
530
+ }
531
+ }
532
+
533
+ export namespace Variant {
534
+ export interface VariantSchema {
535
+ _id: string;
536
+ name: string;
537
+ product: string | Product.ProductSchema;
538
+ price: number;
539
+ company_namespace: string[];
540
+ disabled?: boolean;
541
+ uuid?: string;
542
+ local_name?: string;
543
+ sku?: string;
544
+ barcode?: string;
545
+ weight?: number;
546
+ length?: number;
547
+ width?: number;
548
+ height?: number;
549
+ position?: number;
550
+ default?: boolean;
551
+ variant_img?: string;
552
+ modifiers_groups?: string[];
553
+ integration_meta?: { [key: string]: any };
554
+ createdAt: string;
555
+ updatedAt: string;
556
+ __v: number;
557
+ }
558
+ export interface VariantBody {
559
+ name?: string;
560
+ product?: string;
561
+ price?: number;
562
+ company_namespace?: string[];
563
+ disabled?: boolean;
564
+ uuid?: string;
565
+ local_name?: string;
566
+ sku?: string;
567
+ barcode?: string;
568
+ weight?: number;
569
+ length?: number;
570
+ width?: number;
571
+ height?: number;
572
+ position?: number;
573
+ default?: boolean;
574
+ variant_img?: string;
575
+ modifiers_groups?: string[];
576
+ integration_meta?: { [key: string]: any };
577
+ }
578
+ type PopulatedKeys = "product";
579
+
580
+ export namespace Find {
581
+ export type Params = DefaultPaginationQueryParams & {
582
+ _id?: string[] | string;
583
+ search?: string;
584
+ name?: string[] | string;
585
+ local_name?: string[] | string;
586
+ disabled?: boolean;
587
+ product?: string[] | string;
588
+ barcode?: string[] | string;
589
+ sku?: string[] | string;
590
+ price?: number[] | number;
591
+ position?: number[] | number;
592
+ createdAt?: number;
593
+ updatedAt?: number;
594
+ default?: boolean;
595
+ category?: string[] | string;
596
+ subCategory?: string[] | string;
597
+ brand?: string[] | string;
598
+ productGroup?: string[] | string;
599
+ teams?: string[] | string;
600
+ withProduct?: boolean;
601
+ [key: string]: any; // integration_meta.
602
+ };
603
+ export interface Result extends DefaultPaginationResult {
604
+ data: VariantSchema[];
605
+ }
606
+ }
607
+
608
+ export namespace Get {
609
+ export type ID = string;
610
+ export interface Params {
611
+ populatedKeys?: PopulatedKeys[];
612
+ }
613
+ export type Result = VariantSchema;
614
+ }
615
+
616
+ export namespace Create {
617
+ export interface Body extends VariantBody {
618
+ name: string;
619
+ product: string;
620
+ price: number;
621
+ }
622
+ export type Result = VariantSchema;
623
+ }
624
+
625
+ export namespace Update {
626
+ export type ID = string;
627
+ export interface Body extends VariantBody {
628
+ _id?: string;
629
+ createdAt?: string;
630
+ updatedAt?: string;
631
+ __v?: number;
632
+ }
633
+ export type Result = VariantSchema;
634
+ }
635
+
636
+ export namespace Remove {
637
+ export type ID = string;
638
+ export type Result = VariantSchema;
639
+ }
640
+ }
641
+
642
+ export namespace Category {
643
+ export interface CategorySchema {
644
+ _id: string;
645
+ type?: "main";
646
+ name: string;
647
+ photo?: string;
648
+ local_name?: string;
649
+ icon?: string;
650
+ disabled?: boolean;
651
+ position?: number;
652
+ integration_meta?: { [key: string]: any };
653
+ company_namespace: string[];
654
+ createdAt: string;
655
+ updatedAt: string;
656
+ __v: number;
657
+ }
658
+ export interface CategoryBody {
659
+ name?: string;
660
+ company_namespace?: string[];
661
+ type?: "main";
662
+ disabled?: boolean;
663
+ photo?: string;
664
+ local_name?: string;
665
+ icon?: string;
666
+ position?: number;
667
+ integration_meta?: { [key: string]: any };
668
+ }
669
+
670
+ export namespace Find {
671
+ export type Params = DefaultPaginationQueryParams & {
672
+ _id?: string[] | string;
673
+ search?: string;
674
+ name?: string[] | string;
675
+ local_name?: string[] | string;
676
+ disabled?: boolean;
677
+ position?: number[] | number;
678
+ createdAt?: number;
679
+ updatedAt?: number;
680
+ withProduct?: boolean;
681
+ hasSubCategory?: boolean;
682
+ isLeaf?: boolean;
683
+ [key: string]: any; // integration_meta.
684
+ };
685
+ export interface Result extends DefaultPaginationResult {
686
+ data: (CategorySchema & {
687
+ hasSubCategory?: boolean;
688
+ isLeaf?: boolean;
689
+ })[];
690
+ }
691
+ }
692
+
693
+ export namespace Get {
694
+ export type ID = string;
695
+ export type Result = CategorySchema;
696
+ }
697
+
698
+ export namespace Create {
699
+ export interface Body extends CategoryBody {
700
+ name: string;
701
+ }
702
+ export type Result = CategorySchema;
703
+ }
704
+
705
+ export namespace Update {
706
+ export type ID = string;
707
+ export interface Body extends CategoryBody {
708
+ _id?: string;
709
+ createdAt?: string;
710
+ updatedAt?: string;
711
+ __v?: number;
712
+ }
713
+ export type Result = CategorySchema;
714
+ }
715
+
716
+ export namespace Remove {
717
+ export type ID = string;
718
+ export type Result = CategorySchema;
719
+ }
720
+ }
721
+
722
+ export namespace Brand {
723
+ export interface BrandSchema {
724
+ _id: string;
725
+ name: string;
726
+ local_name?: string;
727
+ disabled?: boolean;
728
+ integration_meta?: { [key: string]: any };
729
+ company_namespace: string[];
730
+ createdAt: string;
731
+ updatedAt: string;
732
+ __v: number;
733
+ }
734
+ export interface BrandBody {
735
+ name?: string;
736
+ company_namespace?: string[];
737
+ disabled?: boolean;
738
+ local_name?: string;
739
+ integration_meta?: { [key: string]: any };
740
+ }
741
+
742
+ export namespace Find {
743
+ export type Params = DefaultPaginationQueryParams & {
744
+ _id?: string[] | string;
745
+ search?: string;
746
+ name?: string[] | string;
747
+ local_name?: string[] | string;
748
+ disabled?: boolean;
749
+ createdAt?: number;
750
+ updatedAt?: number;
751
+ [key: string]: any; // integration_meta.
752
+ };
753
+ export interface Result extends DefaultPaginationResult {
754
+ data: BrandSchema[];
755
+ }
756
+ }
757
+
758
+ export namespace Get {
759
+ export type ID = string;
760
+ export type Result = BrandSchema;
761
+ }
762
+
763
+ export namespace Create {
764
+ export interface Body extends BrandBody {
765
+ name: string;
766
+ }
767
+ export type Result = BrandSchema;
768
+ }
769
+
770
+ export namespace Update {
771
+ export type ID = string;
772
+ export interface Body extends BrandBody {
773
+ _id?: string;
774
+ createdAt?: string;
775
+ updatedAt?: string;
776
+ __v?: number;
777
+ }
778
+ export type Result = BrandSchema;
779
+ }
780
+
781
+ export namespace Remove {
782
+ export type ID = string;
783
+ export type Result = BrandSchema;
784
+ }
785
+ }
786
+
787
+ export namespace SubCategory {
788
+ export interface SubCategorySchema {
789
+ _id: string;
790
+ name: string;
791
+ parent_id: string | Pick<Category.CategorySchema, "_id" | "name">;
792
+ local_name?: string;
793
+ disabled?: boolean;
794
+ photo?: string;
795
+ position?: number;
796
+ integration_meta?: { [key: string]: any };
797
+ company_namespace: string[];
798
+ createdAt: string;
799
+ updatedAt: string;
800
+ __v: number;
801
+ }
802
+ export interface SubCategoryBody {
803
+ name?: string;
804
+ company_namespace?: string[];
805
+ disabled?: boolean;
806
+ local_name?: string;
807
+ photo?: string;
808
+ position?: number;
809
+ parent_id?: string;
810
+ integration_meta?: { [key: string]: any };
811
+ }
812
+
813
+ type PopulatedKeys = "parent_id";
814
+
815
+ export namespace Find {
816
+ export type Params = DefaultPaginationQueryParams & {
817
+ populatedKeys?: PopulatedKeys[];
818
+ _id?: string[] | string;
819
+ search?: string;
820
+ name?: string[] | string;
821
+ local_name?: string[] | string;
822
+ parent_id?: string[] | string;
823
+ disabled?: boolean;
824
+ position?: number | number[];
825
+ createdAt?: number;
826
+ updatedAt?: number;
827
+ withProduct?: boolean;
828
+ [key: string]: any; // integration_meta.
829
+ };
830
+ export interface Result extends DefaultPaginationResult {
831
+ data: SubCategorySchema[];
832
+ }
833
+ }
834
+
835
+ export namespace Get {
836
+ export type ID = string;
837
+ export interface Params {
838
+ populatedKeys?: PopulatedKeys[];
839
+ }
840
+ export type Result = SubCategorySchema;
841
+ }
842
+
843
+ export namespace Create {
844
+ export interface Body extends SubCategoryBody {
845
+ name: string;
846
+ parent_id: string;
847
+ }
848
+ export type Result = SubCategorySchema;
849
+ }
850
+
851
+ export namespace Update {
852
+ export type ID = string;
853
+ export interface Body extends SubCategoryBody {
854
+ _id?: string;
855
+ createdAt?: string;
856
+ updatedAt?: string;
857
+ __v?: number;
858
+ }
859
+ export type Result = SubCategorySchema;
860
+ }
861
+
862
+ export namespace Remove {
863
+ export type ID = string;
864
+ export type Result = SubCategorySchema;
865
+ }
866
+ }
867
+
868
+ export namespace ProductGroup {
869
+ export interface ProductGroupSchema {
870
+ _id: string;
871
+ name: string;
872
+ local_name?: string;
873
+ disabled?: boolean;
874
+ company_namespace: string[];
875
+ createdAt: string;
876
+ updatedAt: string;
877
+ __v: number;
878
+ }
879
+ export interface ProductGroupBody {
880
+ name?: string;
881
+ company_namespace?: string[];
882
+ disabled?: boolean;
883
+ local_name?: string;
884
+ }
885
+
886
+ export namespace Find {
887
+ export type Params = DefaultPaginationQueryParams & {
888
+ _id?: string[] | string;
889
+ search?: string;
890
+ name?: string[] | string;
891
+ local_name?: string[] | string;
892
+ disabled?: boolean;
893
+ createdAt?: number;
894
+ updatedAt?: number;
895
+ };
896
+ export interface Result extends DefaultPaginationResult {
897
+ data: ProductGroupSchema[];
898
+ }
899
+ }
900
+
901
+ export namespace Get {
902
+ export type ID = string;
903
+ export type Result = ProductGroupSchema;
904
+ }
905
+
906
+ export namespace Create {
907
+ export interface Body extends ProductGroupBody {
908
+ name: string;
909
+ }
910
+ export type Result = ProductGroupSchema;
911
+ }
912
+
913
+ export namespace Update {
914
+ export type ID = string;
915
+ export interface Body extends ProductGroupBody {
916
+ _id?: string;
917
+ createdAt?: string;
918
+ updatedAt?: string;
919
+ __v?: number;
920
+ }
921
+ export type Result = ProductGroupSchema;
922
+ }
923
+
924
+ export namespace Remove {
925
+ export type ID = string;
926
+ export type Result = ProductGroupSchema;
927
+ }
928
+ }
929
+
930
+ export namespace Tax {
931
+ type TaxType = "inclusive" | "additive" | "N/A";
932
+ export interface TaxSchema {
933
+ _id: string;
934
+ name: string;
935
+ rate: number;
936
+ type: TaxType;
937
+ disabled?: boolean;
938
+ integration_meta?: { [key: string]: any };
939
+ company_namespace: string[];
940
+ createdAt: string;
941
+ updatedAt: string;
942
+ __v: number;
943
+ }
944
+ export interface TaxBody {
945
+ name?: string;
946
+ rate?: number;
947
+ type?: TaxType;
948
+ company_namespace?: string[];
949
+ disabled?: boolean;
950
+ integration_meta?: { [key: string]: any };
951
+ }
952
+
953
+ export namespace Find {
954
+ export type Params = DefaultPaginationQueryParams & {
955
+ _id?: string[] | string;
956
+ search?: string;
957
+ name?: string[] | string;
958
+ rate?: number | number[];
959
+ type?: TaxType | TaxType[];
960
+ disabled?: boolean;
961
+ from_updatedAt?: number;
962
+ [key: string]: any; // integration_meta.
963
+ };
964
+ export interface Result extends DefaultPaginationResult {
965
+ data: TaxSchema[];
966
+ }
967
+ }
968
+
969
+ export namespace Get {
970
+ export type ID = string;
971
+ export type Result = TaxSchema;
972
+ }
973
+
974
+ export namespace Create {
975
+ export interface Body extends TaxBody {
976
+ name: string;
977
+ rate: number;
978
+ type: TaxType;
979
+ }
980
+ export type Result = TaxSchema;
981
+ }
982
+
983
+ export namespace Update {
984
+ export type ID = string;
985
+ export interface Body extends TaxBody {
986
+ _id?: string;
987
+ createdAt?: string;
988
+ updatedAt?: string;
989
+ __v?: number;
990
+ }
991
+ export type Result = TaxSchema;
992
+ }
993
+
994
+ export namespace Remove {
995
+ export type ID = string;
996
+ export type Result = TaxSchema;
997
+ }
998
+ }
999
+
1000
+ export namespace MeasureUnit {
1001
+ export interface MeasureUnitSchema {
1002
+ _id: string;
1003
+ name: string;
1004
+ factor: number;
1005
+ local_name?: string;
1006
+ parent?: string;
1007
+ disabled?: boolean;
1008
+ integration_meta?: { [key: string]: any };
1009
+ company_namespace: string[];
1010
+ createdAt: string;
1011
+ updatedAt: string;
1012
+ __v: number;
1013
+ }
1014
+ export interface MeasureUnitBody {
1015
+ name?: string;
1016
+ factor: number;
1017
+ local_name?: string;
1018
+ parent?: string;
1019
+ company_namespace?: string[];
1020
+ disabled?: boolean;
1021
+ integration_meta?: { [key: string]: any };
1022
+ }
1023
+
1024
+ export namespace Find {
1025
+ export type Params = DefaultPaginationQueryParams & {
1026
+ _id?: string[] | string;
1027
+ search?: string;
1028
+ name?: string[] | string;
1029
+ factor?: number | number[];
1030
+ parent?: "nil";
1031
+ disabled?: boolean;
1032
+ from_updatedAt?: number;
1033
+ family_name?: string[] | string;
1034
+ withFamily?: boolean;
1035
+ [key: string]: any; // integration_meta.
1036
+ };
1037
+ export interface Result extends DefaultPaginationResult {
1038
+ data: (MeasureUnitSchema & {
1039
+ family?: MeasureUnitFamily.MeasureUnitFamilySchema[];
1040
+ })[];
1041
+ }
1042
+ }
1043
+
1044
+ export namespace Get {
1045
+ export type ID = string;
1046
+ export type Result = MeasureUnitSchema;
1047
+ }
1048
+
1049
+ export namespace Create {
1050
+ export interface Body extends MeasureUnitBody {
1051
+ name: string;
1052
+ }
1053
+ export type Result = MeasureUnitSchema;
1054
+ }
1055
+
1056
+ export namespace Update {
1057
+ export type ID = string;
1058
+ export interface Body extends MeasureUnitBody {
1059
+ _id?: string;
1060
+ createdAt?: string;
1061
+ updatedAt?: string;
1062
+ __v?: number;
1063
+ }
1064
+ export type Result = MeasureUnitSchema;
1065
+ }
1066
+
1067
+ export namespace Remove {
1068
+ export type ID = string;
1069
+ export type Result = MeasureUnitSchema;
1070
+ }
1071
+ }
1072
+
1073
+ export namespace MeasureUnitFamily {
1074
+ export interface MeasureUnitFamilySchema {
1075
+ _id: string;
1076
+ name: string;
1077
+ local_name?: string;
1078
+ measureunits: string[];
1079
+ disabled?: boolean;
1080
+ integration_meta?: { [key: string]: any };
1081
+ company_namespace: string[];
1082
+ createdAt: string;
1083
+ updatedAt: string;
1084
+ __v: number;
1085
+ }
1086
+ export interface MeasureUnitFamilyBody {
1087
+ name?: string;
1088
+ local_name?: string;
1089
+ measureunits?: string[];
1090
+ company_namespace?: string[];
1091
+ disabled?: boolean;
1092
+ integration_meta?: { [key: string]: any };
1093
+ }
1094
+
1095
+ export namespace Find {
1096
+ export type Params = DefaultPaginationQueryParams & {
1097
+ _id?: string[] | string;
1098
+ search?: string;
1099
+ name?: string[] | string;
1100
+ local_name?: string[] | string;
1101
+ disabled?: boolean;
1102
+ measureunits?: string[] | string;
1103
+ [key: string]: any; // integration_meta.
1104
+ };
1105
+ export interface Result extends DefaultPaginationResult {
1106
+ data: MeasureUnitFamilySchema[];
1107
+ }
1108
+ }
1109
+
1110
+ export namespace Get {
1111
+ export type ID = string;
1112
+ export type Result = MeasureUnitFamilySchema;
1113
+ }
1114
+
1115
+ export namespace Create {
1116
+ export interface Body extends MeasureUnitFamilyBody {
1117
+ name: string;
1118
+ }
1119
+ export type Result = MeasureUnitFamilySchema;
1120
+ }
1121
+
1122
+ export namespace Update {
1123
+ export type ID = string;
1124
+ export interface Body extends MeasureUnitFamilyBody {
1125
+ _id?: string;
1126
+ createdAt?: string;
1127
+ updatedAt?: string;
1128
+ __v?: number;
1129
+ }
1130
+ export type Result = MeasureUnitFamilySchema;
1131
+ }
1132
+
1133
+ export namespace Remove {
1134
+ export type ID = string;
1135
+ export type Result = MeasureUnitFamilySchema;
1136
+ }
1137
+ }
1138
+
1139
+ export namespace Media {
1140
+ type MediaType =
1141
+ | "ppt"
1142
+ | "pptx"
1143
+ | "pdf"
1144
+ | "jpeg"
1145
+ | "jpg"
1146
+ | "png"
1147
+ | "doc"
1148
+ | "docx";
1149
+ export interface MediaSchema {
1150
+ _id: string;
1151
+ name: string;
1152
+ type: MediaType;
1153
+ url: string;
1154
+ creator: AdminCreator | RepCreator;
1155
+ caption?: string;
1156
+ disabled?: boolean;
1157
+ company_namespace: string[];
1158
+ createdAt: string;
1159
+ updatedAt: string;
1160
+ __v: number;
1161
+ }
1162
+ export interface MediaBody {
1163
+ name?: string;
1164
+ type?: MediaType;
1165
+ url?: string[];
1166
+ caption?: string;
1167
+ company_namespace?: string[];
1168
+ disabled?: boolean;
1169
+ }
1170
+
1171
+ export namespace Find {
1172
+ export type Params = DefaultPaginationQueryParams & {
1173
+ _id?: string[] | string;
1174
+ search?: string;
1175
+ name?: string[] | string;
1176
+ "creator._id"?: string[] | string;
1177
+ caption?: string[] | string;
1178
+ url?: string[] | string;
1179
+ type?: MediaType[] | MediaType;
1180
+ disabled?: boolean;
1181
+ repID?: string[] | string;
1182
+ };
1183
+ export interface Result extends DefaultPaginationResult {
1184
+ data: MediaSchema[];
1185
+ }
1186
+ }
1187
+
1188
+ export namespace Get {
1189
+ export type ID = string;
1190
+ export type Result = MediaSchema;
1191
+ }
1192
+
1193
+ export namespace Create {
1194
+ export interface Body extends MediaBody {
1195
+ name: string;
1196
+ }
1197
+ export type Result = MediaSchema;
1198
+ }
1199
+
1200
+ export namespace Update {
1201
+ export type ID = string;
1202
+ export interface Body extends MediaBody {
1203
+ _id?: string;
1204
+ createdAt?: string;
1205
+ updatedAt?: string;
1206
+ __v?: number;
1207
+ }
1208
+ export type Result = MediaSchema;
1209
+ }
1210
+
1211
+ export namespace Remove {
1212
+ export type ID = string;
1213
+ export type Result = string;
1214
+ }
1215
+ }
1216
+
1217
+ export namespace PriceList {
1218
+ interface creator {
1219
+ _id: string;
1220
+ name: string;
1221
+ }
1222
+ export interface PriceListSchema {
1223
+ _id: string;
1224
+ name: string;
1225
+ createdby: creator;
1226
+ disabled?: boolean;
1227
+ integration_meta?: { [key: string]: any };
1228
+ company_namespace: string[];
1229
+ createdAt: string;
1230
+ updatedAt: string;
1231
+ __v: number;
1232
+ }
1233
+ export interface PriceListBody {
1234
+ name?: string;
1235
+ integration_meta?: { [key: string]: any };
1236
+ disabled?: boolean;
1237
+ company_namespace?: string[];
1238
+ }
1239
+
1240
+ export namespace Find {
1241
+ export type Params = DefaultPaginationQueryParams & {
1242
+ _id?: string[] | string;
1243
+ search?: string;
1244
+ name?: string[] | string;
1245
+ "createdby._id"?: string[] | string;
1246
+ disabled?: boolean;
1247
+ from_updatedAt?: number;
1248
+ [key: string]: any; // integration_meta.
1249
+ };
1250
+ export interface Result extends DefaultPaginationResult {
1251
+ data: PriceListSchema[];
1252
+ }
1253
+ }
1254
+
1255
+ export namespace Get {
1256
+ export type ID = string;
1257
+ export type Result = PriceListSchema;
1258
+ }
1259
+
1260
+ export namespace Create {
1261
+ export interface Body extends PriceListBody {
1262
+ name: string;
1263
+ }
1264
+ export type Result = PriceListSchema;
1265
+ }
1266
+
1267
+ export namespace Update {
1268
+ export type ID = string;
1269
+ export interface Body extends PriceListBody {
1270
+ _id?: string;
1271
+ createdAt?: string;
1272
+ updatedAt?: string;
1273
+ __v?: number;
1274
+ }
1275
+ export type Result = PriceListSchema;
1276
+ }
1277
+
1278
+ export namespace Remove {
1279
+ export type ID = string;
1280
+ export type Result = PriceListSchema;
1281
+ }
1282
+ }
1283
+
1284
+ export namespace PriceListItem {
1285
+ export interface PriceListItemSchema {
1286
+ _id: string;
1287
+ product_id: string;
1288
+ variant_id: string;
1289
+ pricelist_id: string;
1290
+ price: number;
1291
+ disabled?: boolean;
1292
+ integration_meta?: { [key: string]: any };
1293
+ company_namespace: string[];
1294
+ createdAt: string;
1295
+ updatedAt: string;
1296
+ __v: number;
1297
+ }
1298
+ export interface PriceListItemBody {
1299
+ product_id?: string;
1300
+ variant_id?: string;
1301
+ pricelist_id?: string;
1302
+ price?: number;
1303
+ integration_meta?: { [key: string]: any };
1304
+ disabled?: boolean;
1305
+ company_namespace?: string[];
1306
+ }
1307
+
1308
+ type PopulatedKeys = "product" | "variant" | "pricelist";
1309
+
1310
+ export namespace Find {
1311
+ export type Params = DefaultPaginationQueryParams & {
1312
+ _id?: string[] | string;
1313
+ search?: string;
1314
+ product_id?: string[] | string;
1315
+ variant_id?: string[] | string;
1316
+ pricelist_id?: string[] | string;
1317
+ disabled?: boolean;
1318
+ from_updatedAt?: number;
1319
+ populatedKeys?: PopulatedKeys[];
1320
+ [key: string]: any; // integration_meta.
1321
+ };
1322
+ export interface Result extends DefaultPaginationResult {
1323
+ data: (PriceListItemSchema & {
1324
+ product_id: string | Product.ProductSchema;
1325
+ variant_id: string | Variant.VariantSchema;
1326
+ pricelist_id: string | PriceList.PriceListSchema;
1327
+ })[];
1328
+ }
1329
+ }
1330
+
1331
+ export namespace Get {
1332
+ export type ID = string;
1333
+ export type Result = PriceListItemSchema;
1334
+ }
1335
+
1336
+ export namespace Create {
1337
+ export interface Body extends PriceListItemBody {
1338
+ product_id: string;
1339
+ variant_id: string;
1340
+ pricelist_id: string;
1341
+ price: number;
1342
+ }
1343
+ export type Result = PriceListItemSchema;
1344
+ }
1345
+
1346
+ export namespace Update {
1347
+ export type ID = string;
1348
+ export interface Body extends PriceListItemBody {
1349
+ _id?: string;
1350
+ createdAt?: string;
1351
+ updatedAt?: string;
1352
+ __v?: number;
1353
+ }
1354
+ export type Result = PriceListItemSchema;
1355
+ }
1356
+
1357
+ export namespace Remove {
1358
+ export type ID = string;
1359
+ export type Result = PriceListItemSchema;
1360
+ }
1361
+ }
1362
+
1363
+ export namespace Team {
1364
+ export interface TeamSchema {
1365
+ _id: string;
1366
+ name: string;
1367
+ disabled?: boolean;
1368
+ company_namespace: string[];
1369
+ createdAt: string;
1370
+ updatedAt: string;
1371
+ __v: number;
1372
+ }
1373
+ export interface TeamBody {
1374
+ name?: string;
1375
+ company_namespace?: string[];
1376
+ disabled?: boolean;
1377
+ }
1378
+
1379
+ export namespace Find {
1380
+ export type Params = DefaultPaginationQueryParams & {
1381
+ _id?: string[] | string;
1382
+ search?: string;
1383
+ name?: string[] | string;
1384
+ disabled?: boolean;
1385
+ };
1386
+ export interface Result extends DefaultPaginationResult {
1387
+ data: TeamSchema[];
1388
+ }
1389
+ }
1390
+
1391
+ export namespace Get {
1392
+ export type ID = string;
1393
+ export type Result = TeamSchema & {
1394
+ admins: any; // Admin.Schema
1395
+ reps: any; // Rep.Schema
1396
+ };
1397
+ }
1398
+
1399
+ export namespace Create {
1400
+ export interface Body extends TeamBody {
1401
+ name: string;
1402
+ }
1403
+ export type Result = TeamSchema;
1404
+ }
1405
+
1406
+ export namespace Update {
1407
+ export type ID = string;
1408
+ export interface Body extends TeamBody {
1409
+ _id?: string;
1410
+ createdAt?: string;
1411
+ updatedAt?: string;
1412
+ __v?: number;
1413
+ }
1414
+ export type Result = TeamSchema;
1415
+ }
1416
+
1417
+ export namespace Remove {
1418
+ export type ID = string;
1419
+ export type Result = TeamSchema;
1420
+ }
1421
+ }
1422
+
1423
+ export namespace Rep {
1424
+ interface RepPermissions {
1425
+ rep_can_add_client: boolean;
1426
+ rep_can_edit_client: boolean;
1427
+ rep_can_add_calendar: boolean;
1428
+ rep_can_edit_calendar: boolean;
1429
+ rep_can_skip_photo_tag: boolean;
1430
+ rep_can_edit_product_price?: boolean;
1431
+ rep_must_add_client_with_location?: boolean;
1432
+ rep_can_access_shared_history?: boolean;
1433
+ rep_can_edit_total_shelf_share?: boolean;
1434
+ rep_can_create_transfer?: boolean;
1435
+ rep_can_make_call?: boolean;
1436
+ rep_can_read_stock?: boolean;
1437
+ can_rep_pay_other_reps_invoices?: boolean;
1438
+ rep_can_create_sales_order?: boolean;
1439
+ rep_can_create_invoice?: boolean;
1440
+ rep_can_create_transfer_load?: boolean;
1441
+ rep_can_create_transfer_unload?: boolean;
1442
+ rep_can_create_return_invoice?: boolean;
1443
+ rep_can_sell_zero_product_price?: boolean;
1444
+ }
1445
+ interface TargetResults {
1446
+ totalPoints: number;
1447
+ targetsCount: number;
1448
+ totalAchievements: number;
1449
+ averageAchievements: number;
1450
+ pointsCap: number;
1451
+ }
1452
+ type JobOption = 0 | 1 | 2;
1453
+ export interface RepSchema {
1454
+ _id: string;
1455
+ username: string;
1456
+ name: string;
1457
+ password: string;
1458
+ device_id?: string;
1459
+ linked_to_device?: boolean;
1460
+ live_location?: boolean;
1461
+ phone?: string;
1462
+ integration_id?: string;
1463
+ permissions: RepPermissions;
1464
+ preferences: {
1465
+ isLightModeEnabled?: boolean;
1466
+ };
1467
+ profile_pic?: string;
1468
+ teams?: string[];
1469
+ identifier?: number;
1470
+ notification_id?: string;
1471
+ monthly_sales_target?: number;
1472
+ daily_target_visit?: number;
1473
+ sales_type?: 1 | 2;
1474
+ job_option?: JobOption;
1475
+ msl_sales?: string[];
1476
+ job_category?: string[];
1477
+ assigned_warehouse?: string;
1478
+ assigned_main_warehouse?: string;
1479
+ assigned_plan?: string;
1480
+ integration_meta?: { [key: string]: any };
1481
+ force_online_connectivity?: boolean;
1482
+ assigned_targets?: string[];
1483
+ lines?: string[];
1484
+ targetResults?: TargetResults;
1485
+ previously_assigned_clients?: string[];
1486
+ freshchat_id?: string;
1487
+ disabled?: boolean;
1488
+ company_namespace: string[];
1489
+ createdAt: string;
1490
+ updatedAt: string;
1491
+ __v: number;
1492
+ }
1493
+ export interface RepBody {
1494
+ username?: string;
1495
+ name?: string;
1496
+ password?: string;
1497
+ device_id?: string;
1498
+ linked_to_device?: boolean;
1499
+ live_location?: boolean;
1500
+ phone?: string;
1501
+ integration_id?: string;
1502
+ permissions?: RepPermissions;
1503
+ preferences?: {
1504
+ isLightModeEnabled?: boolean;
1505
+ };
1506
+ profile_pic?: string;
1507
+ teams?: string[];
1508
+ identifier?: number;
1509
+ notification_id?: string;
1510
+ monthly_sales_target?: number;
1511
+ daily_target_visit?: number;
1512
+ sales_type?: 1 | 2;
1513
+ job_option?: JobOption;
1514
+ msl_sales?: string[];
1515
+ job_category?: string[];
1516
+ assigned_warehouse?: string;
1517
+ assigned_main_warehouse?: string;
1518
+ assigned_plan?: string;
1519
+ integration_meta?: { [key: string]: any };
1520
+ force_online_connectivity?: boolean;
1521
+ assigned_targets?: string[];
1522
+ lines?: string[];
1523
+ targetResults?: TargetResults;
1524
+ previously_assigned_clients?: string[];
1525
+ freshchat_id?: string;
1526
+ disabled?: boolean;
1527
+ company_namespace: string[];
1528
+ }
1529
+
1530
+ type PopulatedKeys = "line" | "job_category";
1531
+
1532
+ export type RepWithPopulatedKeysSchema = RepSchema & {
1533
+ lines?: string[] | Line.LineSchema[];
1534
+ job_category?: string[] | JobCategory.JobCategorySchema[];
1535
+ };
1536
+
1537
+ export namespace Find {
1538
+ export type Params = DefaultPaginationQueryParams & {
1539
+ _id?: string[] | string;
1540
+ search?: string;
1541
+ name?: string[] | string;
1542
+ disabled?: boolean;
1543
+ createdAt?: number;
1544
+ updatedAt?: number;
1545
+ username?: string | string[];
1546
+ phone?: string | string[];
1547
+ teams?: string | string[];
1548
+ identifier?: number | number[];
1549
+ msl_sales?: string | string[];
1550
+ job_category?: string | string[];
1551
+ assigned_warehouse?: string | string[];
1552
+ assigned_main_warehouse?: string | string[];
1553
+ assigned_plan?: string | string[];
1554
+ force_online_connectivity?: boolean;
1555
+ assigned_targets?: string | string[];
1556
+ lines?: string | string[];
1557
+ job_option?: JobOption | JobOption[];
1558
+ "permissions.rep_can_add_client"?: boolean;
1559
+ "permissions.rep_can_edit_client"?: boolean;
1560
+ "permissions.rep_can_add_calendar"?: boolean;
1561
+ "permissions.rep_can_edit_calendar"?: boolean;
1562
+ "permissions.rep_can_skip_photo_tag"?: boolean;
1563
+ "permissions.rep_can_edit_product_price"?: boolean;
1564
+ "permissions.rep_must_add_client_with_location"?: boolean;
1565
+ "permissions.rep_can_access_shared_history"?: boolean;
1566
+ "permissions.rep_can_edit_total_shelf_share"?: boolean;
1567
+ "permissions.rep_can_create_transfer"?: boolean;
1568
+ "permissions.rep_can_make_call"?: boolean;
1569
+ "permissions.rep_can_read_stock"?: boolean;
1570
+ "permissions.can_rep_pay_other_reps_invoices"?: boolean;
1571
+ "permissions.rep_can_create_sales_order"?: boolean;
1572
+ "permissions.rep_can_create_invoice"?: boolean;
1573
+ "permissions.rep_can_create_transfer_load"?: boolean;
1574
+ "permissions.rep_can_create_transfer_unload"?: boolean;
1575
+ "permissions.rep_can_create_return_invoice"?: boolean;
1576
+ [key: string]: any; // integration_meta.
1577
+ populatedKeys?: PopulatedKeys[];
1578
+ withProductLines?: boolean;
1579
+ withStatus?: boolean;
1580
+ };
1581
+ export interface Result extends DefaultPaginationResult {
1582
+ data: (RepSchema & {
1583
+ status?:
1584
+ | "Inactive"
1585
+ | "Ended a day"
1586
+ | "Active"
1587
+ | "Visiting"
1588
+ | "Started a day";
1589
+ latest_activity?: string;
1590
+ })[];
1591
+ }
1592
+ }
1593
+
1594
+ export namespace Get {
1595
+ export type ID = string;
1596
+ export interface Params {
1597
+ populatedKeys?: PopulatedKeys[];
1598
+ withProductLines?: boolean;
1599
+ }
1600
+ export type Result = RepSchema;
1601
+ }
1602
+
1603
+ export namespace Create {
1604
+ export interface Body extends RepBody {
1605
+ name: string;
1606
+ username: string;
1607
+ password: string;
1608
+ }
1609
+ export type Result = RepSchema;
1610
+ }
1611
+
1612
+ export namespace Update {
1613
+ export type ID = string;
1614
+ export interface Body extends RepBody {
1615
+ _id?: string;
1616
+ createdAt?: string;
1617
+ updatedAt?: string;
1618
+ __v?: number;
1619
+ }
1620
+ export type Result = RepSchema;
1621
+ }
1622
+
1623
+ export namespace Remove {
1624
+ export type ID = string;
1625
+ export type Result = RepSchema;
1626
+ }
1627
+ }
1628
+
1629
+ export namespace Line {
1630
+ export interface LineSchema {
1631
+ _id: string;
1632
+ name: string;
1633
+ local_name?: string;
1634
+ icon?: string;
1635
+ disabled?: boolean;
1636
+ company_namespace: string[];
1637
+ createdAt: string;
1638
+ updatedAt: string;
1639
+ __v: number;
1640
+ }
1641
+ }
1642
+
1643
+ export namespace JobCategory {
1644
+ interface JobSchema {
1645
+ type: 0 | 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9;
1646
+ description: string;
1647
+ tag?: string | Tag.TagSchema;
1648
+ product_id?: string;
1649
+ form_id?: string;
1650
+ msl_id?: string;
1651
+ is_required: boolean;
1652
+ order: number;
1653
+ }
1654
+ export interface JobCategorySchema {
1655
+ _id: string;
1656
+ en_name: string;
1657
+ ar_name?: string;
1658
+ from_date: number;
1659
+ end_date?: number;
1660
+ description?: string;
1661
+ deleted_at?: number;
1662
+ is_sequence: boolean;
1663
+ jobs: JobSchema[];
1664
+ disabled?: boolean;
1665
+ company_namespace: string[];
1666
+ createdAt: string;
1667
+ updatedAt: string;
1668
+ __v: number;
1669
+ }
1670
+ }
1671
+
1672
+ export namespace Tag {
1673
+ type TagType = "photo" | "client" | "area" | "price";
1674
+ export interface TagSchema {
1675
+ _id: string;
1676
+ type: TagType;
1677
+ tag: string;
1678
+ disabled?: boolean;
1679
+ integration_meta?: { [key: string]: any };
1680
+ company_namespace: string[];
1681
+ createdAt: string;
1682
+ updatedAt: string;
1683
+ __v: number;
1684
+ }
1685
+ export interface TagBody {
1686
+ tag?: string;
1687
+ type?: TagType;
1688
+ disabled?: boolean;
1689
+ integration_meta?: { [key: string]: any };
1690
+ company_namespace?: string[];
1691
+ }
1692
+
1693
+ export namespace Find {
1694
+ export type Params = DefaultPaginationQueryParams & {
1695
+ _id?: string[] | string;
1696
+ search?: string;
1697
+ tag?: string[] | string;
1698
+ type?: TagType[] | TagType;
1699
+ disabled?: boolean;
1700
+ from_updatedAt?: number;
1701
+ [key: string]: any; // integration_meta.
1702
+ };
1703
+ export interface Result extends DefaultPaginationResult {
1704
+ data: TagSchema[];
1705
+ }
1706
+ }
1707
+
1708
+ export namespace Get {
1709
+ export type ID = string;
1710
+ export type Result = TagSchema;
1711
+ }
1712
+
1713
+ export namespace Create {
1714
+ export interface Body extends TagBody {
1715
+ type: TagType;
1716
+ tag: string;
1717
+ }
1718
+ export type Result = TagSchema;
1719
+ }
1720
+
1721
+ export namespace Update {
1722
+ export type ID = string;
1723
+ export interface Body extends TagBody {
1724
+ _id?: string;
1725
+ createdAt?: string;
1726
+ updatedAt?: string;
1727
+ __v?: number;
1728
+ }
1729
+ export type Result = TagSchema;
1730
+ }
1731
+
1732
+ export namespace Remove {
1733
+ export type ID = string;
1734
+ export type Result = TagSchema;
1735
+ }
1736
+ }
1737
+
1738
+ export namespace Warehouse {
1739
+ type WarehouseType = "van" | "main" | "origin";
1740
+ export interface WarehouseSchema {
1741
+ _id: string;
1742
+ type: WarehouseType;
1743
+ name: string;
1744
+ code?: string;
1745
+ disabled?: boolean;
1746
+ integration_meta?: { [key: string]: any };
1747
+ company_namespace: string[];
1748
+ createdAt: string;
1749
+ updatedAt: string;
1750
+ __v: number;
1751
+ }
1752
+ export interface WarehouseBody {
1753
+ name?: string;
1754
+ type?: "van" | "main";
1755
+ code?: string;
1756
+ disabled?: boolean;
1757
+ integration_meta?: { [key: string]: any };
1758
+ company_namespace?: string[];
1759
+ }
1760
+ type PopulatedKeys = "rep_id";
1761
+ export namespace Find {
1762
+ export type Params = DefaultPaginationQueryParams & {
1763
+ _id?: string[] | string;
1764
+ search?: string;
1765
+ name?: string[] | string;
1766
+ code?: string[] | string;
1767
+ type?: WarehouseType[] | WarehouseType;
1768
+ disabled?: boolean;
1769
+ from_updatedAt?: number;
1770
+ [key: string]: any; // integration_meta.
1771
+ populatedKeys?: PopulatedKeys[];
1772
+ };
1773
+ export interface Result extends DefaultPaginationResult {
1774
+ data: (WarehouseSchema & {
1775
+ rep_id?: Pick<Rep.RepSchema, "_id" | "name">;
1776
+ })[];
1777
+ }
1778
+ }
1779
+
1780
+ export namespace Get {
1781
+ export type ID = string;
1782
+ export type Result = WarehouseSchema;
1783
+ }
1784
+
1785
+ export namespace Create {
1786
+ export interface Body extends WarehouseBody {
1787
+ name: string;
1788
+ type: "van" | "main";
1789
+ }
1790
+ export type Result = WarehouseSchema;
1791
+ }
1792
+
1793
+ export namespace Update {
1794
+ export type ID = string;
1795
+ export interface Body extends WarehouseBody {
1796
+ _id?: string;
1797
+ createdAt?: string;
1798
+ updatedAt?: string;
1799
+ __v?: number;
1800
+ }
1801
+ export type Result = WarehouseSchema;
1802
+ }
1803
+
1804
+ export namespace Remove {
1805
+ export type ID = string;
1806
+ export type Result = WarehouseSchema;
1807
+ }
1808
+ }
1809
+
1810
+ export namespace Channel {
1811
+ export interface ChannelSchema {
1812
+ _id: string;
1813
+ name: string;
1814
+ local_name?: string;
1815
+ disabled?: boolean;
1816
+ integration_meta?: { [key: string]: any };
1817
+ company_namespace: string[];
1818
+ createdAt: string;
1819
+ updatedAt: string;
1820
+ __v: number;
1821
+ }
1822
+ export interface ChannelBody {
1823
+ name?: string;
1824
+ local_name?: string;
1825
+ disabled?: boolean;
1826
+ integration_meta?: { [key: string]: any };
1827
+ company_namespace?: string[];
1828
+ }
1829
+
1830
+ export namespace Find {
1831
+ export type Params = DefaultPaginationQueryParams & {
1832
+ _id?: string[] | string;
1833
+ search?: string;
1834
+ name?: string[] | string;
1835
+ local_name?: string[] | string;
1836
+ disabled?: boolean;
1837
+ [key: string]: any; // integration_meta.
1838
+ };
1839
+ export interface Result extends DefaultPaginationResult {
1840
+ data: ChannelSchema[];
1841
+ }
1842
+ }
1843
+
1844
+ export namespace Get {
1845
+ export type ID = string;
1846
+ export type Result = ChannelSchema;
1847
+ }
1848
+
1849
+ export namespace Create {
1850
+ export interface Body extends ChannelBody {
1851
+ name: string;
1852
+ }
1853
+ export type Result = ChannelSchema;
1854
+ }
1855
+
1856
+ export namespace Update {
1857
+ export type ID = string;
1858
+ export interface Body extends ChannelBody {
1859
+ _id?: string;
1860
+ createdAt?: string;
1861
+ updatedAt?: string;
1862
+ __v?: number;
1863
+ }
1864
+ export type Result = ChannelSchema;
1865
+ }
1866
+
1867
+ export namespace Remove {
1868
+ export type ID = string;
1869
+ export type Result = ChannelSchema;
1870
+ }
1871
+ }
1872
+
1873
+ export namespace PaymentTerm {
1874
+ export interface PaymentTermSchema {
1875
+ _id: string;
1876
+ name: string;
1877
+ due_days: number;
1878
+ editor: AdminCreator;
1879
+ disabled?: boolean;
1880
+ integration_meta?: { [key: string]: any };
1881
+ company_namespace: string[];
1882
+ createdAt: string;
1883
+ updatedAt: string;
1884
+ __v: number;
1885
+ }
1886
+ export interface PaymentTermBody {
1887
+ name?: string;
1888
+ due_days?: number;
1889
+ editor?: AdminCreator;
1890
+ disabled?: boolean;
1891
+ integration_meta?: { [key: string]: any };
1892
+ company_namespace?: string[];
1893
+ }
1894
+
1895
+ export namespace Find {
1896
+ export type Params = DefaultPaginationQueryParams & {
1897
+ _id?: string[] | string;
1898
+ search?: string;
1899
+ name?: string[] | string;
1900
+ disabled?: boolean;
1901
+ [key: string]: any; // integration_meta.
1902
+ };
1903
+ export interface Result extends DefaultPaginationResult {
1904
+ data: PaymentTermSchema[];
1905
+ }
1906
+ }
1907
+
1908
+ export namespace Get {
1909
+ export type ID = string;
1910
+ export type Result = PaymentTermSchema;
1911
+ }
1912
+
1913
+ export namespace Create {
1914
+ export interface Body extends PaymentTermBody {
1915
+ name: string;
1916
+ due_days: number;
1917
+ }
1918
+ export type Result = PaymentTermSchema;
1919
+ }
1920
+
1921
+ export namespace Update {
1922
+ export type ID = string;
1923
+ export interface Body extends PaymentTermBody {
1924
+ _id?: string;
1925
+ createdAt?: string;
1926
+ updatedAt?: string;
1927
+ __v?: number;
1928
+ }
1929
+ export type Result = PaymentTermSchema;
1930
+ }
1931
+
1932
+ export namespace Remove {
1933
+ export type ID = string;
1934
+ export type Result = PaymentTermSchema;
1935
+ }
1936
+ }
1937
+
1938
+ export namespace Bank {
1939
+ export interface BankSchema {
1940
+ _id: string;
1941
+ name: string;
1942
+ country?: string[];
1943
+ integration_meta?: { [key: string]: any };
1944
+ company_namespace: string[];
1945
+ createdAt: string;
1946
+ updatedAt: string;
1947
+ __v: number;
1948
+ }
1949
+ export interface BankBody {
1950
+ name?: string;
1951
+ country?: string[];
1952
+ integration_meta?: { [key: string]: any };
1953
+ company_namespace?: string[];
1954
+ }
1955
+
1956
+ export namespace Find {
1957
+ export type Params = DefaultPaginationQueryParams & {
1958
+ _id?: string[] | string;
1959
+ search?: string;
1960
+ [key: string]: any; // integration_meta.
1961
+ };
1962
+ export interface Result extends DefaultPaginationResult {
1963
+ data: BankSchema[];
1964
+ }
1965
+ }
1966
+
1967
+ export namespace Get {
1968
+ export type ID = string;
1969
+ export type Result = BankSchema;
1970
+ }
1971
+
1972
+ export namespace Create {
1973
+ export interface Body extends BankBody {
1974
+ name: string;
1975
+ }
1976
+ export type Result = BankSchema;
1977
+ }
1978
+
1979
+ export namespace Update {
1980
+ export type ID = string;
1981
+ export interface Body extends BankBody {
1982
+ _id?: string;
1983
+ createdAt?: string;
1984
+ updatedAt?: string;
1985
+ __v?: number;
1986
+ }
1987
+ export type Result = BankSchema;
1988
+ }
1989
+ }
1990
+
1991
+ export namespace CustomStatus {
1992
+ type CustomStatusModel =
1993
+ | "proformas"
1994
+ | "fullinvoices"
1995
+ | "transfers"
1996
+ | "payments";
1997
+ export interface CustomStatusSchema {
1998
+ _id: string;
1999
+ name: string;
2000
+ code: string;
2001
+ model: CustomStatusModel;
2002
+ local_name?: string;
2003
+ is_default: boolean;
2004
+ color?: string;
2005
+ disabled?: boolean;
2006
+ company_namespace: string[];
2007
+ createdAt: string;
2008
+ updatedAt: string;
2009
+ __v: number;
2010
+ }
2011
+ export interface CustomStatusBody {
2012
+ name?: string;
2013
+ code: string;
2014
+ model: CustomStatusModel;
2015
+ local_name?: string;
2016
+ is_default: boolean;
2017
+ color?: string;
2018
+ company_namespace?: string[];
2019
+ disabled?: boolean;
2020
+ }
2021
+
2022
+ export namespace Find {
2023
+ export type Params = DefaultPaginationQueryParams & {
2024
+ _id?: string[] | string;
2025
+ search?: string;
2026
+ name?: string[] | string;
2027
+ code?: string[] | string;
2028
+ model?: CustomStatusModel | CustomStatusModel[];
2029
+ is_default?: boolean;
2030
+ color?: string[] | string;
2031
+ disabled?: boolean;
2032
+ [key: string]: any; // integration_meta.
2033
+ };
2034
+ export interface Result extends DefaultPaginationResult {
2035
+ data: CustomStatusSchema[];
2036
+ }
2037
+ }
2038
+
2039
+ export namespace Get {
2040
+ export type ID = string;
2041
+ export type Result = CustomStatusSchema;
2042
+ }
2043
+
2044
+ export namespace Create {
2045
+ export interface Body extends CustomStatusBody {
2046
+ name: string;
2047
+ model: CustomStatusModel;
2048
+ }
2049
+ export type Result = CustomStatusSchema;
2050
+ }
2051
+
2052
+ export namespace Update {
2053
+ export type ID = string;
2054
+ export interface Body extends CustomStatusBody {
2055
+ _id?: string;
2056
+ createdAt?: string;
2057
+ updatedAt?: string;
2058
+ __v?: number;
2059
+ }
2060
+ export type Result = CustomStatusSchema;
2061
+ }
2062
+
2063
+ export namespace Remove {
2064
+ export type ID = string;
2065
+ export type Result = CustomStatusSchema;
2066
+ }
2067
+ }
2068
+ export namespace Promotion {
2069
+ interface CompoundSchema {
2070
+ manual_allocation?: boolean;
2071
+ appliedCount: number;
2072
+ sorting: "cheapest" | "expensive";
2073
+ enforcement_mode:
2074
+ | "all_in_inventory"
2075
+ | "all"
2076
+ | "gift_in_inventory"
2077
+ | "gift";
2078
+ calculate_hidden_price?: boolean;
2079
+ usage_limit?: number;
2080
+ usage_limit_per_rep?: number;
2081
+ usage_limit_per_client?: number;
2082
+ cart_filters_operator: "and" | "or";
2083
+ cart_filters: {
2084
+ _id: string;
2085
+ filter_type:
2086
+ | "product"
2087
+ | "category"
2088
+ | "sub_category"
2089
+ | "product_group"
2090
+ | "brand"
2091
+ | "variant"
2092
+ | "cart_total"
2093
+ | "items_count"
2094
+ | "client"
2095
+ | "tag"
2096
+ | "channel"
2097
+ | "distinct_variants_count"
2098
+ | "distinct_products_count"
2099
+ | "promotion";
2100
+ value: string[];
2101
+ operator: "lte" | "lt" | "gte" | "gt" | "eq";
2102
+ reject_if_pass?: boolean;
2103
+ limit_type: "count" | "price_amount";
2104
+ limit_value: number;
2105
+ }[];
2106
+ items_filters_operator: "and" | "or";
2107
+ items_filters: {
2108
+ _id: string;
2109
+ filter_type:
2110
+ | "product"
2111
+ | "category"
2112
+ | "sub_category"
2113
+ | "product_group"
2114
+ | "brand"
2115
+ | "variant"
2116
+ | "any";
2117
+ value: string[];
2118
+ limit_type: "count" | "price_amount";
2119
+ limit_value: number;
2120
+ }[];
2121
+ get_items_operator: "and" | "or";
2122
+ get_items: {
2123
+ _id: string;
2124
+ filter_type:
2125
+ | "product"
2126
+ | "category"
2127
+ | "sub_category"
2128
+ | "product_group"
2129
+ | "brand"
2130
+ | "variant"
2131
+ | "gift";
2132
+ value: string[];
2133
+ limit_type: "count";
2134
+ limit_value: number;
2135
+ discount_ratio: number;
2136
+ }[];
2137
+ cart_adjustments: {
2138
+ adjustment_type:
2139
+ | "discount_amount"
2140
+ | "discount_ratio"
2141
+ | "shipping_fixed_price"
2142
+ | "shipping_discount_amount"
2143
+ | "shipping_discount_ratio"
2144
+ | "tax_exempt";
2145
+ value: boolean | number;
2146
+ }[];
2147
+ line_filters: {
2148
+ _id: string;
2149
+ filter_type:
2150
+ | "product"
2151
+ | "category"
2152
+ | "sub_category"
2153
+ | "product_group"
2154
+ | "brand"
2155
+ | "variant"
2156
+ | "line_total"
2157
+ | "base_unit_qty"
2158
+ | "promotion";
2159
+ value: string[];
2160
+ operator: "lte" | "lt" | "gte" | "gt" | "eq";
2161
+ reject_if_pass?: boolean;
2162
+ limit_type: "count" | "price_amount";
2163
+ limit_value: number;
2164
+ }[];
2165
+ line_adjustments: {
2166
+ adjustment_type: "discount_amount" | "discount_ratio" | "fixed_price";
2167
+ value: number;
2168
+ }[];
2169
+ line_filters_operator: "and" | "or";
2170
+ is_bulk: { type: boolean; default: false };
2171
+ rounding: "round" | "floor" | "ceil";
2172
+ bulk_over_provide?: boolean;
2173
+ bulk_limit_type?: "count" | "price_amount" | "ratio";
2174
+ bulk_data: {
2175
+ _id: string;
2176
+ from_limit_value: number;
2177
+ to_limit_value?: number;
2178
+ get_limit_value: number;
2179
+ }[];
2180
+ }
2181
+ export interface Schema {
2182
+ _id: string;
2183
+ type: "compound";
2184
+ from: number;
2185
+ to: number;
2186
+ priority?: number;
2187
+ name: string;
2188
+ description?: string;
2189
+ duration?: number;
2190
+ startsAt?: string;
2191
+ disabled?: boolean;
2192
+ details: CompoundSchema;
2193
+ copied_from?: string;
2194
+ ref?: string;
2195
+ company_namespace: string[];
2196
+ createdAt: string;
2197
+ updatedAt: string;
2198
+ __v: number;
2199
+ }
2200
+ }
2201
+
2202
+ export namespace Item {
2203
+ interface Modifier {
2204
+ modifiers_group_id?: string;
2205
+ name?: string;
2206
+ local_name?: string;
2207
+ price?: number;
2208
+ position?: number;
2209
+ disabled?: boolean;
2210
+ company_namespace: string[];
2211
+ overwritePrice?: number;
2212
+ discounted_price?: number;
2213
+ tax_amount?: number;
2214
+ gross_value?: number;
2215
+ }
2216
+ export interface ModifierGroup {
2217
+ name?: string;
2218
+ local_name?: string;
2219
+ position?: number;
2220
+ disabled?: boolean;
2221
+ multiple_modifiers?: boolean;
2222
+ company_namespace: string[];
2223
+ modifiers?: Modifier[];
2224
+ group_total?: number;
2225
+ group_total_before_tax?: number;
2226
+ group_tax_total?: number;
2227
+ }
2228
+ export interface Item_Variant {
2229
+ product_id: string;
2230
+ product_name: string;
2231
+ variant_id: string;
2232
+ variant_name: string;
2233
+ listed_price: number;
2234
+ variant_local_name?: string;
2235
+ variant_img?: string;
2236
+ product_local_name?: string;
2237
+ product_img?: string;
2238
+ product_sku?: string;
2239
+ product_barcode?: string;
2240
+ variant_sku?: string;
2241
+ variant_barcode?: string;
2242
+ }
2243
+ export interface Schema {
2244
+ _id: string;
2245
+ variant: Item_Variant;
2246
+ measureunit: {
2247
+ _id: string;
2248
+ name: string;
2249
+ factor: number;
2250
+ parent?: string;
2251
+ disabled?: boolean;
2252
+ company_namespace: string[];
2253
+ };
2254
+ tax: {
2255
+ name: string;
2256
+ rate: number;
2257
+ type: "inclusive" | "additive" | "N/A";
2258
+ disabled?: boolean;
2259
+ };
2260
+ promotions?: Promotion.Schema[];
2261
+ used_promotions?: { id: string; name: string };
2262
+ general_promotions?: { id: string; name: string };
2263
+ applicable_promotions?: { id: string; name: string };
2264
+ modifiers_groups: ModifierGroup[];
2265
+ isAdditional?: boolean;
2266
+ qty: number;
2267
+ base_unit_qty?: number;
2268
+ overwritePrice?: number;
2269
+ price: number;
2270
+ discounted_price: number;
2271
+ tax_amount: number;
2272
+ tax_total: number;
2273
+ discount_value: number;
2274
+ gross_value?: number;
2275
+ line_total?: number;
2276
+ total_before_tax?: number;
2277
+ hidden_price?: number;
2278
+ modifiers_total?: number;
2279
+ modifiers_total_before_tax?: number;
2280
+ modifiers_tax_total?: number;
2281
+ tax_total_without_modifiers?: number;
2282
+ line_total_without_modifiers?: number;
2283
+ total_before_tax_without_modifiers?: number;
2284
+ deductionRatio?: number;
2285
+ deductedTax?: number;
2286
+ deduction?: number;
2287
+ deductionBeforeTax?: number;
2288
+ lineTotalAfterDeduction?: number;
2289
+ company_namespace: string[];
2290
+ class: "invoice" | "return";
2291
+ note?: string;
2292
+ }
2293
+ export interface Body {
2294
+ variant: Item_Variant;
2295
+ measureunit: {
2296
+ _id: string;
2297
+ name: string;
2298
+ factor: number;
2299
+ parent?: string;
2300
+ disabled?: boolean;
2301
+ company_namespace: string[];
2302
+ };
2303
+ tax: {
2304
+ name: string;
2305
+ rate: number;
2306
+ type: "inclusive" | "additive" | "N/A";
2307
+ disabled?: boolean;
2308
+ };
2309
+ promotions?: Promotion.Schema[];
2310
+ used_promotions?: { id: string; name: string };
2311
+ general_promotions?: { id: string; name: string };
2312
+ applicable_promotions?: { id: string; name: string };
2313
+ modifiers_groups?: ModifierGroup[];
2314
+ isAdditional?: boolean;
2315
+ qty: number;
2316
+ base_unit_qty?: number;
2317
+ overwritePrice?: number;
2318
+ price: number;
2319
+ discounted_price: number;
2320
+ tax_amount: number;
2321
+ tax_total: number;
2322
+ discount_value: number;
2323
+ gross_value?: number;
2324
+ line_total?: number;
2325
+ total_before_tax?: number;
2326
+ hidden_price?: number;
2327
+ modifiers_total?: number;
2328
+ modifiers_total_before_tax?: number;
2329
+ modifiers_tax_total?: number;
2330
+ tax_total_without_modifiers?: number;
2331
+ line_total_without_modifiers?: number;
2332
+ total_before_tax_without_modifiers?: number;
2333
+ deductionRatio?: number;
2334
+ deductedTax?: number;
2335
+ deduction?: number;
2336
+ deductionBeforeTax?: number;
2337
+ lineTotalAfterDeduction?: number;
2338
+ company_namespace?: string[];
2339
+ note?: string;
2340
+ }
2341
+ }
2342
+
2343
+ export namespace FullInvoice {
2344
+ interface InvoiceSchema {
2345
+ _id: string;
2346
+ items: Item.Schema[];
2347
+ return_items: Item.Schema[];
2348
+ integration_meta?: { [key: string]: any };
2349
+ external_serial_number?: string;
2350
+ qr_code_tlv?: string;
2351
+ processable?: boolean;
2352
+ client_id: string;
2353
+ client_name: string;
2354
+ comment?: string;
2355
+ return_comment?: string;
2356
+ creator: AdminCreator | RepCreator | ClientCreator;
2357
+ latest?: boolean;
2358
+ version?: number;
2359
+ time?: number;
2360
+ issue_date: string;
2361
+ delivery_date?: string;
2362
+ currency: string;
2363
+ serial_number: SerialNumber;
2364
+ geo_tag?: {
2365
+ type: "Point";
2366
+ coordinates: number[];
2367
+ };
2368
+ sync_id: string;
2369
+ address?: { [key: string]: any };
2370
+ company_namespace: string[];
2371
+ promotions: Promotion.Schema[];
2372
+ priceLists: { [key: string]: any }[];
2373
+ visit_id?: string;
2374
+ teams?: string[];
2375
+ converter?: AdminCreator | RepCreator | ClientCreator;
2376
+ converted_proforma_serial_number?: SerialNumber;
2377
+ converted_proforma_return_serial_number?: SerialNumber;
2378
+ proforma_reference?: string;
2379
+ converted_at?: number;
2380
+ exclude_return_items?: boolean;
2381
+ returned_from?: string;
2382
+ returned_to?: string;
2383
+ returned_from_serial_number?: SerialNumber;
2384
+ returned_to_serial_number?: SerialNumber;
2385
+ is_void?: boolean;
2386
+ due_date: string;
2387
+ return_serial_number?: SerialNumber;
2388
+ origin_warehouse: string;
2389
+ route?: string;
2390
+ paymentsData: {
2391
+ _id: string;
2392
+ invoice_value: number;
2393
+ paid: number;
2394
+ balance: number;
2395
+ payments: PaymentData[];
2396
+ };
2397
+ consumption: {
2398
+ status: "consumed" | "unconsumed" | "partially_consumed";
2399
+ remainder: number;
2400
+ };
2401
+ status: InvoiceStatus;
2402
+ custom_status?: string;
2403
+ subtotal: number;
2404
+ discount_amount: number;
2405
+ taxable_subtotal: number;
2406
+ tax_amount: number;
2407
+ total: number;
2408
+ pre_subtotal: number;
2409
+ pre_discount_amount: number;
2410
+ pre_taxable_subtotal: number;
2411
+ pre_tax_amount: number;
2412
+ pre_total: number;
2413
+ return_subtotal: number;
2414
+ return_discount_amount: number;
2415
+ return_taxable_subtotal: number;
2416
+ return_tax_amount: number;
2417
+ return_total: number;
2418
+ deductionRatio?: number;
2419
+ deductionFixed?: number;
2420
+ totalDeductedTax?: number;
2421
+ totalDeduction?: number;
2422
+ totalDeductionBeforeTax?: number;
2423
+ totalAfterDeduction?: number;
2424
+ taxes?: { [key: string]: any };
2425
+ overwriteDeductionFixed?: number;
2426
+ overwriteTaxExempt?: boolean;
2427
+ tax_exempt?: boolean;
2428
+ overwriteDeductionRatio?: number;
2429
+ shipping_zone?: {
2430
+ geoData: {
2431
+ type: "Polygon";
2432
+ coordinates: number[][][]; // ??????
2433
+ }[];
2434
+ name: string;
2435
+ local_name?: string;
2436
+ shipping_method?: {
2437
+ local_name?: string;
2438
+ name: string;
2439
+ rate?: number;
2440
+ tax?: string;
2441
+ description?: string;
2442
+ local_description?: string;
2443
+ company_namespace: string[];
2444
+ };
2445
+ note?: string;
2446
+ local_note?: string;
2447
+ country: string;
2448
+ reachable: boolean;
2449
+ company_namespace: string[];
2450
+ };
2451
+ payment_method?: {
2452
+ name: string;
2453
+ local_name?: string;
2454
+ fee?: number;
2455
+ rate?: number;
2456
+ type: "online" | "offline";
2457
+ company_namespace: string[];
2458
+ };
2459
+ shipping_price?: number;
2460
+ shipping_tax?: number;
2461
+ shipping_charge?: number;
2462
+ payment_charge?: number;
2463
+ total_with_charges?: number;
2464
+ payment?: { amount?: number };
2465
+ createdAt: string;
2466
+ updatedAt: string;
2467
+ __v: number;
2468
+ }
2469
+ interface CreateBody {
2470
+ items?: Item.Body[];
2471
+ return_items?: Item.Body[];
2472
+ integration_meta?: { [key: string]: any };
2473
+ external_serial_number?: string;
2474
+ processable?: boolean;
2475
+ client_id: string;
2476
+ client_name: string;
2477
+ comment?: string;
2478
+ return_comment?: string;
2479
+ creator?: AdminCreator | RepCreator | ClientCreator;
2480
+ version?: number;
2481
+ time?: number;
2482
+ issue_date: string;
2483
+ delivery_date?: string;
2484
+ currency?: string;
2485
+ serial_number?: SerialNumber;
2486
+ geo_tag?: {
2487
+ type: "Point";
2488
+ coordinates: number[];
2489
+ };
2490
+ sync_id: string;
2491
+ address?: { [key: string]: any };
2492
+ company_namespace?: string[];
2493
+ promotions?: Promotion.Schema[];
2494
+ priceLists: { [key: string]: any }[];
2495
+ visit_id?: string;
2496
+ teams?: string[];
2497
+ due_date: string;
2498
+ return_serial_number?: SerialNumber;
2499
+ origin_warehouse: string;
2500
+ route?: string;
2501
+ custom_status?: string;
2502
+ subtotal: number;
2503
+ discount_amount: number;
2504
+ taxable_subtotal: number;
2505
+ tax_amount: number;
2506
+ total: number;
2507
+ pre_subtotal: number;
2508
+ pre_discount_amount: number;
2509
+ pre_taxable_subtotal: number;
2510
+ pre_tax_amount: number;
2511
+ pre_total: number;
2512
+ return_subtotal: number;
2513
+ return_discount_amount: number;
2514
+ return_taxable_subtotal: number;
2515
+ return_tax_amount: number;
2516
+ return_total: number;
2517
+ deductionRatio?: number;
2518
+ deductionFixed?: number;
2519
+ totalDeductedTax?: number;
2520
+ totalDeduction?: number;
2521
+ totalDeductionBeforeTax?: number;
2522
+ totalAfterDeduction?: number;
2523
+ taxes?: { [key: string]: any };
2524
+ overwriteDeductionFixed?: number;
2525
+ overwriteTaxExempt?: boolean;
2526
+ tax_exempt?: boolean;
2527
+ overwriteDeductionRatio?: number;
2528
+ shipping_zone?: {
2529
+ geoData: {
2530
+ type: "Polygon";
2531
+ coordinates: number[][][];
2532
+ }[];
2533
+ name: string;
2534
+ local_name?: string;
2535
+ shipping_method?: {
2536
+ local_name?: string;
2537
+ name: string;
2538
+ rate?: number;
2539
+ tax?: string;
2540
+ description?: string;
2541
+ local_description?: string;
2542
+ company_namespace: string[];
2543
+ };
2544
+ note?: string;
2545
+ local_note?: string;
2546
+ country: string;
2547
+ reachable: boolean;
2548
+ company_namespace: string[];
2549
+ };
2550
+ payment_method?: {
2551
+ name: string;
2552
+ local_name?: string;
2553
+ fee?: number;
2554
+ rate?: number;
2555
+ type: "online" | "offline";
2556
+ company_namespace: string[];
2557
+ };
2558
+ shipping_price?: number;
2559
+ shipping_tax?: number;
2560
+ shipping_charge?: number;
2561
+ payment_charge?: number;
2562
+ total_with_charges?: number;
2563
+ payment?: { amount?: number };
2564
+ }
2565
+ interface UpdateBody {
2566
+ integration_meta?: { [key: string]: any };
2567
+ issue_date?: string;
2568
+ }
2569
+
2570
+ type InvoiceSchemaWithPopulatedKeys = {
2571
+ _id: string;
2572
+ items: {
2573
+ variant: {
2574
+ product_name: string;
2575
+ variant_id: Pick<Variant.VariantSchema, "sku" | "_id" | "barcode">;
2576
+ product_id: Pick<Product.ProductSchema, "sku" | "_id" | "barcode">;
2577
+ variant_name: string;
2578
+ listed_price: number;
2579
+ variant_local_name?: string;
2580
+ variant_img?: string;
2581
+ product_local_name?: string;
2582
+ product_img?: string;
2583
+ product_sku?: string;
2584
+ product_barcode?: string;
2585
+ variant_sku?: string;
2586
+ variant_barcode?: string;
2587
+ };
2588
+ measureunit: {
2589
+ _id: string;
2590
+ name: string;
2591
+ factor: number;
2592
+ parent?: string;
2593
+ disabled?: boolean;
2594
+ company_namespace: string[];
2595
+ };
2596
+ tax: {
2597
+ name: string;
2598
+ rate: number;
2599
+ type: "inclusive" | "additive" | "N/A";
2600
+ disabled?: boolean;
2601
+ };
2602
+ promotions?: Promotion.Schema[];
2603
+ used_promotions?: { id: string; name: string };
2604
+ general_promotions?: { id: string; name: string };
2605
+ applicable_promotions?: { id: string; name: string };
2606
+ modifiers_groups?: Item.ModifierGroup[];
2607
+ isAdditional?: boolean;
2608
+ qty: number;
2609
+ base_unit_qty?: number;
2610
+ overwritePrice?: number;
2611
+ price: number;
2612
+ discounted_price: number;
2613
+ tax_amount: number;
2614
+ tax_total: number;
2615
+ discount_value: number;
2616
+ gross_value?: number;
2617
+ line_total?: number;
2618
+ total_before_tax?: number;
2619
+ hidden_price?: number;
2620
+ modifiers_total?: number;
2621
+ modifiers_total_before_tax?: number;
2622
+ modifiers_tax_total?: number;
2623
+ tax_total_without_modifiers?: number;
2624
+ line_total_without_modifiers?: number;
2625
+ total_before_tax_without_modifiers?: number;
2626
+ deductionRatio?: number;
2627
+ deductedTax?: number;
2628
+ deduction?: number;
2629
+ deductionBeforeTax?: number;
2630
+ lineTotalAfterDeduction?: number;
2631
+ company_namespace?: string[];
2632
+ note?: string;
2633
+ }[];
2634
+ return_items: {
2635
+ variant: {
2636
+ product_name: string;
2637
+ variant_id: Pick<Variant.VariantSchema, "sku" | "_id" | "barcode">;
2638
+ product_id: Pick<Product.ProductSchema, "sku" | "_id" | "barcode">;
2639
+ variant_name: string;
2640
+ listed_price: number;
2641
+ variant_local_name?: string;
2642
+ variant_img?: string;
2643
+ product_local_name?: string;
2644
+ product_img?: string;
2645
+ product_sku?: string;
2646
+ product_barcode?: string;
2647
+ variant_sku?: string;
2648
+ variant_barcode?: string;
2649
+ };
2650
+ measureunit: {
2651
+ _id: string;
2652
+ name: string;
2653
+ factor: number;
2654
+ parent?: string;
2655
+ disabled?: boolean;
2656
+ company_namespace: string[];
2657
+ };
2658
+ tax: {
2659
+ name: string;
2660
+ rate: number;
2661
+ type: "inclusive" | "additive" | "N/A";
2662
+ disabled?: boolean;
2663
+ };
2664
+ promotions?: Promotion.Schema[];
2665
+ used_promotions?: { id: string; name: string };
2666
+ general_promotions?: { id: string; name: string };
2667
+ applicable_promotions?: { id: string; name: string };
2668
+ modifiers_groups?: Item.ModifierGroup[];
2669
+ isAdditional?: boolean;
2670
+ qty: number;
2671
+ base_unit_qty?: number;
2672
+ overwritePrice?: number;
2673
+ price: number;
2674
+ discounted_price: number;
2675
+ tax_amount: number;
2676
+ tax_total: number;
2677
+ discount_value: number;
2678
+ gross_value?: number;
2679
+ line_total?: number;
2680
+ total_before_tax?: number;
2681
+ hidden_price?: number;
2682
+ modifiers_total?: number;
2683
+ modifiers_total_before_tax?: number;
2684
+ modifiers_tax_total?: number;
2685
+ tax_total_without_modifiers?: number;
2686
+ line_total_without_modifiers?: number;
2687
+ total_before_tax_without_modifiers?: number;
2688
+ deductionRatio?: number;
2689
+ deductedTax?: number;
2690
+ deduction?: number;
2691
+ deductionBeforeTax?: number;
2692
+ lineTotalAfterDeduction?: number;
2693
+ company_namespace?: string[];
2694
+ note?: string;
2695
+ }[];
2696
+ integration_meta?: { [key: string]: any };
2697
+ external_serial_number?: string;
2698
+ qr_code_tlv?: string;
2699
+ processable?: boolean;
2700
+ client_name: string;
2701
+ comment?: string;
2702
+ return_comment?: string;
2703
+ creator: AdminCreator | RepCreator | ClientCreator;
2704
+ latest?: boolean;
2705
+ version?: number;
2706
+ time?: number;
2707
+ issue_date: string;
2708
+ delivery_date?: string;
2709
+ currency: string;
2710
+ serial_number: SerialNumber;
2711
+ geo_tag?: {
2712
+ type: "Point";
2713
+ coordinates: number[];
2714
+ };
2715
+ sync_id: string;
2716
+ address?: { [key: string]: any };
2717
+ company_namespace: string[];
2718
+ promotions: Promotion.Schema[];
2719
+ priceLists: { [key: string]: any }[];
2720
+ visit_id?: string;
2721
+ teams?: string[];
2722
+ converter?: AdminCreator | RepCreator | ClientCreator;
2723
+ converted_proforma_serial_number?: SerialNumber;
2724
+ converted_proforma_return_serial_number?: SerialNumber;
2725
+ proforma_reference?: string;
2726
+ converted_at?: number;
2727
+ exclude_return_items?: boolean;
2728
+ returned_from?: string;
2729
+ returned_to?: string;
2730
+ returned_from_serial_number?: SerialNumber;
2731
+ returned_to_serial_number?: SerialNumber;
2732
+ is_void?: boolean;
2733
+ due_date: string;
2734
+ return_serial_number?: SerialNumber;
2735
+ origin_warehouse: string;
2736
+ route?: string;
2737
+ paymentsData: {
2738
+ _id: string;
2739
+ invoice_value: number;
2740
+ paid: number;
2741
+ balance: number;
2742
+ payments: PaymentData[];
2743
+ };
2744
+ consumption: {
2745
+ status: "consumed" | "unconsumed" | "partially_consumed";
2746
+ remainder: number;
2747
+ };
2748
+ status: InvoiceStatus;
2749
+ subtotal: number;
2750
+ discount_amount: number;
2751
+ taxable_subtotal: number;
2752
+ tax_amount: number;
2753
+ total: number;
2754
+ pre_subtotal: number;
2755
+ pre_discount_amount: number;
2756
+ pre_taxable_subtotal: number;
2757
+ pre_tax_amount: number;
2758
+ pre_total: number;
2759
+ return_subtotal: number;
2760
+ return_discount_amount: number;
2761
+ return_taxable_subtotal: number;
2762
+ return_tax_amount: number;
2763
+ return_total: number;
2764
+ deductionRatio?: number;
2765
+ deductionFixed?: number;
2766
+ totalDeductedTax?: number;
2767
+ totalDeduction?: number;
2768
+ totalDeductionBeforeTax?: number;
2769
+ totalAfterDeduction?: number;
2770
+ taxes?: { [key: string]: any };
2771
+ overwriteDeductionFixed?: number;
2772
+ overwriteTaxExempt?: boolean;
2773
+ tax_exempt?: boolean;
2774
+ overwriteDeductionRatio?: number;
2775
+ shipping_zone?: {
2776
+ geoData: {
2777
+ type: "Polygon";
2778
+ coordinates: number[][][]; // ??????
2779
+ }[];
2780
+ name: string;
2781
+ local_name?: string;
2782
+ shipping_method?: {
2783
+ local_name?: string;
2784
+ name: string;
2785
+ rate?: number;
2786
+ tax?: string;
2787
+ description?: string;
2788
+ local_description?: string;
2789
+ company_namespace: string[];
2790
+ };
2791
+ note?: string;
2792
+ local_note?: string;
2793
+ country: string;
2794
+ reachable: boolean;
2795
+ company_namespace: string[];
2796
+ };
2797
+ payment_method?: {
2798
+ name: string;
2799
+ local_name?: string;
2800
+ fee?: number;
2801
+ rate?: number;
2802
+ type: "online" | "offline";
2803
+ company_namespace: string[];
2804
+ };
2805
+ shipping_price?: number;
2806
+ shipping_tax?: number;
2807
+ shipping_charge?: number;
2808
+ payment_charge?: number;
2809
+ total_with_charges?: number;
2810
+ payment?: { amount?: number };
2811
+ createdAt: string;
2812
+ updatedAt: string;
2813
+ __v: number;
2814
+ client_id?: string | Client.ClientSchema;
2815
+ custom_status?: string | CustomStatus.CustomStatusSchema;
2816
+ tax_number?: string | Pick<Client.ClientSchema, "_id" | "tax_number">;
2817
+ };
2818
+
2819
+ type InvoiceStatus = "paid" | "unpaid" | "partially_paid";
2820
+ type PopulatedKeys = "client" | "tax_number" | "custom_status";
2821
+ type SortingKeys =
2822
+ | "line_total"
2823
+ | "product_name"
2824
+ | "variant_name"
2825
+ | "product_sku"
2826
+ | "product_barcode"
2827
+ | "variant_sku"
2828
+ | "variant_barcode";
2829
+ export namespace Find {
2830
+ export type Params = DefaultPaginationQueryParams & {
2831
+ _id?: string[] | string;
2832
+ "creator._id"?: string[] | string;
2833
+ creator?: string[] | string;
2834
+ client_id?: string[] | string;
2835
+ clients?: string[] | string;
2836
+ from_issue_date?: number;
2837
+ to_issue_date?: number;
2838
+ origin_warehouse?: string[] | string;
2839
+ custom_status?: string[] | string;
2840
+ status?: InvoiceStatus | InvoiceStatus[];
2841
+ is_void: false;
2842
+ has_return?: boolean;
2843
+ [key: string]: any; // integration_meta.
2844
+ populatedKeys?: PopulatedKeys[];
2845
+ sortPage?: SortingKeys;
2846
+ };
2847
+ export interface Result extends DefaultPaginationResult {
2848
+ data: InvoiceSchemaWithPopulatedKeys[];
2849
+ absolute_total: number;
2850
+ page_total: number;
2851
+ }
2852
+ }
2853
+
2854
+ export namespace Get {
2855
+ export type ID = string;
2856
+ export interface Params {
2857
+ populatedKeys?: PopulatedKeys[];
2858
+ sortPage?: SortingKeys;
2859
+ }
2860
+ export type Result = InvoiceSchemaWithPopulatedKeys;
2861
+ }
2862
+
2863
+ export namespace Create {
2864
+ export type Body = CreateBody;
2865
+ export type Result = InvoiceSchema;
2866
+ }
2867
+
2868
+ export namespace Update {
2869
+ export type ID = string;
2870
+ export type Body = UpdateBody;
2871
+ export type Result = InvoiceSchema;
2872
+ }
2873
+ }
2874
+
2875
+ export namespace Proforma {
2876
+ interface ProformaSchema {
2877
+ _id: string;
2878
+ items: Item.Schema[];
2879
+ integration_meta?: { [key: string]: any };
2880
+ external_serial_number?: string;
2881
+ processable?: boolean;
2882
+ client_id: string;
2883
+ client_name: string;
2884
+ comment?: string;
2885
+ creator: AdminCreator | RepCreator | ClientCreator;
2886
+ latest: boolean;
2887
+ version?: number;
2888
+ time?: number;
2889
+ issue_date: string;
2890
+ delivery_date?: string;
2891
+ currency: string;
2892
+ serial_number: SerialNumber;
2893
+ geo_tag?: {
2894
+ type: "Point";
2895
+ coordinates: number[];
2896
+ };
2897
+ sync_id: string;
2898
+ address?: { [key: string]: any };
2899
+ company_namespace: string[];
2900
+ promotions: Promotion.Schema[];
2901
+ priceLists: { [key: string]: any }[];
2902
+ visit_id?: string;
2903
+ teams?: string[];
2904
+ converter?: AdminCreator | RepCreator | ClientCreator;
2905
+ invoice_reference?: string;
2906
+ converted_at?: number;
2907
+ route?: string;
2908
+ status: ProformaStatus;
2909
+ custom_status?: string;
2910
+ editor?: AdminCreator | RepCreator | ClientCreator;
2911
+ disabled: boolean;
2912
+ subtotal: number;
2913
+ discount_amount: number;
2914
+ taxable_subtotal: number;
2915
+ tax_amount: number;
2916
+ total: number;
2917
+ pre_subtotal?: number;
2918
+ pre_discount_amount?: number;
2919
+ pre_taxable_subtotal?: number;
2920
+ pre_tax_amount?: number;
2921
+ pre_total?: number;
2922
+ return_subtotal?: number;
2923
+ return_discount_amount?: number;
2924
+ return_taxable_subtotal?: number;
2925
+ return_tax_amount?: number;
2926
+ return_total?: number;
2927
+ deductionRatio?: number;
2928
+ deductionFixed?: number;
2929
+ totalDeductedTax?: number;
2930
+ totalDeduction?: number;
2931
+ totalDeductionBeforeTax?: number;
2932
+ totalAfterDeduction?: number;
2933
+ taxes?: { [key: string]: any };
2934
+ overwriteDeductionFixed?: number;
2935
+ overwriteTaxExempt?: boolean;
2936
+ tax_exempt?: boolean;
2937
+ overwriteDeductionRatio?: number;
2938
+ shipping_zone?: {
2939
+ geoData: {
2940
+ type: "Polygon";
2941
+ coordinates: number[][][];
2942
+ }[];
2943
+ name: string;
2944
+ local_name?: string;
2945
+ shipping_method?: {
2946
+ local_name?: string;
2947
+ name: string;
2948
+ rate?: number;
2949
+ tax?: string;
2950
+ description?: string;
2951
+ local_description?: string;
2952
+ company_namespace: string[];
2953
+ };
2954
+ note?: string;
2955
+ local_note?: string;
2956
+ country: string;
2957
+ reachable: boolean;
2958
+ company_namespace: string[];
2959
+ };
2960
+ payment_method?: {
2961
+ name: string;
2962
+ local_name?: string;
2963
+ fee?: number;
2964
+ rate?: number;
2965
+ type: "online" | "offline";
2966
+ company_namespace: string[];
2967
+ };
2968
+ shipping_price?: number;
2969
+ shipping_tax?: number;
2970
+ shipping_charge?: number;
2971
+ payment_charge?: number;
2972
+ total_with_charges?: number;
2973
+ createdAt: string;
2974
+ updatedAt: string;
2975
+ __v: number;
2976
+ }
2977
+ interface CreateBody {
2978
+ items: Item.Schema[];
2979
+ integration_meta?: { [key: string]: any };
2980
+ external_serial_number?: string;
2981
+ processable?: boolean;
2982
+ client_id: string;
2983
+ client_name: string;
2984
+ comment?: string;
2985
+ creator: AdminCreator | RepCreator | ClientCreator;
2986
+ version?: number;
2987
+ time?: number;
2988
+ issue_date: string;
2989
+ delivery_date?: string;
2990
+ currency?: string;
2991
+ serial_number?: SerialNumber;
2992
+ geo_tag?: {
2993
+ type: "Point";
2994
+ coordinates: number[];
2995
+ };
2996
+ sync_id: string;
2997
+ address?: { [key: string]: any };
2998
+ company_namespace?: string[];
2999
+ promotions?: Promotion.Schema[];
3000
+ priceLists?: { [key: string]: any }[];
3001
+ visit_id?: string;
3002
+ teams?: string[];
3003
+ route?: string;
3004
+ custom_status?: string;
3005
+ disabled?: boolean;
3006
+ subtotal: number;
3007
+ discount_amount: number;
3008
+ taxable_subtotal: number;
3009
+ tax_amount: number;
3010
+ total: number;
3011
+ pre_subtotal?: number;
3012
+ pre_discount_amount?: number;
3013
+ pre_taxable_subtotal?: number;
3014
+ pre_tax_amount?: number;
3015
+ pre_total?: number;
3016
+ return_subtotal?: number;
3017
+ return_discount_amount?: number;
3018
+ return_taxable_subtotal?: number;
3019
+ return_tax_amount?: number;
3020
+ return_total?: number;
3021
+ deductionRatio?: number;
3022
+ deductionFixed?: number;
3023
+ totalDeductedTax?: number;
3024
+ totalDeduction?: number;
3025
+ totalDeductionBeforeTax?: number;
3026
+ totalAfterDeduction?: number;
3027
+ taxes?: { [key: string]: any };
3028
+ overwriteDeductionFixed?: number;
3029
+ overwriteTaxExempt?: boolean;
3030
+ tax_exempt?: boolean;
3031
+ overwriteDeductionRatio?: number;
3032
+ shipping_zone?: {
3033
+ geoData: {
3034
+ type: "Polygon";
3035
+ coordinates: number[][][];
3036
+ }[];
3037
+ name: string;
3038
+ local_name?: string;
3039
+ shipping_method?: {
3040
+ local_name?: string;
3041
+ name: string;
3042
+ rate?: number;
3043
+ tax?: string;
3044
+ description?: string;
3045
+ local_description?: string;
3046
+ company_namespace: string[];
3047
+ };
3048
+ note?: string;
3049
+ local_note?: string;
3050
+ country: string;
3051
+ reachable: boolean;
3052
+ company_namespace: string[];
3053
+ };
3054
+ payment_method?: {
3055
+ name: string;
3056
+ local_name?: string;
3057
+ fee?: number;
3058
+ rate?: number;
3059
+ type: "online" | "offline";
3060
+ company_namespace: string[];
3061
+ };
3062
+ shipping_price?: number;
3063
+ shipping_tax?: number;
3064
+ shipping_charge?: number;
3065
+ payment_charge?: number;
3066
+ total_with_charges?: number;
3067
+ }
3068
+ interface UpdateBody {
3069
+ _id?: string;
3070
+ items?: Item.Schema[];
3071
+ integration_meta?: { [key: string]: any };
3072
+ external_serial_number?: string;
3073
+ processable?: boolean;
3074
+ client_id?: string;
3075
+ client_name?: string;
3076
+ comment?: string;
3077
+ creator?: AdminCreator | RepCreator | ClientCreator;
3078
+ latest?: boolean;
3079
+ version?: number;
3080
+ time?: number;
3081
+ issue_date?: string;
3082
+ delivery_date?: string;
3083
+ currency?: string;
3084
+ serial_number?: SerialNumber;
3085
+ geo_tag?: {
3086
+ type: "Point";
3087
+ coordinates: number[];
3088
+ };
3089
+ sync_id?: string;
3090
+ address?: { [key: string]: any };
3091
+ company_namespace?: string[];
3092
+ promotions?: Promotion.Schema[];
3093
+ priceLists?: { [key: string]: any }[];
3094
+ visit_id?: string;
3095
+ teams?: string[];
3096
+ converter?: AdminCreator | RepCreator | ClientCreator;
3097
+ invoice_reference?: string;
3098
+ converted_at?: number;
3099
+ route?: string;
3100
+ status?: ProformaStatus;
3101
+ custom_status?: string;
3102
+ editor?: AdminCreator | RepCreator | ClientCreator;
3103
+ disabled?: boolean;
3104
+ subtotal?: number;
3105
+ discount_amount?: number;
3106
+ taxable_subtotal?: number;
3107
+ tax_amount?: number;
3108
+ total?: number;
3109
+ pre_subtotal?: number;
3110
+ pre_discount_amount?: number;
3111
+ pre_taxable_subtotal?: number;
3112
+ pre_tax_amount?: number;
3113
+ pre_total?: number;
3114
+ return_subtotal?: number;
3115
+ return_discount_amount?: number;
3116
+ return_taxable_subtotal?: number;
3117
+ return_tax_amount?: number;
3118
+ return_total?: number;
3119
+ deductionRatio?: number;
3120
+ deductionFixed?: number;
3121
+ totalDeductedTax?: number;
3122
+ totalDeduction?: number;
3123
+ totalDeductionBeforeTax?: number;
3124
+ totalAfterDeduction?: number;
3125
+ taxes?: { [key: string]: any };
3126
+ overwriteDeductionFixed?: number;
3127
+ overwriteTaxExempt?: boolean;
3128
+ tax_exempt?: boolean;
3129
+ overwriteDeductionRatio?: number;
3130
+ shipping_zone?: {
3131
+ geoData: {
3132
+ type: "Polygon";
3133
+ coordinates: number[][][];
3134
+ }[];
3135
+ name: string;
3136
+ local_name?: string;
3137
+ shipping_method?: {
3138
+ local_name?: string;
3139
+ name: string;
3140
+ rate?: number;
3141
+ tax?: string;
3142
+ description?: string;
3143
+ local_description?: string;
3144
+ company_namespace: string[];
3145
+ };
3146
+ note?: string;
3147
+ local_note?: string;
3148
+ country: string;
3149
+ reachable: boolean;
3150
+ company_namespace: string[];
3151
+ };
3152
+ payment_method?: {
3153
+ name: string;
3154
+ local_name?: string;
3155
+ fee?: number;
3156
+ rate?: number;
3157
+ type: "online" | "offline";
3158
+ company_namespace: string[];
3159
+ };
3160
+ shipping_price?: number;
3161
+ shipping_tax?: number;
3162
+ shipping_charge?: number;
3163
+ payment_charge?: number;
3164
+ total_with_charges?: number;
3165
+ createdAt?: string;
3166
+ updatedAt?: string;
3167
+ __v?: number;
3168
+ }
3169
+
3170
+ type ProformaSchemaWithPopulatedKeys = ProformaSchema & {
3171
+ items: (Item.Body & {
3172
+ variant: Item.Item_Variant & {
3173
+ variant_sku?: string;
3174
+ product_sku?: string;
3175
+ variant_barcode?: string;
3176
+ product_barcode?: string;
3177
+ };
3178
+ })[];
3179
+ client_id?: string | Client.ClientSchema;
3180
+ custom_status?: string | CustomStatus.CustomStatusSchema;
3181
+ cycle?: Cycle.Schema;
3182
+ };
3183
+ type PopulatedKeys = "custom_status";
3184
+ type ProformaStatus = "pending" | "approved" | "processing" | "rejected";
3185
+ type SortingKeys =
3186
+ | "product_sku"
3187
+ | "product_barcode"
3188
+ | "variant_name"
3189
+ | "product_name"
3190
+ | "variant_sku"
3191
+ | "variant_barcode";
3192
+ export namespace Find {
3193
+ export type Params = DefaultPaginationQueryParams & {
3194
+ _id?: string[] | string;
3195
+ "creator._id"?: string[] | string;
3196
+ creator?: string[] | string;
3197
+ clients?: string[] | string;
3198
+ disabled?: boolean;
3199
+ latest?: boolean;
3200
+ "serial_number.formatted"?: string[] | string;
3201
+ client_id?: string[] | string;
3202
+ from_issue_date?: number;
3203
+ to_issue_date?: number;
3204
+ from_time?: number;
3205
+ to_time?: number;
3206
+ from_createdAt?: number;
3207
+ to_createdAt?: number;
3208
+ from_updatedAt?: number;
3209
+ to_updatedAt?: number;
3210
+ custom_status?: string[] | string;
3211
+ status?: ProformaStatus | ProformaStatus[];
3212
+ [key: string]: any; // integration_meta.
3213
+ sortPage?: SortingKeys;
3214
+ export?: "excel";
3215
+ withClientDetails?: boolean;
3216
+ populatedKeys?: PopulatedKeys[];
3217
+ nodeCycles?: string[] | string;
3218
+ withCycle?: boolean;
3219
+ };
3220
+ export interface Result extends DefaultPaginationResult {
3221
+ data: ProformaSchemaWithPopulatedKeys[];
3222
+ }
3223
+ }
3224
+
3225
+ export namespace Get {
3226
+ export type ID = string;
3227
+ export interface Params {
3228
+ sortPage?: SortingKeys;
3229
+ withClientDetails?: boolean;
3230
+ withCycle?: boolean;
3231
+ }
3232
+ export type Result =
3233
+ | (ProformaSchemaWithPopulatedKeys & {
3234
+ custom_status: CustomStatus.CustomStatusSchema;
3235
+ })
3236
+ | {
3237
+ proforma: ProformaSchemaWithPopulatedKeys & {
3238
+ custom_status: CustomStatus.CustomStatusSchema;
3239
+ };
3240
+ cycle: Cycle.Schema & {
3241
+ can_edit: boolean;
3242
+ current_nodes: string[];
3243
+ };
3244
+ };
3245
+ }
3246
+
3247
+ export namespace Create {
3248
+ export type Body = CreateBody;
3249
+ export type Result = ProformaSchema;
3250
+ }
3251
+
3252
+ export namespace Update {
3253
+ export type ID = string;
3254
+ export type Body = UpdateBody;
3255
+ export type Result = ProformaSchema;
3256
+ }
3257
+ }
3258
+
3259
+ export namespace Payment {
3260
+ interface PaymentSchema {
3261
+ _id: string;
3262
+ status: PaymentStatus;
3263
+ remainder: number;
3264
+ amount: number;
3265
+ client_id: string;
3266
+ client_name: string;
3267
+ creator: AdminCreator | RepCreator;
3268
+ time?: number;
3269
+ serial_number: SerialNumber;
3270
+ route?: string;
3271
+ paytime: string;
3272
+ note?: string;
3273
+ currency: string;
3274
+ payment_type: PaymentType;
3275
+ check?: Check;
3276
+ LinkedTxn?: {
3277
+ Txn_serial_number: SerialNumber;
3278
+ Txn_invoice_total: number;
3279
+ TxnType: "refund" | "invoice";
3280
+ };
3281
+ company_namespace: string[];
3282
+ integration_meta?: { [key: string]: any };
3283
+ sync_id: string;
3284
+ custom_status?: string;
3285
+ visit_id?: string;
3286
+ teams?: string[];
3287
+ paymentsData: {
3288
+ amount: number;
3289
+ paid: number;
3290
+ balance: number;
3291
+ payments: PaymentData[];
3292
+ };
3293
+ createdAt: string;
3294
+ updatedAt: string;
3295
+ __v: number;
3296
+ }
3297
+ interface CreateBody {
3298
+ amount: number;
3299
+ client_id: string;
3300
+ client_name: string;
3301
+ time?: number;
3302
+ serial_number?: SerialNumber;
3303
+ route?: string;
3304
+ paytime: string;
3305
+ note?: string;
3306
+ currency: string;
3307
+ payment_type: PaymentType;
3308
+ check?: Check;
3309
+ LinkedTxn?: {
3310
+ Txn_serial_number: SerialNumber;
3311
+ Txn_invoice_total: number;
3312
+ TxnType: "refund" | "invoice";
3313
+ };
3314
+ company_namespace?: string[];
3315
+ integration_meta?: { [key: string]: any };
3316
+ sync_id: string;
3317
+ custom_status?: string;
3318
+ visit_id?: string;
3319
+ teams?: string[];
3320
+ }
3321
+ interface UpdateBody {
3322
+ integration_meta?: { [key: string]: any };
3323
+ }
3324
+
3325
+ type PaymentSchemaWithPopulatedKeys = PaymentSchema & {
3326
+ balance_to_refund: number;
3327
+ custom_status?: string | CustomStatus.CustomStatusSchema;
3328
+ check?: Check & { bank: Bank.BankSchema };
3329
+ invoice?: {
3330
+ invoice_serial_number: string;
3331
+ invoice_date: string;
3332
+ invoice_due_date: string;
3333
+ original_amount: number;
3334
+ payment: number;
3335
+ };
3336
+ };
3337
+ type PaymentType = "check" | "cash";
3338
+ type PopulatedKeys = "custom_status";
3339
+ type PaymentStatus = "consumed" | "unconsumed" | "partially_consumed";
3340
+ export namespace Find {
3341
+ export type Params = DefaultPaginationQueryParams & {
3342
+ _id?: string[] | string;
3343
+ "creator._id"?: string[] | string;
3344
+ client_id?: string[] | string;
3345
+ from_paytime?: number;
3346
+ to_paytime?: number;
3347
+ custom_status?: string[] | string;
3348
+ payment_type?: PaymentType | PaymentType[];
3349
+ creator?: string[] | string;
3350
+ clients?: string[] | string;
3351
+ withPrintDetails?: boolean;
3352
+ [key: string]: any; // integration_meta.
3353
+ populatedKeys?: PopulatedKeys[];
3354
+ };
3355
+ export interface Result extends DefaultPaginationResult {
3356
+ data: PaymentSchemaWithPopulatedKeys[];
3357
+ absolute_total: number;
3358
+ page_total: number;
3359
+ }
3360
+ }
3361
+
3362
+ export namespace Get {
3363
+ export type ID = string;
3364
+ export interface Params {
3365
+ withPrintDetails?: boolean;
3366
+ populatedKeys?: PopulatedKeys[];
3367
+ }
3368
+ export type Result = PaymentSchemaWithPopulatedKeys & {
3369
+ custom_status: CustomStatus.CustomStatusSchema;
3370
+ };
3371
+ }
3372
+
3373
+ export namespace Create {
3374
+ export type Body = CreateBody;
3375
+ export type Result = PaymentSchema;
3376
+ }
3377
+
3378
+ export namespace Update {
3379
+ export type ID = string;
3380
+ export type Body = UpdateBody;
3381
+ export type Result = PaymentSchema;
3382
+ }
3383
+ }
3384
+
3385
+ export namespace Cycle {
3386
+ type CycleStatus = "pending" | "approved" | "processing" | "rejected";
3387
+ export interface Schema {
3388
+ _id: string;
3389
+ document_type: "proforma" | "transfer";
3390
+ document_id: string;
3391
+ status: CycleStatus;
3392
+ node?: AdminCreator | RepCreator | ClientCreator;
3393
+ creator?: AdminCreator | RepCreator | ClientCreator;
3394
+ current_nodes: {
3395
+ admin: string;
3396
+ admin_name: string;
3397
+ }[];
3398
+ stage?: number;
3399
+ stageName?: string;
3400
+ company_namespace: string[];
3401
+ note?: string;
3402
+ serial_number: SerialNumber;
3403
+ version: number;
3404
+ history: {
3405
+ _id: string;
3406
+ status: CycleStatus;
3407
+ stage: number;
3408
+ stageName: string;
3409
+ node: AdminCreator | RepCreator | ClientCreator;
3410
+ creator: AdminCreator | RepCreator | ClientCreator;
3411
+ note: string;
3412
+ serial_number: SerialNumber;
3413
+ version?: number;
3414
+ createdAt: string;
3415
+ updatedAt: string;
3416
+ __v: number;
3417
+ }[];
3418
+ createdAt: string;
3419
+ updatedAt: string;
3420
+ __v: number;
3421
+ }
3422
+ }
3423
+
3424
+ export namespace Transfer {
3425
+ interface VariantTransfer {
3426
+ variant_id: string;
3427
+ variant_name?: string;
3428
+ product_id?: string;
3429
+ product_name?: string;
3430
+ qty: number;
3431
+ measure_unit_id?: string;
3432
+ measure_unit_name?: string;
3433
+ measure_unit_qty?: number;
3434
+ measure_unit_factor?: number;
3435
+ }
3436
+ interface Schema {
3437
+ _id: string;
3438
+ serial_number: SerialNumber;
3439
+ time: number;
3440
+ creator: AdminCreator | RepCreator;
3441
+ type: TransferType;
3442
+ from: string;
3443
+ to: string;
3444
+ status: TransferStatus;
3445
+ variants: VariantTransfer[];
3446
+ items_count?: number;
3447
+ total_items_base_unit_qty?: number;
3448
+ teams?: string[];
3449
+ custom_status?: string;
3450
+ sync_id: string;
3451
+ integration_meta?: { [key: string]: any };
3452
+ company_namespace: string[];
3453
+ createdAt: string;
3454
+ updatedAt: string;
3455
+ __v: number;
3456
+ }
3457
+ interface CreateBody {
3458
+ serial_number?: SerialNumber;
3459
+ time: number;
3460
+ type?: TransferType;
3461
+ from: string;
3462
+ to: string;
3463
+ variants: {
3464
+ variant_id: string;
3465
+ variant_name?: string;
3466
+ product_id?: string;
3467
+ product_name?: string;
3468
+ qty: number;
3469
+ measureunit?: {
3470
+ _id: string;
3471
+ name: string;
3472
+ factor: number;
3473
+ [key: string]: any;
3474
+ };
3475
+ }[];
3476
+ custom_status?: string;
3477
+ sync_id: string;
3478
+ integration_meta?: { [key: string]: any };
3479
+ }
3480
+ type UpdateBody =
3481
+ | {
3482
+ _id?: string;
3483
+ serial_number?: SerialNumber;
3484
+ time?: number;
3485
+ creator?: AdminCreator | RepCreator;
3486
+ type?: TransferType;
3487
+ from?: string;
3488
+ to?: string;
3489
+ status?: "pending" | "approved" | "processing" | "rejected";
3490
+ variants?: (
3491
+ | VariantTransfer
3492
+ | {
3493
+ variant_id: string;
3494
+ variant_name?: string;
3495
+ product_id?: string;
3496
+ product_name?: string;
3497
+ qty: number;
3498
+ measureunit?: {
3499
+ _id: string;
3500
+ name: string;
3501
+ factor: number;
3502
+ [key: string]: any;
3503
+ };
3504
+ }
3505
+ )[];
3506
+ items_count?: number;
3507
+ total_items_base_unit_qty?: number;
3508
+ teams?: string[];
3509
+ custom_status?: string;
3510
+ sync_id?: string;
3511
+ integration_meta?: { [key: string]: any };
3512
+ company_namespace?: string[];
3513
+ createdAt?: string;
3514
+ updatedAt?: string;
3515
+ __v?: number;
3516
+ }
3517
+ | {
3518
+ integration_meta?: { [key: string]: any };
3519
+ };
3520
+
3521
+ type FindResult = Schema & {
3522
+ custom_status?: string | CustomStatus.CustomStatusSchema;
3523
+ from: Warehouse.WarehouseSchema;
3524
+ to: Warehouse.WarehouseSchema;
3525
+ variants: {
3526
+ _id: string;
3527
+ variant_id: string;
3528
+ product_id: string;
3529
+ variant_name: string;
3530
+ product_name: string;
3531
+ qty: number;
3532
+ measure_unit_id?: string;
3533
+ measure_unit_name?: string;
3534
+ measure_unit_qty?: number;
3535
+ measure_unit_factor?: number;
3536
+ UpdatedAt: string;
3537
+ }[];
3538
+ };
3539
+ type GetResult = FindResult & {
3540
+ custom_status: CustomStatus.CustomStatusSchema & {
3541
+ variants: {
3542
+ _id: string;
3543
+ variant_id: string;
3544
+ product_id: string;
3545
+ variant_name: string;
3546
+ product_name: string;
3547
+ qty: number;
3548
+ measure_unit_id?: string;
3549
+ measure_unit_name?: string;
3550
+ measure_unit_qty?: number;
3551
+ measure_unit_factor?: number;
3552
+ UpdatedAt: string;
3553
+ qty_from_before?: number;
3554
+ qty_from_after?: number;
3555
+ qty_to_before?: number;
3556
+ qty_to_after?: number;
3557
+ }[];
3558
+ };
3559
+ };
3560
+ type TransferType = "load" | "unload";
3561
+ type PopulatedKeys = "custom_status";
3562
+ type TransferStatus =
3563
+ | "pending"
3564
+ | "approved"
3565
+ | "processing"
3566
+ | "rejected"
3567
+ | "processed";
3568
+ export namespace Find {
3569
+ export type Params = DefaultPaginationQueryParams & {
3570
+ _id?: string[] | string;
3571
+ "creator._id"?: string[] | string;
3572
+ "creator.name"?: string[] | string;
3573
+ "creator.type"?: string[] | string;
3574
+ type?: TransferType[] | TransferType;
3575
+ to?: string[] | string;
3576
+ from?: string[] | string;
3577
+ from_createdAt?: number;
3578
+ to_createdAt?: number;
3579
+ status?: TransferStatus | TransferStatus[];
3580
+ custom_status?: string[] | string;
3581
+ creator?: string[] | string;
3582
+ nodeCycles?: string[] | string;
3583
+ populatedKeys?: PopulatedKeys[];
3584
+ [key: string]: any; // integration_meta.
3585
+ };
3586
+ export interface Result extends DefaultPaginationResult {
3587
+ data: FindResult[];
3588
+ }
3589
+ }
3590
+
3591
+ export namespace Get {
3592
+ export type ID = string;
3593
+ export interface Params {
3594
+ populatedKeys?: PopulatedKeys[];
3595
+ withCycle?: boolean;
3596
+ }
3597
+ export type Result =
3598
+ | GetResult
3599
+ | {
3600
+ transfer: GetResult & {
3601
+ can_edit: boolean;
3602
+ current_nodes: string[];
3603
+ };
3604
+ cycle: Cycle.Schema;
3605
+ };
3606
+ }
3607
+
3608
+ export namespace Create {
3609
+ export type Body = CreateBody;
3610
+ export type Result = Schema;
3611
+ }
3612
+
3613
+ export namespace Update {
3614
+ export type ID = string;
3615
+ export type Body = UpdateBody;
3616
+ export type Result = Schema;
3617
+ }
3618
+ }
3619
+
3620
+ export namespace AdjustAccount {
3621
+ interface VariantOfAdjustAccount {
3622
+ variant: string;
3623
+ variant_name?: string;
3624
+ product_id?: string;
3625
+ product_name?: string;
3626
+ qty: number;
3627
+ }
3628
+ interface Schema {
3629
+ _id: string;
3630
+ serial_number: SerialNumber;
3631
+ time: number;
3632
+ creator: AdminCreator | RepCreator;
3633
+ from: string;
3634
+ to: string;
3635
+ variants: VariantOfAdjustAccount[];
3636
+ teams?: string[];
3637
+ sync_id: string;
3638
+ company_namespace: string[];
3639
+ createdAt: string;
3640
+ updatedAt: string;
3641
+ __v: number;
3642
+ }
3643
+ interface CreateBody {
3644
+ serial_number?: SerialNumber;
3645
+ time: number;
3646
+ creator?: AdminCreator | RepCreator;
3647
+ to: string;
3648
+ variants: VariantOfAdjustAccount[];
3649
+ teams?: string[];
3650
+ sync_id: string;
3651
+ company_namespace?: string[];
3652
+ }
3653
+
3654
+ type FindResult = Schema & {
3655
+ from: string | Warehouse.WarehouseSchema;
3656
+ to: string | Warehouse.WarehouseSchema;
3657
+ variants: (VariantOfAdjustAccount & {
3658
+ variant:
3659
+ | string
3660
+ | {
3661
+ _id: string;
3662
+ name: string;
3663
+ product: {
3664
+ _id: string;
3665
+ name: string;
3666
+ };
3667
+ };
3668
+ })[];
3669
+ };
3670
+ type GetResult = Schema & {
3671
+ from: string | Warehouse.WarehouseSchema;
3672
+ to: string | Warehouse.WarehouseSchema;
3673
+ variants: (VariantOfAdjustAccount & {
3674
+ variant: {
3675
+ _id: string;
3676
+ name: string;
3677
+ product: {
3678
+ _id: string;
3679
+ name: string;
3680
+ };
3681
+ };
3682
+ })[];
3683
+ };
3684
+
3685
+ type PopulatedKeys = "warehouse" | "variant";
3686
+ export namespace Find {
3687
+ export type Params = DefaultPaginationQueryParams & {
3688
+ _id?: string[] | string;
3689
+ "creator._id"?: string[] | string;
3690
+ "creator.name"?: string[] | string;
3691
+ "creator.type"?: string[] | string;
3692
+ to?: string[] | string;
3693
+ from?: string[] | string;
3694
+ from_createdAt?: number;
3695
+ to_createdAt?: number;
3696
+ creator?: string[] | string;
3697
+ populatedKeys?: PopulatedKeys[];
3698
+ };
3699
+ export interface Result extends DefaultPaginationResult {
3700
+ data: FindResult[];
3701
+ }
3702
+ }
3703
+
3704
+ export namespace Get {
3705
+ export type ID = string;
3706
+ export interface Params {
3707
+ populatedKeys?: PopulatedKeys[];
3708
+ }
3709
+ export type Result =
3710
+ | GetResult
3711
+ | {
3712
+ transfer: GetResult & {
3713
+ can_edit: boolean;
3714
+ current_nodes: string[];
3715
+ };
3716
+ cycle: Cycle.Schema;
3717
+ };
3718
+ }
3719
+
3720
+ export namespace Create {
3721
+ export type Body = CreateBody;
3722
+ export type Result = Schema;
3723
+ }
3724
+ }
3725
+
3726
+ export namespace Inventory {
3727
+ export interface InventorySchema {
3728
+ _id: string;
3729
+ warehouse_id: string;
3730
+ warehouse_name: string;
3731
+ variant_id: string;
3732
+ variant_name: string;
3733
+ product_id: string;
3734
+ product_name: string;
3735
+ listed_price: number;
3736
+ qty: number;
3737
+ UpdatedAt: string;
3738
+ }
3739
+
3740
+ export namespace Find {
3741
+ export type Params = DefaultPaginationQueryParams & {
3742
+ warehouse_id?: string[] | string;
3743
+ variant_id?: string[] | string;
3744
+ rep?: string[] | string;
3745
+ qty?: number[] | number;
3746
+ from_updatedAt?: number;
3747
+ };
3748
+ export interface Result extends DefaultPaginationResult {
3749
+ data: InventorySchema[];
3750
+ }
3751
+ }
3752
+ }
3753
+
3754
+ export namespace ActionLogs {
3755
+ export type Status = "success" | "fail" | "processing";
3756
+ export type Detail = {
3757
+ timestamp: number;
3758
+ content: string;
3759
+ meta?: { [key: string]: any };
3760
+ };
3761
+ export interface Schema {
3762
+ _id: string;
3763
+ available_app_name: string;
3764
+ available_app_id: string;
3765
+ app_id: string;
3766
+ sync_id: string;
3767
+ action: string;
3768
+ status: Status;
3769
+ error?: { [key: string]: any };
3770
+ start_time: number;
3771
+ end_time?: number;
3772
+ total_time?: number;
3773
+ company_namespace: string[];
3774
+ body?: { [key: string]: any };
3775
+ meta?: { [key: string]: any };
3776
+ message: string;
3777
+ details: Detail[];
3778
+ createdAt: string;
3779
+ updatedAt: string;
3780
+ __v: number;
3781
+ }
3782
+
3783
+ interface Data {
3784
+ available_app_name: string;
3785
+ available_app_id: string;
3786
+ app_id: string;
3787
+ sync_id?: string;
3788
+ action: string;
3789
+ status: Status;
3790
+ error?: { [key: string]: any };
3791
+ start_time: number;
3792
+ end_time?: number;
3793
+ total_time?: number;
3794
+ company_namespace?: string[];
3795
+ body?: { [key: string]: any };
3796
+ meta?: { [key: string]: any };
3797
+ message: string;
3798
+ details: Detail[];
3799
+ }
3800
+
3801
+ export namespace Find {
3802
+ export type Params = DefaultPaginationQueryParams & {
3803
+ _id?: string[] | string;
3804
+ available_app_name?: string[] | string;
3805
+ available_app_id?: string[] | string;
3806
+ app_id?: string[] | string;
3807
+ action?: string[] | string;
3808
+ status?: Status[] | Status;
3809
+ sync_id?: string[] | string;
3810
+ disabled?: boolean;
3811
+ start_time?: number;
3812
+ end_time?: number;
3813
+ total_time?: number;
3814
+ };
3815
+ export interface Result extends DefaultPaginationResult {
3816
+ data: Schema[];
3817
+ }
3818
+ }
3819
+
3820
+ export namespace Get {
3821
+ export type ID = string;
3822
+ export interface Params {
3823
+ available_app_name?: string[] | string;
3824
+ available_app_id?: string[] | string;
3825
+ app_id?: string[] | string;
3826
+ action?: string[] | string;
3827
+ status?: Status[] | Status;
3828
+ sync_id?: string[] | string;
3829
+ disabled?: boolean;
3830
+ start_time?: number;
3831
+ end_time?: number;
3832
+ total_time?: number;
3833
+ }
3834
+ export type Result = Schema;
3835
+ }
3836
+
3837
+ export namespace Create {
3838
+ export type Body = Data;
3839
+ export type Result = Schema;
3840
+ }
3841
+
3842
+ export namespace Update {
3843
+ export type ID = string;
3844
+ export interface Body extends Data {
3845
+ _id?: string;
3846
+ sync_id: string;
3847
+ createdAt?: string;
3848
+ updatedAt?: string;
3849
+ __v?: number;
3850
+ }
3851
+ export type Result = Schema;
3852
+ }
3853
+ }
3854
+
3855
+ export namespace CommandLog {
3856
+ export type Status =
3857
+ | "success"
3858
+ | "fail"
3859
+ | "processing"
3860
+ | "queued"
3861
+ | "received"
3862
+ | "skipped";
3863
+ export type Detail = {
3864
+ timestamp: number;
3865
+ content: string;
3866
+ meta?: { [key: string]: any };
3867
+ };
3868
+ export interface Schema {
3869
+ _id: string;
3870
+ command: string;
3871
+ available_app_name: string;
3872
+ available_app_id: string;
3873
+ app_id: string;
3874
+ status: Status;
3875
+ error?: { [key: string]: any };
3876
+ start_time: number;
3877
+ end_time?: number;
3878
+ total_time?: number;
3879
+ company_namespace: string[];
3880
+ body?: { [key: string]: any };
3881
+ meta?: { [key: string]: any };
3882
+ message: string;
3883
+ details: Detail[];
3884
+ sync_id: string;
3885
+ queuedAt?: Date;
3886
+ failedAt?: Date;
3887
+ succeededAt?: Date;
3888
+ skippedAt?: Date;
3889
+ receivedAt?: Date;
3890
+ processedAt?: Date;
3891
+ onGoing?: boolean;
3892
+ retries?: number;
3893
+ trigger?: string;
3894
+ createdAt: string;
3895
+ updatedAt: string;
3896
+ __v: number;
3897
+ }
3898
+
3899
+ interface Data {
3900
+ command: string;
3901
+ available_app_name: string;
3902
+ available_app_id: string;
3903
+ app_id: string;
3904
+ status: Status;
3905
+ error?: { [key: string]: any };
3906
+ start_time: number;
3907
+ end_time?: number;
3908
+ total_time?: number;
3909
+ company_namespace: string[];
3910
+ body?: { [key: string]: any };
3911
+ meta?: { [key: string]: any };
3912
+ message: string;
3913
+ details: Detail[];
3914
+ sync_id?: string;
3915
+ queuedAt?: Date;
3916
+ failedAt?: Date;
3917
+ succeededAt?: Date;
3918
+ skippedAt?: Date;
3919
+ receivedAt?: Date;
3920
+ processedAt?: Date;
3921
+ onGoing?: boolean;
3922
+ retries?: number;
3923
+ trigger?: string;
3924
+ }
3925
+
3926
+ export namespace Find {
3927
+ export type Params = DefaultPaginationQueryParams & {
3928
+ _id?: string[] | string;
3929
+ available_app_name?: string[] | string;
3930
+ available_app_id?: string[] | string;
3931
+ app_id?: string[] | string;
3932
+ command?: string[] | string;
3933
+ status?: Status[] | Status;
3934
+ sync_id?: string[] | string;
3935
+ disabled?: boolean;
3936
+ start_time?: number;
3937
+ end_time?: number;
3938
+ total_time?: number;
3939
+ };
3940
+ export interface Result extends DefaultPaginationResult {
3941
+ data: Schema[];
3942
+ }
3943
+ }
3944
+
3945
+ export namespace Get {
3946
+ export type ID = string;
3947
+ export interface Params {
3948
+ available_app_name?: string[] | string;
3949
+ available_app_id?: string[] | string;
3950
+ app_id?: string[] | string;
3951
+ command?: string[] | string;
3952
+ status?: Status[] | Status;
3953
+ sync_id?: string[] | string;
3954
+ disabled?: boolean;
3955
+ start_time?: number;
3956
+ end_time?: number;
3957
+ total_time?: number;
3958
+ }
3959
+ export type Result = Schema;
3960
+ }
3961
+
3962
+ export namespace Create {
3963
+ export type Body = Data;
3964
+ export type Result = Schema;
3965
+ }
3966
+
3967
+ export namespace Update {
3968
+ export type ID = string;
3969
+ export interface Body extends Data {
3970
+ _id?: string;
3971
+ sync_id: string;
3972
+ createdAt?: string;
3973
+ updatedAt?: string;
3974
+ __v?: number;
3975
+ }
3976
+ export type Result = Schema;
3977
+ }
3978
+ }
3979
+
3980
+ export namespace App {
3981
+ export interface Schema {
3982
+ _id: string;
3983
+ name: string;
3984
+ disabled?: boolean;
3985
+ available_app: string;
3986
+ formData: any;
3987
+ company_namespace: string[];
3988
+ createdAt: string;
3989
+ updatedAt: string;
3990
+ __v: number;
3991
+ }
3992
+ export interface Schema_with_populated_AvailableApp {
3993
+ _id: string;
3994
+ name: string;
3995
+ disabled?: boolean;
3996
+ available_app: AvailableApp;
3997
+ formData: any;
3998
+ company_namespace: string[];
3999
+ createdAt: string;
4000
+ updatedAt: string;
4001
+ __v: number;
4002
+ }
4003
+ }
4004
+
4005
+ export interface AvailableApp {
4006
+ _id: StringId;
4007
+ name: string;
4008
+ disabled: boolean;
4009
+ JSONSchema: any;
4010
+ UISchema: any;
4011
+ app_settings: { repo: string; serviceEndPoint: string; meta: {} };
4012
+ app_category: string;
4013
+ }
4014
+ }
4015
+
4016
+ export type StringId = string;
4017
+ export type NameSpaces = string[];