@voyantjs/crm 0.19.0 → 0.21.0
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.
- package/dist/routes/accounts.d.ts +138 -0
- package/dist/routes/accounts.d.ts.map +1 -1
- package/dist/routes/accounts.js +25 -1
- package/dist/routes/index.d.ts +138 -0
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/schema-accounts.d.ts +237 -0
- package/dist/schema-accounts.d.ts.map +1 -1
- package/dist/schema-accounts.js +34 -1
- package/dist/service/accounts-organizations.d.ts +4 -0
- package/dist/service/accounts-organizations.d.ts.map +1 -1
- package/dist/service/accounts-people.d.ts +399 -0
- package/dist/service/accounts-people.d.ts.map +1 -1
- package/dist/service/accounts-people.js +58 -1
- package/dist/service/accounts-shared.d.ts +2 -0
- package/dist/service/accounts-shared.d.ts.map +1 -1
- package/dist/service/accounts-shared.js +2 -0
- package/dist/service/accounts.d.ts +402 -0
- package/dist/service/accounts.d.ts.map +1 -1
- package/dist/service/index.d.ts +402 -0
- package/dist/service/index.d.ts.map +1 -1
- package/dist/validation.d.ts +60 -0
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +22 -0
- package/package.json +5 -5
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
2
|
+
import type { InsertPersonPaymentMethodInput, UpdatePersonPaymentMethodInput } from "../validation.js";
|
|
2
3
|
import { type CommunicationListQuery, type CreateAddressInput, type CreateCommunicationLogInput, type CreateContactPointInput, type CreateOrganizationNoteInput, type CreatePersonInput, type CreatePersonNoteInput, type CreateSegmentInput, type PersonListQuery, type UpdateAddressInput, type UpdateContactPointInput, type UpdatePersonInput } from "./accounts-shared.js";
|
|
3
4
|
export declare const peopleAccountsService: {
|
|
4
5
|
listPeople(db: PostgresJsDatabase, query: PersonListQuery): Promise<{
|
|
@@ -6,7 +7,9 @@ export declare const peopleAccountsService: {
|
|
|
6
7
|
id: string;
|
|
7
8
|
organizationId: string | null;
|
|
8
9
|
firstName: string;
|
|
10
|
+
middleName: string | null;
|
|
9
11
|
lastName: string;
|
|
12
|
+
gender: string | null;
|
|
10
13
|
jobTitle: string | null;
|
|
11
14
|
relation: "partner" | "supplier" | "other" | "client" | null;
|
|
12
15
|
preferredLanguage: string | null;
|
|
@@ -30,7 +33,9 @@ export declare const peopleAccountsService: {
|
|
|
30
33
|
id: string;
|
|
31
34
|
organizationId: string | null;
|
|
32
35
|
firstName: string;
|
|
36
|
+
middleName: string | null;
|
|
33
37
|
lastName: string;
|
|
38
|
+
gender: string | null;
|
|
34
39
|
jobTitle: string | null;
|
|
35
40
|
relation: "partner" | "supplier" | "other" | "client" | null;
|
|
36
41
|
preferredLanguage: string | null;
|
|
@@ -50,7 +55,9 @@ export declare const peopleAccountsService: {
|
|
|
50
55
|
id: string;
|
|
51
56
|
organizationId: string | null;
|
|
52
57
|
firstName: string;
|
|
58
|
+
middleName: string | null;
|
|
53
59
|
lastName: string;
|
|
60
|
+
gender: string | null;
|
|
54
61
|
jobTitle: string | null;
|
|
55
62
|
relation: "partner" | "supplier" | "other" | "client" | null;
|
|
56
63
|
preferredLanguage: string | null;
|
|
@@ -70,7 +77,9 @@ export declare const peopleAccountsService: {
|
|
|
70
77
|
id: string;
|
|
71
78
|
organizationId: string | null;
|
|
72
79
|
firstName: string;
|
|
80
|
+
middleName: string | null;
|
|
73
81
|
lastName: string;
|
|
82
|
+
gender: string | null;
|
|
74
83
|
jobTitle: string | null;
|
|
75
84
|
relation: "partner" | "supplier" | "other" | "client" | null;
|
|
76
85
|
preferredLanguage: string | null;
|
|
@@ -586,6 +595,396 @@ export declare const peopleAccountsService: {
|
|
|
586
595
|
authorId: string;
|
|
587
596
|
content: string;
|
|
588
597
|
} | null>;
|
|
598
|
+
listPersonPaymentMethods(db: PostgresJsDatabase, personId: string): Omit<import("drizzle-orm/pg-core").PgSelectBase<"person_payment_methods", {
|
|
599
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
600
|
+
name: string;
|
|
601
|
+
tableName: "person_payment_methods";
|
|
602
|
+
dataType: "string";
|
|
603
|
+
columnType: "PgText";
|
|
604
|
+
data: string;
|
|
605
|
+
driverParam: string;
|
|
606
|
+
notNull: true;
|
|
607
|
+
hasDefault: true;
|
|
608
|
+
isPrimaryKey: true;
|
|
609
|
+
isAutoincrement: false;
|
|
610
|
+
hasRuntimeDefault: true;
|
|
611
|
+
enumValues: [string, ...string[]];
|
|
612
|
+
baseColumn: never;
|
|
613
|
+
identity: undefined;
|
|
614
|
+
generated: undefined;
|
|
615
|
+
}, {}, {}>;
|
|
616
|
+
personId: import("drizzle-orm/pg-core").PgColumn<{
|
|
617
|
+
name: string;
|
|
618
|
+
tableName: "person_payment_methods";
|
|
619
|
+
dataType: "string";
|
|
620
|
+
columnType: "PgText";
|
|
621
|
+
data: string;
|
|
622
|
+
driverParam: string;
|
|
623
|
+
notNull: true;
|
|
624
|
+
hasDefault: false;
|
|
625
|
+
isPrimaryKey: false;
|
|
626
|
+
isAutoincrement: false;
|
|
627
|
+
hasRuntimeDefault: false;
|
|
628
|
+
enumValues: [string, ...string[]];
|
|
629
|
+
baseColumn: never;
|
|
630
|
+
identity: undefined;
|
|
631
|
+
generated: undefined;
|
|
632
|
+
}, {}, {}>;
|
|
633
|
+
brand: import("drizzle-orm/pg-core").PgColumn<{
|
|
634
|
+
name: "brand";
|
|
635
|
+
tableName: "person_payment_methods";
|
|
636
|
+
dataType: "string";
|
|
637
|
+
columnType: "PgText";
|
|
638
|
+
data: string;
|
|
639
|
+
driverParam: string;
|
|
640
|
+
notNull: true;
|
|
641
|
+
hasDefault: false;
|
|
642
|
+
isPrimaryKey: false;
|
|
643
|
+
isAutoincrement: false;
|
|
644
|
+
hasRuntimeDefault: false;
|
|
645
|
+
enumValues: [string, ...string[]];
|
|
646
|
+
baseColumn: never;
|
|
647
|
+
identity: undefined;
|
|
648
|
+
generated: undefined;
|
|
649
|
+
}, {}, {}>;
|
|
650
|
+
last4: import("drizzle-orm/pg-core").PgColumn<{
|
|
651
|
+
name: "last4";
|
|
652
|
+
tableName: "person_payment_methods";
|
|
653
|
+
dataType: "string";
|
|
654
|
+
columnType: "PgText";
|
|
655
|
+
data: string;
|
|
656
|
+
driverParam: string;
|
|
657
|
+
notNull: false;
|
|
658
|
+
hasDefault: false;
|
|
659
|
+
isPrimaryKey: false;
|
|
660
|
+
isAutoincrement: false;
|
|
661
|
+
hasRuntimeDefault: false;
|
|
662
|
+
enumValues: [string, ...string[]];
|
|
663
|
+
baseColumn: never;
|
|
664
|
+
identity: undefined;
|
|
665
|
+
generated: undefined;
|
|
666
|
+
}, {}, {}>;
|
|
667
|
+
holderName: import("drizzle-orm/pg-core").PgColumn<{
|
|
668
|
+
name: "holder_name";
|
|
669
|
+
tableName: "person_payment_methods";
|
|
670
|
+
dataType: "string";
|
|
671
|
+
columnType: "PgText";
|
|
672
|
+
data: string;
|
|
673
|
+
driverParam: string;
|
|
674
|
+
notNull: false;
|
|
675
|
+
hasDefault: false;
|
|
676
|
+
isPrimaryKey: false;
|
|
677
|
+
isAutoincrement: false;
|
|
678
|
+
hasRuntimeDefault: false;
|
|
679
|
+
enumValues: [string, ...string[]];
|
|
680
|
+
baseColumn: never;
|
|
681
|
+
identity: undefined;
|
|
682
|
+
generated: undefined;
|
|
683
|
+
}, {}, {}>;
|
|
684
|
+
expMonth: import("drizzle-orm/pg-core").PgColumn<{
|
|
685
|
+
name: "exp_month";
|
|
686
|
+
tableName: "person_payment_methods";
|
|
687
|
+
dataType: "number";
|
|
688
|
+
columnType: "PgInteger";
|
|
689
|
+
data: number;
|
|
690
|
+
driverParam: string | number;
|
|
691
|
+
notNull: false;
|
|
692
|
+
hasDefault: false;
|
|
693
|
+
isPrimaryKey: false;
|
|
694
|
+
isAutoincrement: false;
|
|
695
|
+
hasRuntimeDefault: false;
|
|
696
|
+
enumValues: undefined;
|
|
697
|
+
baseColumn: never;
|
|
698
|
+
identity: undefined;
|
|
699
|
+
generated: undefined;
|
|
700
|
+
}, {}, {}>;
|
|
701
|
+
expYear: import("drizzle-orm/pg-core").PgColumn<{
|
|
702
|
+
name: "exp_year";
|
|
703
|
+
tableName: "person_payment_methods";
|
|
704
|
+
dataType: "number";
|
|
705
|
+
columnType: "PgInteger";
|
|
706
|
+
data: number;
|
|
707
|
+
driverParam: string | number;
|
|
708
|
+
notNull: false;
|
|
709
|
+
hasDefault: false;
|
|
710
|
+
isPrimaryKey: false;
|
|
711
|
+
isAutoincrement: false;
|
|
712
|
+
hasRuntimeDefault: false;
|
|
713
|
+
enumValues: undefined;
|
|
714
|
+
baseColumn: never;
|
|
715
|
+
identity: undefined;
|
|
716
|
+
generated: undefined;
|
|
717
|
+
}, {}, {}>;
|
|
718
|
+
processorToken: import("drizzle-orm/pg-core").PgColumn<{
|
|
719
|
+
name: "processor_token";
|
|
720
|
+
tableName: "person_payment_methods";
|
|
721
|
+
dataType: "string";
|
|
722
|
+
columnType: "PgText";
|
|
723
|
+
data: string;
|
|
724
|
+
driverParam: string;
|
|
725
|
+
notNull: true;
|
|
726
|
+
hasDefault: false;
|
|
727
|
+
isPrimaryKey: false;
|
|
728
|
+
isAutoincrement: false;
|
|
729
|
+
hasRuntimeDefault: false;
|
|
730
|
+
enumValues: [string, ...string[]];
|
|
731
|
+
baseColumn: never;
|
|
732
|
+
identity: undefined;
|
|
733
|
+
generated: undefined;
|
|
734
|
+
}, {}, {}>;
|
|
735
|
+
isDefault: import("drizzle-orm/pg-core").PgColumn<{
|
|
736
|
+
name: "is_default";
|
|
737
|
+
tableName: "person_payment_methods";
|
|
738
|
+
dataType: "boolean";
|
|
739
|
+
columnType: "PgBoolean";
|
|
740
|
+
data: boolean;
|
|
741
|
+
driverParam: boolean;
|
|
742
|
+
notNull: true;
|
|
743
|
+
hasDefault: true;
|
|
744
|
+
isPrimaryKey: false;
|
|
745
|
+
isAutoincrement: false;
|
|
746
|
+
hasRuntimeDefault: false;
|
|
747
|
+
enumValues: undefined;
|
|
748
|
+
baseColumn: never;
|
|
749
|
+
identity: undefined;
|
|
750
|
+
generated: undefined;
|
|
751
|
+
}, {}, {}>;
|
|
752
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
753
|
+
name: "created_at";
|
|
754
|
+
tableName: "person_payment_methods";
|
|
755
|
+
dataType: "date";
|
|
756
|
+
columnType: "PgTimestamp";
|
|
757
|
+
data: Date;
|
|
758
|
+
driverParam: string;
|
|
759
|
+
notNull: true;
|
|
760
|
+
hasDefault: true;
|
|
761
|
+
isPrimaryKey: false;
|
|
762
|
+
isAutoincrement: false;
|
|
763
|
+
hasRuntimeDefault: false;
|
|
764
|
+
enumValues: undefined;
|
|
765
|
+
baseColumn: never;
|
|
766
|
+
identity: undefined;
|
|
767
|
+
generated: undefined;
|
|
768
|
+
}, {}, {}>;
|
|
769
|
+
}, "single", Record<"person_payment_methods", "not-null">, false, "where" | "orderBy", {
|
|
770
|
+
id: string;
|
|
771
|
+
personId: string;
|
|
772
|
+
brand: string;
|
|
773
|
+
last4: string | null;
|
|
774
|
+
holderName: string | null;
|
|
775
|
+
expMonth: number | null;
|
|
776
|
+
expYear: number | null;
|
|
777
|
+
processorToken: string;
|
|
778
|
+
isDefault: boolean;
|
|
779
|
+
createdAt: Date;
|
|
780
|
+
}[], {
|
|
781
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
782
|
+
name: string;
|
|
783
|
+
tableName: "person_payment_methods";
|
|
784
|
+
dataType: "string";
|
|
785
|
+
columnType: "PgText";
|
|
786
|
+
data: string;
|
|
787
|
+
driverParam: string;
|
|
788
|
+
notNull: true;
|
|
789
|
+
hasDefault: true;
|
|
790
|
+
isPrimaryKey: true;
|
|
791
|
+
isAutoincrement: false;
|
|
792
|
+
hasRuntimeDefault: true;
|
|
793
|
+
enumValues: [string, ...string[]];
|
|
794
|
+
baseColumn: never;
|
|
795
|
+
identity: undefined;
|
|
796
|
+
generated: undefined;
|
|
797
|
+
}, {}, {}>;
|
|
798
|
+
personId: import("drizzle-orm/pg-core").PgColumn<{
|
|
799
|
+
name: string;
|
|
800
|
+
tableName: "person_payment_methods";
|
|
801
|
+
dataType: "string";
|
|
802
|
+
columnType: "PgText";
|
|
803
|
+
data: string;
|
|
804
|
+
driverParam: string;
|
|
805
|
+
notNull: true;
|
|
806
|
+
hasDefault: false;
|
|
807
|
+
isPrimaryKey: false;
|
|
808
|
+
isAutoincrement: false;
|
|
809
|
+
hasRuntimeDefault: false;
|
|
810
|
+
enumValues: [string, ...string[]];
|
|
811
|
+
baseColumn: never;
|
|
812
|
+
identity: undefined;
|
|
813
|
+
generated: undefined;
|
|
814
|
+
}, {}, {}>;
|
|
815
|
+
brand: import("drizzle-orm/pg-core").PgColumn<{
|
|
816
|
+
name: "brand";
|
|
817
|
+
tableName: "person_payment_methods";
|
|
818
|
+
dataType: "string";
|
|
819
|
+
columnType: "PgText";
|
|
820
|
+
data: string;
|
|
821
|
+
driverParam: string;
|
|
822
|
+
notNull: true;
|
|
823
|
+
hasDefault: false;
|
|
824
|
+
isPrimaryKey: false;
|
|
825
|
+
isAutoincrement: false;
|
|
826
|
+
hasRuntimeDefault: false;
|
|
827
|
+
enumValues: [string, ...string[]];
|
|
828
|
+
baseColumn: never;
|
|
829
|
+
identity: undefined;
|
|
830
|
+
generated: undefined;
|
|
831
|
+
}, {}, {}>;
|
|
832
|
+
last4: import("drizzle-orm/pg-core").PgColumn<{
|
|
833
|
+
name: "last4";
|
|
834
|
+
tableName: "person_payment_methods";
|
|
835
|
+
dataType: "string";
|
|
836
|
+
columnType: "PgText";
|
|
837
|
+
data: string;
|
|
838
|
+
driverParam: string;
|
|
839
|
+
notNull: false;
|
|
840
|
+
hasDefault: false;
|
|
841
|
+
isPrimaryKey: false;
|
|
842
|
+
isAutoincrement: false;
|
|
843
|
+
hasRuntimeDefault: false;
|
|
844
|
+
enumValues: [string, ...string[]];
|
|
845
|
+
baseColumn: never;
|
|
846
|
+
identity: undefined;
|
|
847
|
+
generated: undefined;
|
|
848
|
+
}, {}, {}>;
|
|
849
|
+
holderName: import("drizzle-orm/pg-core").PgColumn<{
|
|
850
|
+
name: "holder_name";
|
|
851
|
+
tableName: "person_payment_methods";
|
|
852
|
+
dataType: "string";
|
|
853
|
+
columnType: "PgText";
|
|
854
|
+
data: string;
|
|
855
|
+
driverParam: string;
|
|
856
|
+
notNull: false;
|
|
857
|
+
hasDefault: false;
|
|
858
|
+
isPrimaryKey: false;
|
|
859
|
+
isAutoincrement: false;
|
|
860
|
+
hasRuntimeDefault: false;
|
|
861
|
+
enumValues: [string, ...string[]];
|
|
862
|
+
baseColumn: never;
|
|
863
|
+
identity: undefined;
|
|
864
|
+
generated: undefined;
|
|
865
|
+
}, {}, {}>;
|
|
866
|
+
expMonth: import("drizzle-orm/pg-core").PgColumn<{
|
|
867
|
+
name: "exp_month";
|
|
868
|
+
tableName: "person_payment_methods";
|
|
869
|
+
dataType: "number";
|
|
870
|
+
columnType: "PgInteger";
|
|
871
|
+
data: number;
|
|
872
|
+
driverParam: string | number;
|
|
873
|
+
notNull: false;
|
|
874
|
+
hasDefault: false;
|
|
875
|
+
isPrimaryKey: false;
|
|
876
|
+
isAutoincrement: false;
|
|
877
|
+
hasRuntimeDefault: false;
|
|
878
|
+
enumValues: undefined;
|
|
879
|
+
baseColumn: never;
|
|
880
|
+
identity: undefined;
|
|
881
|
+
generated: undefined;
|
|
882
|
+
}, {}, {}>;
|
|
883
|
+
expYear: import("drizzle-orm/pg-core").PgColumn<{
|
|
884
|
+
name: "exp_year";
|
|
885
|
+
tableName: "person_payment_methods";
|
|
886
|
+
dataType: "number";
|
|
887
|
+
columnType: "PgInteger";
|
|
888
|
+
data: number;
|
|
889
|
+
driverParam: string | number;
|
|
890
|
+
notNull: false;
|
|
891
|
+
hasDefault: false;
|
|
892
|
+
isPrimaryKey: false;
|
|
893
|
+
isAutoincrement: false;
|
|
894
|
+
hasRuntimeDefault: false;
|
|
895
|
+
enumValues: undefined;
|
|
896
|
+
baseColumn: never;
|
|
897
|
+
identity: undefined;
|
|
898
|
+
generated: undefined;
|
|
899
|
+
}, {}, {}>;
|
|
900
|
+
processorToken: import("drizzle-orm/pg-core").PgColumn<{
|
|
901
|
+
name: "processor_token";
|
|
902
|
+
tableName: "person_payment_methods";
|
|
903
|
+
dataType: "string";
|
|
904
|
+
columnType: "PgText";
|
|
905
|
+
data: string;
|
|
906
|
+
driverParam: string;
|
|
907
|
+
notNull: true;
|
|
908
|
+
hasDefault: false;
|
|
909
|
+
isPrimaryKey: false;
|
|
910
|
+
isAutoincrement: false;
|
|
911
|
+
hasRuntimeDefault: false;
|
|
912
|
+
enumValues: [string, ...string[]];
|
|
913
|
+
baseColumn: never;
|
|
914
|
+
identity: undefined;
|
|
915
|
+
generated: undefined;
|
|
916
|
+
}, {}, {}>;
|
|
917
|
+
isDefault: import("drizzle-orm/pg-core").PgColumn<{
|
|
918
|
+
name: "is_default";
|
|
919
|
+
tableName: "person_payment_methods";
|
|
920
|
+
dataType: "boolean";
|
|
921
|
+
columnType: "PgBoolean";
|
|
922
|
+
data: boolean;
|
|
923
|
+
driverParam: boolean;
|
|
924
|
+
notNull: true;
|
|
925
|
+
hasDefault: true;
|
|
926
|
+
isPrimaryKey: false;
|
|
927
|
+
isAutoincrement: false;
|
|
928
|
+
hasRuntimeDefault: false;
|
|
929
|
+
enumValues: undefined;
|
|
930
|
+
baseColumn: never;
|
|
931
|
+
identity: undefined;
|
|
932
|
+
generated: undefined;
|
|
933
|
+
}, {}, {}>;
|
|
934
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
935
|
+
name: "created_at";
|
|
936
|
+
tableName: "person_payment_methods";
|
|
937
|
+
dataType: "date";
|
|
938
|
+
columnType: "PgTimestamp";
|
|
939
|
+
data: Date;
|
|
940
|
+
driverParam: string;
|
|
941
|
+
notNull: true;
|
|
942
|
+
hasDefault: true;
|
|
943
|
+
isPrimaryKey: false;
|
|
944
|
+
isAutoincrement: false;
|
|
945
|
+
hasRuntimeDefault: false;
|
|
946
|
+
enumValues: undefined;
|
|
947
|
+
baseColumn: never;
|
|
948
|
+
identity: undefined;
|
|
949
|
+
generated: undefined;
|
|
950
|
+
}, {}, {}>;
|
|
951
|
+
}>, "where" | "orderBy">;
|
|
952
|
+
createPersonPaymentMethod(db: PostgresJsDatabase, personId: string, data: InsertPersonPaymentMethodInput): Promise<{
|
|
953
|
+
id: string;
|
|
954
|
+
brand: string;
|
|
955
|
+
createdAt: Date;
|
|
956
|
+
personId: string;
|
|
957
|
+
last4: string | null;
|
|
958
|
+
holderName: string | null;
|
|
959
|
+
expMonth: number | null;
|
|
960
|
+
expYear: number | null;
|
|
961
|
+
processorToken: string;
|
|
962
|
+
isDefault: boolean;
|
|
963
|
+
} | null>;
|
|
964
|
+
updatePersonPaymentMethod(db: PostgresJsDatabase, id: string, data: UpdatePersonPaymentMethodInput): Promise<{
|
|
965
|
+
id: string;
|
|
966
|
+
personId: string;
|
|
967
|
+
brand: string;
|
|
968
|
+
last4: string | null;
|
|
969
|
+
holderName: string | null;
|
|
970
|
+
expMonth: number | null;
|
|
971
|
+
expYear: number | null;
|
|
972
|
+
processorToken: string;
|
|
973
|
+
isDefault: boolean;
|
|
974
|
+
createdAt: Date;
|
|
975
|
+
} | null>;
|
|
976
|
+
deletePersonPaymentMethod(db: PostgresJsDatabase, id: string): Promise<{
|
|
977
|
+
id: string;
|
|
978
|
+
brand: string;
|
|
979
|
+
createdAt: Date;
|
|
980
|
+
personId: string;
|
|
981
|
+
last4: string | null;
|
|
982
|
+
holderName: string | null;
|
|
983
|
+
expMonth: number | null;
|
|
984
|
+
expYear: number | null;
|
|
985
|
+
processorToken: string;
|
|
986
|
+
isDefault: boolean;
|
|
987
|
+
} | null>;
|
|
589
988
|
updateOrganizationNote(db: PostgresJsDatabase, id: string, content: string): Promise<{
|
|
590
989
|
id: string;
|
|
591
990
|
organizationId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-people.d.ts","sourceRoot":"","sources":["../../src/service/accounts-people.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"accounts-people.d.ts","sourceRoot":"","sources":["../../src/service/accounts-people.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAWjE,OAAO,KAAK,EACV,8BAA8B,EAC9B,8BAA8B,EAC/B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAChC,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EAIvB,KAAK,eAAe,EAIpB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAA;AAG7B,eAAO,MAAM,qBAAqB;mBACX,kBAAkB,SAAS,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAsCvC,kBAAkB,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;qBAO/B,kBAAkB,QAAQ,iBAAiB;;;;;;;;;;;;;;;;;;;;;;qBAgB3C,kBAAkB,MAAM,MAAM,QAAQ,iBAAiB;;;;;;;;;;;;;;;;;;;;;;qBAkBvD,kBAAkB,MAAM,MAAM;;;2BAO/C,kBAAkB,cACV,cAAc,GAAG,QAAQ,YAC3B,MAAM;;;;;;;;;;;;;;4BAUZ,kBAAkB,cACV,cAAc,GAAG,QAAQ,YAC3B,MAAM,QACV,uBAAuB;;;;;;;;;;;;;;4BASD,kBAAkB,MAAM,MAAM,QAAQ,uBAAuB;;;;;;;;;;;;;;4BAI7D,kBAAkB,MAAM,MAAM;;;sBAI1C,kBAAkB,cAAc,cAAc,GAAG,QAAQ,YAAY,MAAM;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAS3D,kBAAkB,YACZ,MAAM,QACV,8BAA8B;;;;;;;;;;;;kCAwBhC,kBAAkB,MAClB,MAAM,QACJ,8BAA8B;;;;;;;;;;;;kCAuBF,kBAAkB,MAAM,MAAM;;;;;;;;;;;;+BAQjC,kBAAkB,MAAM,MAAM,WAAW,MAAM;;;;;;;+BAS/C,kBAAkB,MAAM,MAAM;;;;;;;2BAMzD,kBAAkB,YACZ,MAAM,SACT,sBAAsB;;;;;;;;;;;4BAmBzB,kBAAkB,YACZ,MAAM,QACV,2BAA2B;;;;;;;;;;;qBAwBlB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAIX,kBAAkB,QAAQ,kBAAkB;;;;;;;;sBAK5C,kBAAkB,aAAa,MAAM;;;wBAQnC,kBAAkB;wBAiClB,kBAAkB,WAAW,MAAM;;;;;;;iBAuBtC,MAAM;mBAAS,MAAM;;;;CA4B7C,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { identityService } from "@voyantjs/identity/service";
|
|
2
2
|
import { and, desc, eq, gte, ilike, lte, or, sql } from "drizzle-orm";
|
|
3
|
-
import { communicationLog, organizationNotes, organizations, people, personNotes, segments, } from "../schema.js";
|
|
3
|
+
import { communicationLog, organizationNotes, organizations, people, personNotes, personPaymentMethods, segments, } from "../schema.js";
|
|
4
4
|
import { deletePersonIdentity, hydratePeople, organizationEntityType, personBaseFields, personEntityType, syncPersonIdentity, } from "./accounts-shared.js";
|
|
5
5
|
import { paginate } from "./helpers.js";
|
|
6
6
|
export const peopleAccountsService = {
|
|
@@ -159,6 +159,63 @@ export const peopleAccountsService = {
|
|
|
159
159
|
const [row] = await db.delete(personNotes).where(eq(personNotes.id, id)).returning();
|
|
160
160
|
return row ?? null;
|
|
161
161
|
},
|
|
162
|
+
// ── Payment methods ────────────────────────────────────────────────────
|
|
163
|
+
listPersonPaymentMethods(db, personId) {
|
|
164
|
+
return db
|
|
165
|
+
.select()
|
|
166
|
+
.from(personPaymentMethods)
|
|
167
|
+
.where(eq(personPaymentMethods.personId, personId))
|
|
168
|
+
.orderBy(desc(personPaymentMethods.isDefault), desc(personPaymentMethods.createdAt));
|
|
169
|
+
},
|
|
170
|
+
async createPersonPaymentMethod(db, personId, data) {
|
|
171
|
+
const [existing] = await db
|
|
172
|
+
.select({ id: people.id })
|
|
173
|
+
.from(people)
|
|
174
|
+
.where(eq(people.id, personId))
|
|
175
|
+
.limit(1);
|
|
176
|
+
if (!existing)
|
|
177
|
+
return null;
|
|
178
|
+
if (data.isDefault) {
|
|
179
|
+
// Only one default per person — clear the others first.
|
|
180
|
+
await db
|
|
181
|
+
.update(personPaymentMethods)
|
|
182
|
+
.set({ isDefault: false })
|
|
183
|
+
.where(eq(personPaymentMethods.personId, personId));
|
|
184
|
+
}
|
|
185
|
+
const [row] = await db
|
|
186
|
+
.insert(personPaymentMethods)
|
|
187
|
+
.values({ personId, ...data })
|
|
188
|
+
.returning();
|
|
189
|
+
return row ?? null;
|
|
190
|
+
},
|
|
191
|
+
async updatePersonPaymentMethod(db, id, data) {
|
|
192
|
+
if (data.isDefault) {
|
|
193
|
+
const [target] = await db
|
|
194
|
+
.select({ personId: personPaymentMethods.personId })
|
|
195
|
+
.from(personPaymentMethods)
|
|
196
|
+
.where(eq(personPaymentMethods.id, id))
|
|
197
|
+
.limit(1);
|
|
198
|
+
if (target) {
|
|
199
|
+
await db
|
|
200
|
+
.update(personPaymentMethods)
|
|
201
|
+
.set({ isDefault: false })
|
|
202
|
+
.where(eq(personPaymentMethods.personId, target.personId));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const [row] = await db
|
|
206
|
+
.update(personPaymentMethods)
|
|
207
|
+
.set(data)
|
|
208
|
+
.where(eq(personPaymentMethods.id, id))
|
|
209
|
+
.returning();
|
|
210
|
+
return row ?? null;
|
|
211
|
+
},
|
|
212
|
+
async deletePersonPaymentMethod(db, id) {
|
|
213
|
+
const [row] = await db
|
|
214
|
+
.delete(personPaymentMethods)
|
|
215
|
+
.where(eq(personPaymentMethods.id, id))
|
|
216
|
+
.returning();
|
|
217
|
+
return row ?? null;
|
|
218
|
+
},
|
|
162
219
|
async updateOrganizationNote(db, id, content) {
|
|
163
220
|
const [row] = await db
|
|
164
221
|
.update(organizationNotes)
|
|
@@ -29,7 +29,9 @@ export type PersonHydratedFields = {
|
|
|
29
29
|
export declare function personBaseFields(data: CreatePersonInput | UpdatePersonInput): {
|
|
30
30
|
organizationId: string | null | undefined;
|
|
31
31
|
firstName: string | undefined;
|
|
32
|
+
middleName: string | null | undefined;
|
|
32
33
|
lastName: string | undefined;
|
|
34
|
+
gender: "M" | "F" | "X" | null | undefined;
|
|
33
35
|
jobTitle: string | null | undefined;
|
|
34
36
|
relation: "partner" | "supplier" | "other" | "client" | null | undefined;
|
|
35
37
|
preferredLanguage: string | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-shared.d.ts","sourceRoot":"","sources":["../../src/service/accounts-shared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,+BAA+B,CAAA;AAEtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EACV,4BAA4B,EAC5B,4BAA4B,EA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AW,CAAA;AACxC,eAAO,MAAM,wBAAwB,oBAAoB,CAAA;AAEzD,KAAK,mBAAmB,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC,CAAA;AAEjF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB,CAAA;AAeD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,iBAAiB;;;;;;;;;;;;;;;;;EAmB3E;AA8CD,wBAAsB,gCAAgC,CAAC,EAAE,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,iBAE9F;AAED,wBAAsB,iCAAiC,CACrD,EAAE,EAAE,kBAAkB,EACtB,SAAS,EAAE,MAAM,EAAE,iBAYpB;AAgDD,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,kBAAkB,EACtB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,mBAAmB,iBA4D1B;AAED,wBAAsB,oBAAoB,CAAC,EAAE,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,iBAUlF;AAED,wBAAsB,aAAa,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAC1D,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,CAAC,EAAE,GACR,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAiB1C"}
|
|
@@ -17,7 +17,9 @@ export function personBaseFields(data) {
|
|
|
17
17
|
return {
|
|
18
18
|
organizationId: data.organizationId,
|
|
19
19
|
firstName: data.firstName,
|
|
20
|
+
middleName: data.middleName,
|
|
20
21
|
lastName: data.lastName,
|
|
22
|
+
gender: data.gender,
|
|
21
23
|
jobTitle: data.jobTitle,
|
|
22
24
|
relation: data.relation,
|
|
23
25
|
preferredLanguage: data.preferredLanguage,
|