@voyantjs/crm 0.1.1 → 0.3.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.
Files changed (37) hide show
  1. package/dist/routes/accounts.d.ts +1 -1
  2. package/dist/routes/index.d.ts +2 -2
  3. package/dist/routes/opportunities.d.ts +1 -1
  4. package/dist/schema-accounts.d.ts +1175 -0
  5. package/dist/schema-accounts.d.ts.map +1 -0
  6. package/dist/schema-accounts.js +112 -0
  7. package/dist/schema-activities.d.ts +821 -0
  8. package/dist/schema-activities.d.ts.map +1 -0
  9. package/dist/schema-activities.js +83 -0
  10. package/dist/schema-relations.d.ts +81 -0
  11. package/dist/schema-relations.d.ts.map +1 -0
  12. package/dist/schema-relations.js +123 -0
  13. package/dist/schema-sales.d.ts +1392 -0
  14. package/dist/schema-sales.d.ts.map +1 -0
  15. package/dist/schema-sales.js +142 -0
  16. package/dist/schema-shared.d.ts +13 -0
  17. package/dist/schema-shared.d.ts.map +1 -0
  18. package/dist/schema-shared.js +63 -0
  19. package/dist/schema.d.ts +5 -3477
  20. package/dist/schema.d.ts.map +1 -1
  21. package/dist/schema.js +5 -515
  22. package/dist/service/accounts-organizations.d.ts +93 -0
  23. package/dist/service/accounts-organizations.d.ts.map +1 -0
  24. package/dist/service/accounts-organizations.js +49 -0
  25. package/dist/service/accounts-people.d.ts +868 -0
  26. package/dist/service/accounts-people.d.ts.map +1 -0
  27. package/dist/service/accounts-people.js +311 -0
  28. package/dist/service/accounts-shared.d.ts +54 -0
  29. package/dist/service/accounts-shared.d.ts.map +1 -0
  30. package/dist/service/accounts-shared.js +152 -0
  31. package/dist/service/accounts.d.ts +121 -149
  32. package/dist/service/accounts.d.ts.map +1 -1
  33. package/dist/service/accounts.js +4 -507
  34. package/dist/service/index.d.ts +106 -297
  35. package/dist/service/index.d.ts.map +1 -1
  36. package/dist/service/opportunities.d.ts +1 -1
  37. package/package.json +5 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":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,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,YAAY,CAAA;AAC/C,MAAM,MAAM,SAAS,GAAG,OAAO,MAAM,CAAC,YAAY,CAAA"}
