@voyantjs/crm 0.106.1 → 0.107.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 (51) hide show
  1. package/README.md +3 -3
  2. package/dist/booking-extension.d.ts +7 -7
  3. package/dist/booking-extension.d.ts.map +1 -1
  4. package/dist/booking-extension.js +8 -5
  5. package/dist/index.d.ts +5 -3
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +3 -2
  8. package/dist/routes/activities.d.ts +2 -2
  9. package/dist/routes/custom-fields.d.ts +6 -6
  10. package/dist/routes/index.d.ts +518 -51
  11. package/dist/routes/index.d.ts.map +1 -1
  12. package/dist/routes/index.js +2 -2
  13. package/dist/routes/pipelines.d.ts +4 -4
  14. package/dist/routes/quote-versions.d.ts +746 -0
  15. package/dist/routes/quote-versions.d.ts.map +1 -0
  16. package/dist/routes/quote-versions.js +175 -0
  17. package/dist/routes/quotes.d.ts +161 -53
  18. package/dist/routes/quotes.d.ts.map +1 -1
  19. package/dist/routes/quotes.js +29 -11
  20. package/dist/schema-activities.d.ts +6 -6
  21. package/dist/schema-relations.d.ts +19 -18
  22. package/dist/schema-relations.d.ts.map +1 -1
  23. package/dist/schema-relations.js +38 -31
  24. package/dist/schema-sales.d.ts +206 -87
  25. package/dist/schema-sales.d.ts.map +1 -1
  26. package/dist/schema-sales.js +62 -50
  27. package/dist/schema-shared.d.ts +3 -3
  28. package/dist/schema-shared.d.ts.map +1 -1
  29. package/dist/schema-shared.js +5 -16
  30. package/dist/schema-signals.d.ts +1 -1
  31. package/dist/schema-signals.js +1 -1
  32. package/dist/service/accounts-merge.js +10 -10
  33. package/dist/service/activities.d.ts +6 -6
  34. package/dist/service/custom-fields.d.ts +6 -6
  35. package/dist/service/index.d.ts +338 -139
  36. package/dist/service/index.d.ts.map +1 -1
  37. package/dist/service/index.js +2 -2
  38. package/dist/service/pipelines.d.ts +4 -4
  39. package/dist/service/quote-versions.d.ts +674 -0
  40. package/dist/service/quote-versions.d.ts.map +1 -0
  41. package/dist/service/quote-versions.js +399 -0
  42. package/dist/service/quotes.d.ts +426 -94
  43. package/dist/service/quotes.d.ts.map +1 -1
  44. package/dist/service/quotes.js +63 -22
  45. package/package.json +7 -7
  46. package/dist/routes/opportunities.d.ts +0 -387
  47. package/dist/routes/opportunities.d.ts.map +0 -1
  48. package/dist/routes/opportunities.js +0 -70
  49. package/dist/service/opportunities.d.ts +0 -822
  50. package/dist/service/opportunities.d.ts.map +0 -1
  51. package/dist/service/opportunities.js +0 -117
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quote-versions.d.ts","sourceRoot":"","sources":["../../src/routes/quote-versions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAiBjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAsL3B,CAAA"}
@@ -0,0 +1,175 @@
1
+ import { parseJsonBody, parseOptionalJsonBody, parseQuery } from "@voyantjs/hono";
2
+ import { Hono } from "hono";
3
+ import { crmService } from "../service/index.js";
4
+ import { QuoteVersionConflictError } from "../service/quote-versions.js";
5
+ import { acceptQuoteVersionSchema, applyTripSnapshotToQuoteVersionSchema, declineQuoteVersionSchema, expireQuoteVersionsSchema, insertQuoteVersionLineSchema, insertQuoteVersionSchema, quoteVersionListQuerySchema, sendQuoteVersionSchema, updateQuoteVersionLineSchema, updateQuoteVersionSchema, } from "../validation.js";
6
+ export const quoteVersionRoutes = new Hono()
7
+ .get("/quote-versions", async (c) => {
8
+ const query = await parseQuery(c, quoteVersionListQuerySchema);
9
+ return c.json(await crmService.listQuoteVersions(c.get("db"), query));
10
+ })
11
+ .post("/quotes/:id/versions", async (c) => {
12
+ try {
13
+ const body = await parseJsonBody(c, insertQuoteVersionSchema.omit({ quoteId: true }));
14
+ return c.json({
15
+ data: await crmService.createQuoteVersion(c.get("db"), {
16
+ ...body,
17
+ quoteId: c.req.param("id"),
18
+ }),
19
+ }, 201);
20
+ }
21
+ catch (error) {
22
+ if (error instanceof QuoteVersionConflictError) {
23
+ return c.json({ error: error.message }, 409);
24
+ }
25
+ throw error;
26
+ }
27
+ })
28
+ .post("/quote-versions/expire", async (c) => {
29
+ return c.json({
30
+ data: await crmService.expireQuoteVersions(c.get("db"), await parseOptionalJsonBody(c, expireQuoteVersionsSchema)),
31
+ });
32
+ })
33
+ .get("/quote-versions/:id", async (c) => {
34
+ const row = await crmService.getQuoteVersionById(c.get("db"), c.req.param("id"));
35
+ if (!row)
36
+ return c.json({ error: "Quote version not found" }, 404);
37
+ return c.json({ data: row });
38
+ })
39
+ .patch("/quote-versions/:id", async (c) => {
40
+ try {
41
+ const row = await crmService.updateQuoteVersion(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateQuoteVersionSchema));
42
+ if (!row)
43
+ return c.json({ error: "Quote version not found" }, 404);
44
+ return c.json({ data: row });
45
+ }
46
+ catch (error) {
47
+ if (error instanceof QuoteVersionConflictError) {
48
+ return c.json({ error: error.message }, 409);
49
+ }
50
+ throw error;
51
+ }
52
+ })
53
+ .delete("/quote-versions/:id", async (c) => {
54
+ try {
55
+ const row = await crmService.deleteQuoteVersion(c.get("db"), c.req.param("id"));
56
+ if (!row)
57
+ return c.json({ error: "Quote version not found" }, 404);
58
+ return c.json({ success: true });
59
+ }
60
+ catch (error) {
61
+ if (error instanceof QuoteVersionConflictError) {
62
+ return c.json({ error: error.message }, 409);
63
+ }
64
+ throw error;
65
+ }
66
+ })
67
+ .post("/quote-versions/:id/trip-snapshot", async (c) => {
68
+ try {
69
+ const row = await crmService.applyTripSnapshotToQuoteVersion(c.get("db"), c.req.param("id"), await parseJsonBody(c, applyTripSnapshotToQuoteVersionSchema));
70
+ if (!row)
71
+ return c.json({ error: "Quote version not found" }, 404);
72
+ return c.json({ data: row });
73
+ }
74
+ catch (error) {
75
+ if (error instanceof QuoteVersionConflictError) {
76
+ return c.json({ error: error.message }, 409);
77
+ }
78
+ throw error;
79
+ }
80
+ })
81
+ .post("/quote-versions/:id/send", async (c) => {
82
+ try {
83
+ const row = await crmService.sendQuoteVersion(c.get("db"), c.req.param("id"), await parseOptionalJsonBody(c, sendQuoteVersionSchema));
84
+ if (!row)
85
+ return c.json({ error: "Quote version not found" }, 404);
86
+ return c.json({ data: row });
87
+ }
88
+ catch (error) {
89
+ if (error instanceof QuoteVersionConflictError) {
90
+ return c.json({ error: error.message }, 409);
91
+ }
92
+ throw error;
93
+ }
94
+ })
95
+ .post("/quote-versions/:id/view", async (c) => {
96
+ const row = await crmService.markQuoteVersionViewed(c.get("db"), c.req.param("id"));
97
+ if (!row)
98
+ return c.json({ error: "Quote version not found" }, 404);
99
+ return c.json({ data: row });
100
+ })
101
+ .post("/quote-versions/:id/accept", async (c) => {
102
+ try {
103
+ const row = await crmService.acceptQuoteVersion(c.get("db"), c.req.param("id"), await parseOptionalJsonBody(c, acceptQuoteVersionSchema));
104
+ if (!row)
105
+ return c.json({ error: "Quote version not found" }, 404);
106
+ return c.json({ data: row });
107
+ }
108
+ catch (error) {
109
+ if (error instanceof QuoteVersionConflictError) {
110
+ return c.json({ error: error.message }, 409);
111
+ }
112
+ throw error;
113
+ }
114
+ })
115
+ .post("/quote-versions/:id/decline", async (c) => {
116
+ try {
117
+ const row = await crmService.declineQuoteVersion(c.get("db"), c.req.param("id"), await parseOptionalJsonBody(c, declineQuoteVersionSchema));
118
+ if (!row)
119
+ return c.json({ error: "Quote version not found" }, 404);
120
+ return c.json({ data: row });
121
+ }
122
+ catch (error) {
123
+ if (error instanceof QuoteVersionConflictError) {
124
+ return c.json({ error: error.message }, 409);
125
+ }
126
+ throw error;
127
+ }
128
+ })
129
+ .get("/quote-versions/:id/lines", async (c) => {
130
+ return c.json({
131
+ data: await crmService.listQuoteVersionLines(c.get("db"), c.req.param("id")),
132
+ });
133
+ })
134
+ .post("/quote-versions/:id/lines", async (c) => {
135
+ try {
136
+ const row = await crmService.createQuoteVersionLine(c.get("db"), c.req.param("id"), await parseJsonBody(c, insertQuoteVersionLineSchema));
137
+ if (!row)
138
+ return c.json({ error: "Quote version not found" }, 404);
139
+ return c.json({ data: row }, 201);
140
+ }
141
+ catch (error) {
142
+ if (error instanceof QuoteVersionConflictError) {
143
+ return c.json({ error: error.message }, 409);
144
+ }
145
+ throw error;
146
+ }
147
+ })
148
+ .patch("/quote-version-lines/:id", async (c) => {
149
+ try {
150
+ const row = await crmService.updateQuoteVersionLine(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateQuoteVersionLineSchema));
151
+ if (!row)
152
+ return c.json({ error: "Quote version line not found" }, 404);
153
+ return c.json({ data: row });
154
+ }
155
+ catch (error) {
156
+ if (error instanceof QuoteVersionConflictError) {
157
+ return c.json({ error: error.message }, 409);
158
+ }
159
+ throw error;
160
+ }
161
+ })
162
+ .delete("/quote-version-lines/:id", async (c) => {
163
+ try {
164
+ const row = await crmService.deleteQuoteVersionLine(c.get("db"), c.req.param("id"));
165
+ if (!row)
166
+ return c.json({ error: "Quote version line not found" }, 404);
167
+ return c.json({ success: true });
168
+ }
169
+ catch (error) {
170
+ if (error instanceof QuoteVersionConflictError) {
171
+ return c.json({ error: error.message }, 409);
172
+ }
173
+ throw error;
174
+ }
175
+ });
@@ -12,17 +12,25 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
12
12
  output: {
13
13
  data: {
14
14
  id: string;
15
- opportunityId: string;
16
- status: "expired" | "archived" | "draft" | "sent" | "accepted" | "rejected";
17
- validUntil: string | null;
18
- currency: string;
19
- subtotalAmountCents: number;
20
- taxAmountCents: number;
21
- totalAmountCents: number;
22
- notes: string | null;
15
+ title: string;
16
+ personId: string | null;
17
+ organizationId: string | null;
18
+ pipelineId: string;
19
+ stageId: string;
20
+ ownerId: string | null;
21
+ status: "lost" | "archived" | "open" | "won";
22
+ acceptedVersionId: string | null;
23
+ valueAmountCents: number | null;
24
+ valueCurrency: string | null;
25
+ expectedCloseDate: string | null;
26
+ source: string | null;
27
+ sourceRef: string | null;
28
+ lostReason: string | null;
29
+ tags: string[];
23
30
  createdAt: string;
24
31
  updatedAt: string;
25
- archivedAt: string | null;
32
+ stageChangedAt: string;
33
+ closedAt: string | null;
26
34
  }[];
27
35
  total: number;
28
36
  limit: number;
@@ -39,17 +47,25 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
39
47
  output: {
40
48
  data: {
41
49
  id: string;
42
- status: "expired" | "archived" | "draft" | "sent" | "accepted" | "rejected";
50
+ status: "lost" | "archived" | "open" | "won";
51
+ organizationId: string | null;
43
52
  createdAt: string;
53
+ source: string | null;
44
54
  updatedAt: string;
45
- currency: string;
46
- notes: string | null;
47
- opportunityId: string;
48
- archivedAt: string | null;
49
- validUntil: string | null;
50
- subtotalAmountCents: number;
51
- taxAmountCents: number;
52
- totalAmountCents: number;
55
+ title: string;
56
+ ownerId: string | null;
57
+ sourceRef: string | null;
58
+ tags: string[];
59
+ personId: string | null;
60
+ pipelineId: string;
61
+ stageId: string;
62
+ acceptedVersionId: string | null;
63
+ valueAmountCents: number | null;
64
+ valueCurrency: string | null;
65
+ expectedCloseDate: string | null;
66
+ lostReason: string | null;
67
+ stageChangedAt: string;
68
+ closedAt: string | null;
53
69
  } | undefined;
54
70
  };
55
71
  outputFormat: "json";
@@ -78,17 +94,25 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
78
94
  output: {
79
95
  data: {
80
96
  id: string;
81
- opportunityId: string;
82
- status: "expired" | "archived" | "draft" | "sent" | "accepted" | "rejected";
83
- validUntil: string | null;
84
- currency: string;
85
- subtotalAmountCents: number;
86
- taxAmountCents: number;
87
- totalAmountCents: number;
88
- notes: string | null;
97
+ title: string;
98
+ personId: string | null;
99
+ organizationId: string | null;
100
+ pipelineId: string;
101
+ stageId: string;
102
+ ownerId: string | null;
103
+ status: "lost" | "archived" | "open" | "won";
104
+ acceptedVersionId: string | null;
105
+ valueAmountCents: number | null;
106
+ valueCurrency: string | null;
107
+ expectedCloseDate: string | null;
108
+ source: string | null;
109
+ sourceRef: string | null;
110
+ lostReason: string | null;
111
+ tags: string[];
89
112
  createdAt: string;
90
113
  updatedAt: string;
91
- archivedAt: string | null;
114
+ stageChangedAt: string;
115
+ closedAt: string | null;
92
116
  };
93
117
  };
94
118
  outputFormat: "json";
@@ -117,17 +141,25 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
117
141
  output: {
118
142
  data: {
119
143
  id: string;
120
- opportunityId: string;
121
- status: "expired" | "archived" | "draft" | "sent" | "accepted" | "rejected";
122
- validUntil: string | null;
123
- currency: string;
124
- subtotalAmountCents: number;
125
- taxAmountCents: number;
126
- totalAmountCents: number;
127
- notes: string | null;
144
+ title: string;
145
+ personId: string | null;
146
+ organizationId: string | null;
147
+ pipelineId: string;
148
+ stageId: string;
149
+ ownerId: string | null;
150
+ status: "lost" | "archived" | "open" | "won";
151
+ acceptedVersionId: string | null;
152
+ valueAmountCents: number | null;
153
+ valueCurrency: string | null;
154
+ expectedCloseDate: string | null;
155
+ source: string | null;
156
+ sourceRef: string | null;
157
+ lostReason: string | null;
158
+ tags: string[];
128
159
  createdAt: string;
129
160
  updatedAt: string;
130
- archivedAt: string | null;
161
+ stageChangedAt: string;
162
+ closedAt: string | null;
131
163
  };
132
164
  };
133
165
  outputFormat: "json";
@@ -161,7 +193,77 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
161
193
  };
