@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.
@@ -70,6 +70,23 @@ export declare const organizations: import("drizzle-orm/pg-core").PgTableWithCol
70
70
  identity: undefined;
71
71
  generated: undefined;
72
72
  }, {}, {}>;
73
+ vatNumber: import("drizzle-orm/pg-core").PgColumn<{
74
+ name: "vat_number";
75
+ tableName: "organizations";
76
+ dataType: "string";
77
+ columnType: "PgText";
78
+ data: string;
79
+ driverParam: string;
80
+ notNull: false;
81
+ hasDefault: false;
82
+ isPrimaryKey: false;
83
+ isAutoincrement: false;
84
+ hasRuntimeDefault: false;
85
+ enumValues: [string, ...string[]];
86
+ baseColumn: never;
87
+ identity: undefined;
88
+ generated: undefined;
89
+ }, {}, {}>;
73
90
  industry: import("drizzle-orm/pg-core").PgColumn<{
74
91
  name: "industry";
75
92
  tableName: "organizations";
@@ -368,6 +385,23 @@ export declare const people: import("drizzle-orm/pg-core").PgTableWithColumns<{
368
385
  identity: undefined;
369
386
  generated: undefined;
370
387
  }, {}, {}>;
388
+ middleName: import("drizzle-orm/pg-core").PgColumn<{
389
+ name: "middle_name";
390
+ tableName: "people";
391
+ dataType: "string";
392
+ columnType: "PgText";
393
+ data: string;
394
+ driverParam: string;
395
+ notNull: false;
396
+ hasDefault: false;
397
+ isPrimaryKey: false;
398
+ isAutoincrement: false;
399
+ hasRuntimeDefault: false;
400
+ enumValues: [string, ...string[]];
401
+ baseColumn: never;
402
+ identity: undefined;
403
+ generated: undefined;
404
+ }, {}, {}>;
371
405
  lastName: import("drizzle-orm/pg-core").PgColumn<{
372
406
  name: "last_name";
373
407
  tableName: "people";
@@ -385,6 +419,23 @@ export declare const people: import("drizzle-orm/pg-core").PgTableWithColumns<{
385
419
  identity: undefined;
386
420
  generated: undefined;
387
421
  }, {}, {}>;
422
+ gender: import("drizzle-orm/pg-core").PgColumn<{
423
+ name: "gender";
424
+ tableName: "people";
425
+ dataType: "string";
426
+ columnType: "PgText";
427
+ data: string;
428
+ driverParam: string;
429
+ notNull: false;
430
+ hasDefault: false;
431
+ isPrimaryKey: false;
432
+ isAutoincrement: false;
433
+ hasRuntimeDefault: false;
434
+ enumValues: [string, ...string[]];
435
+ baseColumn: never;
436
+ identity: undefined;
437
+ generated: undefined;
438
+ }, {}, {}>;
388
439
  jobTitle: import("drizzle-orm/pg-core").PgColumn<{
389
440
  name: "job_title";
390
441
  tableName: "people";
@@ -814,6 +865,192 @@ export declare const personNotes: import("drizzle-orm/pg-core").PgTableWithColum
814
865
  }>;
815
866
  export type PersonNote = typeof personNotes.$inferSelect;
816
867
  export type NewPersonNote = typeof personNotes.$inferInsert;
868
+ /**
869
+ * Saved payment methods on file for a person. Stores processor-issued
870
+ * tokens (never raw card numbers) so the booking flow can charge the
871
+ * customer without re-entering card details. Cards have last4 + expiry +
872
+ * brand; bank-transfer "methods" carry a brand of "bank_transfer" with
873
+ * last4 / expiry omitted.
874
+ */
875
+ export declare const personPaymentMethods: import("drizzle-orm/pg-core").PgTableWithColumns<{
876
+ name: "person_payment_methods";
877
+ schema: undefined;
878
+ columns: {
879
+ id: import("drizzle-orm/pg-core").PgColumn<{
880
+ name: string;
881
+ tableName: "person_payment_methods";
882
+ dataType: "string";
883
+ columnType: "PgText";
884
+ data: string;
885
+ driverParam: string;
886
+ notNull: true;
887
+ hasDefault: true;
888
+ isPrimaryKey: true;
889
+ isAutoincrement: false;
890
+ hasRuntimeDefault: true;
891
+ enumValues: [string, ...string[]];
892
+ baseColumn: never;
893
+ identity: undefined;
894
+ generated: undefined;
895
+ }, {}, {}>;
896
+ personId: import("drizzle-orm/pg-core").PgColumn<{
897
+ name: string;
898
+ tableName: "person_payment_methods";
899
+ dataType: "string";
900
+ columnType: "PgText";
901
+ data: string;
902
+ driverParam: string;
903
+ notNull: true;
904
+ hasDefault: false;
905
+ isPrimaryKey: false;
906
+ isAutoincrement: false;
907
+ hasRuntimeDefault: false;
908
+ enumValues: [string, ...string[]];
909
+ baseColumn: never;
910
+ identity: undefined;
911
+ generated: undefined;
912
+ }, {}, {}>;
913
+ brand: import("drizzle-orm/pg-core").PgColumn<{
914
+ name: "brand";
915
+ tableName: "person_payment_methods";
916
+ dataType: "string";
917
+ columnType: "PgText";
918
+ data: string;
919
+ driverParam: string;
920
+ notNull: true;
921
+ hasDefault: false;
922
+ isPrimaryKey: false;
923
+ isAutoincrement: false;
924
+ hasRuntimeDefault: false;
925
+ enumValues: [string, ...string[]];
926
+ baseColumn: never;
927
+ identity: undefined;
928
+ generated: undefined;
929
+ }, {}, {}>;
930
+ last4: import("drizzle-orm/pg-core").PgColumn<{
931
+ name: "last4";
932
+ tableName: "person_payment_methods";
933
+ dataType: "string";
934
+ columnType: "PgText";
935
+ data: string;
936
+ driverParam: string;
937
+ notNull: false;
938
+ hasDefault: false;
939
+ isPrimaryKey: false;
940
+ isAutoincrement: false;
941
+ hasRuntimeDefault: false;
942
+ enumValues: [string, ...string[]];
943
+ baseColumn: never;
944
+ identity: undefined;
945
+ generated: undefined;
946
+ }, {}, {}>;
947
+ holderName: import("drizzle-orm/pg-core").PgColumn<{
948
+ name: "holder_name";
949
+ tableName: "person_payment_methods";
950
+ dataType: "string";
951
+ columnType: "PgText";
952
+ data: string;
953
+ driverParam: string;
954
+ notNull: false;
955
+ hasDefault: false;
956
+ isPrimaryKey: false;
957
+ isAutoincrement: false;
958
+ hasRuntimeDefault: false;
959
+ enumValues: [string, ...string[]];
960
+ baseColumn: never;
961
+ identity: undefined;
962
+ generated: undefined;
963
+ }, {}, {}>;
964
+ expMonth: import("drizzle-orm/pg-core").PgColumn<{
965
+ name: "exp_month";
966
+ tableName: "person_payment_methods";
967
+ dataType: "number";
968
+ columnType: "PgInteger";
969
+ data: number;
970
+ driverParam: string | number;
971
+ notNull: false;
972
+ hasDefault: false;
973
+ isPrimaryKey: false;
974
+ isAutoincrement: false;
975
+ hasRuntimeDefault: false;
976
+ enumValues: undefined;
977
+ baseColumn: never;
978
+ identity: undefined;
979
+ generated: undefined;
980
+ }, {}, {}>;
981
+ expYear: import("drizzle-orm/pg-core").PgColumn<{
982
+ name: "exp_year";
983
+ tableName: "person_payment_methods";
984
+ dataType: "number";
985
+ columnType: "PgInteger";
986
+ data: number;
987
+ driverParam: string | number;
988
+ notNull: false;
989
+ hasDefault: false;
990
+ isPrimaryKey: false;
991
+ isAutoincrement: false;
992
+ hasRuntimeDefault: false;
993
+ enumValues: undefined;
994
+ baseColumn: never;
995
+ identity: undefined;
996
+ generated: undefined;
997
+ }, {}, {}>;
998
+ processorToken: import("drizzle-orm/pg-core").PgColumn<{
999
+ name: "processor_token";
1000
+ tableName: "person_payment_methods";
1001
+ dataType: "string";
1002
+ columnType: "PgText";
1003
+ data: string;
1004
+ driverParam: string;
1005
+ notNull: true;
1006
+ hasDefault: false;
1007
+ isPrimaryKey: false;
1008
+ isAutoincrement: false;
1009
+ hasRuntimeDefault: false;
1010
+ enumValues: [string, ...string[]];
1011
+ baseColumn: never;
1012
+ identity: undefined;
1013
+ generated: undefined;
1014
+ }, {}, {}>;
1015
+ isDefault: import("drizzle-orm/pg-core").PgColumn<{
1016
+ name: "is_default";
1017
+ tableName: "person_payment_methods";
1018
+ dataType: "boolean";
1019
+ columnType: "PgBoolean";
1020
+ data: boolean;
1021
+ driverParam: boolean;
1022
+ notNull: true;
1023
+ hasDefault: true;
1024
+ isPrimaryKey: false;
1025
+ isAutoincrement: false;
1026
+ hasRuntimeDefault: false;
1027
+ enumValues: undefined;
1028
+ baseColumn: never;
1029
+ identity: undefined;
1030
+ generated: undefined;
1031
+ }, {}, {}>;
1032
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
1033
+ name: "created_at";
1034
+ tableName: "person_payment_methods";
1035
+ dataType: "date";
1036
+ columnType: "PgTimestamp";
1037
+ data: Date;
1038
+ driverParam: string;
1039
+ notNull: true;
1040
+ hasDefault: true;
1041
+ isPrimaryKey: false;
1042
+ isAutoincrement: false;
1043
+ hasRuntimeDefault: false;
1044
+ enumValues: undefined;
1045
+ baseColumn: never;
1046
+ identity: undefined;
1047
+ generated: undefined;
1048
+ }, {}, {}>;
1049
+ };
1050
+ dialect: "pg";
1051
+ }>;
1052
+ export type PersonPaymentMethod = typeof personPaymentMethods.$inferSelect;
1053
+ export type NewPersonPaymentMethod = typeof personPaymentMethods.$inferInsert;
817
1054
  export declare const organizationNotes: import("drizzle-orm/pg-core").PgTableWithColumns<{
818
1055
  name: "organization_notes";
819
1056
  schema: undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"schema-accounts.d.ts","sourceRoot":"","sources":["../src/schema-accounts.ts"],"names":[],"mappings":"AAmBA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BzB,CAAA;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkClB,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;AAEjE,MAAM,MAAM,YAAY,GAAG,OAAO,aAAa,CAAC,YAAY,CAAA;AAC5D,MAAM,MAAM,eAAe,GAAG,OAAO,aAAa,CAAC,YAAY,CAAA;AAC/D,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,YAAY,CAAA;AAC/C,MAAM,MAAM,SAAS,GAAG,OAAO,MAAM,CAAC,YAAY,CAAA;AAClD,MAAM,MAAM,yBAAyB,GAAG,OAAO,0BAA0B,CAAC,YAAY,CAAA;AACtF,MAAM,MAAM,4BAA4B,GAAG,OAAO,0BAA0B,CAAC,YAAY,CAAA"}
@@ -1,11 +1,13 @@
1
1
  import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
2
- import { date, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
2
+ import { boolean, date, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
3
3
  import { communicationChannelEnum, communicationDirectionEnum, recordStatusEnum, relationTypeEnum, } from "./schema-shared";
4
4
  export const organizations = pgTable("organizations", {
5
5
  id: typeId("organizations"),
6
6
  name: text("name").notNull(),
7
7
  legalName: text("legal_name"),
8
8
  website: text("website"),
9
+ /** Tax / VAT identification number — used for billing + e-invoicing. */
10
+ vatNumber: text("vat_number"),
9
11
  industry: text("industry"),
10
12
  relation: relationTypeEnum("relation"),
11
13
  ownerId: text("owner_id"),
@@ -34,7 +36,10 @@ export const people = pgTable("people", {
34
36
  onDelete: "set null",
35
37
  }),
36
38
  firstName: text("first_name").notNull(),
39
+ middleName: text("middle_name"),
37
40
  lastName: text("last_name").notNull(),
41
+ /** ISO-style "M" / "F" / "X" — used by airline + travel-doc workflows. */
42
+ gender: text("gender"),
38
43
  jobTitle: text("job_title"),
39
44
  relation: relationTypeEnum("relation"),
40
45
  preferredLanguage: text("preferred_language"),
@@ -80,6 +85,34 @@ export const personNotes = pgTable("person_notes", {
80
85
  index("idx_person_notes_person").on(table.personId),
81
86
  index("idx_person_notes_person_created").on(table.personId, table.createdAt),
82
87
  ]);
88
+ /**
89
+ * Saved payment methods on file for a person. Stores processor-issued
90
+ * tokens (never raw card numbers) so the booking flow can charge the
91
+ * customer without re-entering card details. Cards have last4 + expiry +
92
+ * brand; bank-transfer "methods" carry a brand of "bank_transfer" with
93
+ * last4 / expiry omitted.
94
+ */
95
+ export const personPaymentMethods = pgTable("person_payment_methods", {
96
+ id: typeId("person_payment_methods"),
97
+ personId: typeIdRef("person_id")
98
+ .notNull()
99
+ .references(() => people.id, { onDelete: "cascade" }),
100
+ /** "visa" | "mastercard" | "amex" | "revolut" | "bank_transfer" — kept as text to stay open. */
101
+ brand: text("brand").notNull(),
102
+ /** Last four digits — null for non-card methods. */
103
+ last4: text("last4"),
104
+ holderName: text("holder_name"),
105
+ /** 1-12; null for non-card methods. */
106
+ expMonth: integer("exp_month"),
107
+ expYear: integer("exp_year"),
108
+ /** Opaque processor token — used to charge the customer. */
109
+ processorToken: text("processor_token").notNull(),
110
+ isDefault: boolean("is_default").notNull().default(false),
111
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
112
+ }, (table) => [
113
+ index("idx_person_payment_methods_person").on(table.personId),
114
+ index("idx_person_payment_methods_person_default").on(table.personId, table.isDefault),
115
+ ]);
83
116
  export const organizationNotes = pgTable("organization_notes", {
84
117
  id: typeId("organization_notes"),
85
118
  organizationId: typeIdRef("organization_id")
@@ -7,6 +7,7 @@ export declare const organizationAccountsService: {
7
7
  name: string;
8
8
  legalName: string | null;
9
9
  website: string | null;
10
+ vatNumber: string | null;
10
11
  industry: string | null;
11
12
  relation: "partner" | "supplier" | "other" | "client" | null;
12
13
  ownerId: string | null;
@@ -31,6 +32,7 @@ export declare const organizationAccountsService: {
31
32
  name: string;
32
33
  legalName: string | null;
33
34
  website: string | null;
35
+ vatNumber: string | null;
34
36
  industry: string | null;
35
37
  relation: "partner" | "supplier" | "other" | "client" | null;
36
38
  ownerId: string | null;
@@ -57,6 +59,7 @@ export declare const organizationAccountsService: {
57
59
  notes: string | null;
58
60
  website: string | null;
59
61
  legalName: string | null;
62
+ vatNumber: string | null;
60
63
  industry: string | null;
61
64
  ownerId: string | null;
62
65
  defaultCurrency: string | null;
@@ -71,6 +74,7 @@ export declare const organizationAccountsService: {
71
74
  name: string;
72
75
  legalName: string | null;
73
76
  website: string | null;
77
+ vatNumber: string | null;
74
78
  industry: string | null;
75
79
  relation: "partner" | "supplier" | "other" | "client" | null;
76
80
  ownerId: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"accounts-organizations.d.ts","sourceRoot":"","sources":["../../src/service/accounts-organizations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAG7B,eAAO,MAAM,2BAA2B;0BACV,kBAAkB,SAAS,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;4BAgC9C,kBAAkB,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;2BAK/B,kBAAkB,QAAQ,uBAAuB;;;;;;;;;;;;;;;;;;;;2BAKjD,kBAAkB,MAAM,MAAM,QAAQ,uBAAuB;;;;;;;;;;;;;;;;;;;;2BAS7D,kBAAkB,MAAM,MAAM;;;CAO5D,CAAA"}
1
+ {"version":3,"file":"accounts-organizations.d.ts","sourceRoot":"","sources":["../../src/service/accounts-organizations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EACV,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,sBAAsB,CAAA;AAG7B,eAAO,MAAM,2BAA2B;0BACV,kBAAkB,SAAS,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;4BAgC9C,kBAAkB,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;2BAK/B,kBAAkB,QAAQ,uBAAuB;;;;;;;;;;;;;;;;;;;;;2BAKjD,kBAAkB,MAAM,MAAM,QAAQ,uBAAuB;;;;;;;;;;;;;;;;;;;;;2BAS7D,kBAAkB,MAAM,MAAM;;;CAO5D,CAAA"}