@@ -0,0 +1,112 @@
1
+ import { typeId, typeIdRef } from "@voyantjs/db/lib/typeid-column";
2
+ import { date, index, integer, jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
3
+ import { communicationChannelEnum, communicationDirectionEnum, recordStatusEnum, relationTypeEnum, } from "./schema-shared";
4
+ export const organizations = pgTable("organizations", {
5
+ id: typeId("organizations"),
6
+ name: text("name").notNull(),
7
+ legalName: text("legal_name"),
8
+ website: text("website"),
9
+ industry: text("industry"),
10
+ relation: relationTypeEnum("relation"),
11
+ ownerId: text("owner_id"),
12
+ defaultCurrency: text("default_currency"),
13
+ preferredLanguage: text("preferred_language"),
14
+ paymentTerms: integer("payment_terms"),
15
+ status: recordStatusEnum("status").notNull().default("active"),
16
+ source: text("source"),
17
+ sourceRef: text("source_ref"),
18
+ tags: jsonb("tags").$type().notNull().default([]),
19
+ notes: text("notes"),
20
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
21
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
22
+ archivedAt: timestamp("archived_at", { withTimezone: true }),
23
+ }, (table) => [
24
+ index("idx_organizations_name").on(table.name),
25
+ index("idx_organizations_owner").on(table.ownerId),
26
+ index("idx_organizations_status").on(table.status),
27
+ ]);
28
+ export const people = pgTable("people", {
29
+ id: typeId("people"),
30
+ organizationId: typeIdRef("organization_id").references(() => organizations.id, {
31
+ onDelete: "set null",
32
+ }),
33
+ firstName: text("first_name").notNull(),
34
+ lastName: text("last_name").notNull(),
35
+ jobTitle: text("job_title"),
36
+ relation: relationTypeEnum("relation"),
37
+ preferredLanguage: text("preferred_language"),
38
+ preferredCurrency: text("preferred_currency"),
39
+ ownerId: text("owner_id"),
40
+ status: recordStatusEnum("status").notNull().default("active"),
41
+ source: text("source"),
42
+ sourceRef: text("source_ref"),
43
+ tags: jsonb("tags").$type().notNull().default([]),
44
+ birthday: date("birthday"),
45
+ notes: text("notes"),
46
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
47
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
48
+ archivedAt: timestamp("archived_at", { withTimezone: true }),
49
+ }, (table) => [
50
+ index("idx_people_org").on(table.organizationId),
51
+ index("idx_people_owner").on(table.ownerId),
52
+ index("idx_people_status").on(table.status),
53
+ index("idx_people_name").on(table.firstName, table.lastName),
54
+ ]);
55
+ export const personNotes = pgTable("person_notes", {
56
+ id: typeId("person_notes"),
57
+ personId: typeIdRef("person_id")
58
+ .notNull()
59
+ .references(() => people.id, { onDelete: "cascade" }),
60
+ authorId: text("author_id").notNull(),
61
+ content: text("content").notNull(),
62
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
63
+ }, (table) => [index("idx_person_notes_person").on(table.personId)]);
64
+ export const organizationNotes = pgTable("organization_notes", {
65
+ id: typeId("organization_notes"),
66
+ organizationId: typeIdRef("organization_id")
67
+ .notNull()
68
+ .references(() => organizations.id, { onDelete: "cascade" }),
69
+ authorId: text("author_id").notNull(),
70
+ content: text("content").notNull(),
71
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
72
+ }, (table) => [index("idx_organization_notes_org").on(table.organizationId)]);
73
+ export const communicationLog = pgTable("communication_log", {
74
+ id: typeId("communication_log"),
75
+ personId: typeIdRef("person_id")
76
+ .notNull()
77
+ .references(() => people.id, { onDelete: "cascade" }),
78
+ organizationId: typeIdRef("organization_id").references(() => organizations.id, {
79
+ onDelete: "set null",
80
+ }),
81
+ channel: communicationChannelEnum("channel").notNull(),
82
+ direction: communicationDirectionEnum("direction").notNull(),
83
+ subject: text("subject"),
84
+ content: text("content"),
85
+ sentAt: timestamp("sent_at", { withTimezone: true }),
86
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
87
+ }, (table) => [
88
+ index("idx_communication_log_person").on(table.personId),
89
+ index("idx_communication_log_org").on(table.organizationId),
90
+ index("idx_communication_log_channel").on(table.channel),
91
+ ]);
92
+ export const segments = pgTable("segments", {
93
+ id: typeId("segments"),
94
+ name: text("name").notNull(),
95
+ description: text("description"),
96
+ conditions: jsonb("conditions").$type(),
97
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
98
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
99
+ });
100
+ export const segmentMembers = pgTable("segment_members", {
101
+ id: typeId("segment_members"),
102
+ segmentId: typeIdRef("segment_id")
103
+ .notNull()
104
+ .references(() => segments.id, { onDelete: "cascade" }),
105
+ personId: typeIdRef("person_id")
106
+ .notNull()
107
+ .references(() => people.id, { onDelete: "cascade" }),
108
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
109
+ }, (table) => [
110
+ index("idx_segment_members_segment").on(table.segmentId),
111
+ index("idx_segment_members_person").on(table.personId),
112
+ ]);