162
194
  };
163
195
  } & {
164
- "/quotes/:id/lines": {
196
+ "/quotes/:id/participants": {
197
+ $get: {
198
+ input: {
199
+ param: {
200
+ id: string;
201
+ };
202
+ };
203
+ output: {
204
+ data: {
205
+ id: string;
206
+ quoteId: string;
207
+ personId: string;
208
+ role: "other" | "finance" | "traveler" | "booker" | "decision_maker";
209
+ isPrimary: boolean;
210
+ createdAt: string;
211
+ }[];
212
+ };
213
+ outputFormat: "json";
214
+ status: import("hono/utils/http-status").ContentfulStatusCode;
215
+ };
216
+ };
217
+ } & {
218
+ "/quotes/:id/participants": {
219
+ $post: {
220
+ input: {
221
+ param: {
222
+ id: string;
223
+ };
224
+ };
225
+ output: {
226
+ data: {
227
+ id: string;
228
+ createdAt: string;
229
+ role: "other" | "finance" | "traveler" | "booker" | "decision_maker";
230
+ quoteId: string;
231
+ isPrimary: boolean;
232
+ personId: string;
233
+ } | undefined;
234
+ };
235
+ outputFormat: "json";
236
+ status: 201;
237
+ };
238
+ };
239
+ } & {
240
+ "/quote-participants/:id": {
241
+ $delete: {
242
+ input: {
243
+ param: {
244
+ id: string;
245
+ };
246
+ };
247
+ output: {
248
+ error: string;
249
+ };
250
+ outputFormat: "json";
251
+ status: 404;
252
+ } | {
253
+ input: {
254
+ param: {
255
+ id: string;
256
+ };
257
+ };
258
+ output: {
259
+ success: true;
260
+ };
261
+ outputFormat: "json";
262
+ status: import("hono/utils/http-status").ContentfulStatusCode;
263
+ };
264
+ };
265
+ } & {
266
+ "/quotes/:id/products": {
165
267
  $get: {
166
268
  input: {
167
269
  param: {
@@ -174,11 +276,13 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
174
276
  quoteId: string;
175
277
  productId: string | null;
176
278
  supplierServiceId: string | null;
177
- description: string;
279
+ nameSnapshot: string;
280
+ description: string | null;
178
281
  quantity: number;
179
- unitPriceAmountCents: number;
180
- totalAmountCents: number;
181
- currency: string;
282
+ unitPriceAmountCents: number | null;
283
+ costAmountCents: number | null;
284
+ currency: string | null;
285
+ discountAmountCents: number | null;
182
286
  createdAt: string;
183
287
  updatedAt: string;
184
288
  }[];
@@ -188,7 +292,7 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
188
292
  };
189
293
  };
190
294
  } & {
191
- "/quotes/:id/lines": {
295
+ "/quotes/:id/products": {
192
296
  $post: {
193
297
  input: {
194
298
  param: {
@@ -198,16 +302,18 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
198
302
  output: {
199
303
  data: {
200
304
  id: string;
201
- description: string;
305
+ description: string | null;
202
306
  createdAt: string;
203
307
  updatedAt: string;
204
- currency: string;
308
+ currency: string | null;
205
309
  quoteId: string;
206
310
  productId: string | null;
207
311
  supplierServiceId: string | null;
312
+ nameSnapshot: string;
208
313
  quantity: number;
209
- unitPriceAmountCents: number;
210
- totalAmountCents: number;
314
+ unitPriceAmountCents: number | null;
315
+ costAmountCents: number | null;
316
+ discountAmountCents: number | null;
211
317
  } | undefined;
212
318
  };
213
319
  outputFormat: "json";
@@ -215,7 +321,7 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
215
321
  };
216
322
  };
217
323
  } & {
218
- "/quote-lines/:id": {
324
+ "/quote-products/:id": {
219
325
  $patch: {
220
326
  input: {
221
327
  param: {
@@ -239,11 +345,13 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
239
345
  quoteId: string;
240
346
  productId: string | null;
241
347
  supplierServiceId: string | null;
242
- description: string;
348
+ nameSnapshot: string;
349
+ description: string | null;
243
350
  quantity: number;
244
- unitPriceAmountCents: number;
245
- totalAmountCents: number;
246
- currency: string;
351
+ unitPriceAmountCents: number | null;
352
+ costAmountCents: number | null;
353
+ currency: string | null;
354
+ discountAmountCents: number | null;
247
355
  createdAt: string;
248
356
  updatedAt: string;
249
357
  };
@@ -253,7 +361,7 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
253
361
  };
254
362
  };
255
363
  } & {
256
- "/quote-lines/:id": {
364
+ "/quote-products/:id": {
257
365
  $delete: {
258
366
  input: {
259
367
  param: {
@@ -278,6 +386,6 @@ export declare const quoteRoutes: import("hono/hono-base").HonoBase<Env, {
278
386
  status: import("hono/utils/http-status").ContentfulStatusCode;
279
387
  };
280
388
  };
281
- }, "/", "/quote-lines/:id">;
389
+ }, "/", "/quote-products/:id">;
282
390
  export {};
283
391
  //# sourceMappingURL=quotes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../src/routes/quotes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAYjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA4DpB,CAAA"}
1
+ {"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../../src/routes/quotes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAajE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAoFpB,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { parseJsonBody, parseQuery } from "@voyantjs/hono";
2
2
  import { Hono } from "hono";
3
3
  import { crmService } from "../service/index.js";
4
- import { insertQuoteLineSchema, insertQuoteSchema, quoteListQuerySchema, updateQuoteLineSchema, updateQuoteSchema, } from "../validation.js";
4
+ import { insertQuoteParticipantSchema, insertQuoteProductSchema, insertQuoteSchema, quoteListQuerySchema, updateQuoteProductSchema, updateQuoteSchema, } from "../validation.js";
5
5
  export const quoteRoutes = new Hono()
6
6
  .get("/quotes", async (c) => {
7
7
  const query = await parseQuery(c, quoteListQuerySchema);
@@ -30,23 +30,41 @@ export const quoteRoutes = new Hono()
30
30
  return c.json({ error: "Quote not found" }, 404);
31
31
  return c.json({ success: true });
32
32
  })
33
- .get("/quotes/:id/lines", async (c) => {
34
- return c.json({ data: await crmService.listQuoteLines(c.get("db"), c.req.param("id")) });
33
+ .get("/quotes/:id/participants", async (c) => {
34
+ return c.json({
35
+ data: await crmService.listQuoteParticipants(c.get("db"), c.req.param("id")),
36
+ });
37
+ })
38
+ .post("/quotes/:id/participants", async (c) => {
39
+ return c.json({
40
+ data: await crmService.createQuoteParticipant(c.get("db"), c.req.param("id"), await parseJsonBody(c, insertQuoteParticipantSchema)),
41
+ }, 201);
42
+ })
43
+ .delete("/quote-participants/:id", async (c) => {
44
+ const row = await crmService.deleteQuoteParticipant(c.get("db"), c.req.param("id"));
45
+ if (!row)
46
+ return c.json({ error: "Quote participant not found" }, 404);
47
+ return c.json({ success: true });
48
+ })
49
+ .get("/quotes/:id/products", async (c) => {
50
+ return c.json({
51
+ data: await crmService.listQuoteProducts(c.get("db"), c.req.param("id")),
52
+ });
35
53
  })
36
- .post("/quotes/:id/lines", async (c) => {
54
+ .post("/quotes/:id/products", async (c) => {
37
55
  return c.json({
38
- data: await crmService.createQuoteLine(c.get("db"), c.req.param("id"), await parseJsonBody(c, insertQuoteLineSchema)),
56
+ data: await crmService.createQuoteProduct(c.get("db"), c.req.param("id"), await parseJsonBody(c, insertQuoteProductSchema)),
39
57
  }, 201);
40
58
  })
41
- .patch("/quote-lines/:id", async (c) => {
42
- const row = await crmService.updateQuoteLine(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateQuoteLineSchema));
59
+ .patch("/quote-products/:id", async (c) => {
60
+ const row = await crmService.updateQuoteProduct(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateQuoteProductSchema));
43
61
  if (!row)
44
- return c.json({ error: "Quote line not found" }, 404);
62
+ return c.json({ error: "Quote product not found" }, 404);
45
63
  return c.json({ data: row });
46
64
  })
47
- .delete("/quote-lines/:id", async (c) => {
48
- const row = await crmService.deleteQuoteLine(c.get("db"), c.req.param("id"));
65
+ .delete("/quote-products/:id", async (c) => {
66
+ const row = await crmService.deleteQuoteProduct(c.get("db"), c.req.param("id"));
49
67
  if (!row)
50
- return c.json({ error: "Quote line not found" }, 404);
68
+ return c.json({ error: "Quote product not found" }, 404);
51
69
  return c.json({ success: true });
52
70
  });
@@ -235,14 +235,14 @@ export declare const activityLinks: import("drizzle-orm/pg-core").PgTableWithCol
235
235
  tableName: "activity_links";
236
236
  dataType: "string";
237
237
  columnType: "PgEnumColumn";
238
- data: "organization" | "person" | "opportunity" | "quote" | "activity";
238
+ data: "organization" | "person" | "quote" | "activity";
239
239
  driverParam: string;
240
240
  notNull: true;
241
241
  hasDefault: false;
242
242
  isPrimaryKey: false;
243
243
  isAutoincrement: false;
244
244
  hasRuntimeDefault: false;
245
- enumValues: ["organization", "person", "opportunity", "quote", "activity"];
245
+ enumValues: ["organization", "person", "quote", "activity"];
246
246
  baseColumn: never;
247
247
  identity: undefined;
248
248
  generated: undefined;
@@ -419,14 +419,14 @@ export declare const customFieldDefinitions: import("drizzle-orm/pg-core").PgTab
419
419
  tableName: "custom_field_definitions";
420
420
  dataType: "string";
421
421
  columnType: "PgEnumColumn";
422
- data: "organization" | "person" | "opportunity" | "quote" | "activity";
422
+ data: "organization" | "person" | "quote" | "activity";
423
423
  driverParam: string;
424
424
  notNull: true;
425
425
  hasDefault: false;
426
426
  isPrimaryKey: false;
427
427
  isAutoincrement: false;
428
428
  hasRuntimeDefault: false;
429
- enumValues: ["organization", "person", "opportunity", "quote", "activity"];
429
+ enumValues: ["organization", "person", "quote", "activity"];
430
430
  baseColumn: never;
431
431
  identity: undefined;
432
432
  generated: undefined;
@@ -621,14 +621,14 @@ export declare const customFieldValues: import("drizzle-orm/pg-core").PgTableWit
621
621
  tableName: "custom_field_values";
622
622
  dataType: "string";
623
623
  columnType: "PgEnumColumn";
624
- data: "organization" | "person" | "opportunity" | "quote" | "activity";
624
+ data: "organization" | "person" | "quote" | "activity";
625
625
  driverParam: string;
626
626
  notNull: true;
627
627
  hasDefault: false;
628
628
  isPrimaryKey: false;
629
629
  isAutoincrement: false;
630
630
  hasRuntimeDefault: false;
631
- enumValues: ["organization", "person", "opportunity", "quote", "activity"];
631
+ enumValues: ["organization", "person", "quote", "activity"];
632
632
  baseColumn: never;
633
633
  identity: undefined;
634
634
  generated: undefined;