@hasna/microservices 0.0.15 → 0.0.17
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/README.md +120 -138
- package/bin/index.js +703 -12728
- package/bin/mcp.js +250 -9726
- package/dist/index.js +170 -9407
- package/package.json +25 -25
- package/microservices/microservice-ads/package.json +0 -27
- package/microservices/microservice-ads/src/cli/index.ts +0 -605
- package/microservices/microservice-ads/src/db/campaigns.ts +0 -797
- package/microservices/microservice-ads/src/db/database.ts +0 -93
- package/microservices/microservice-ads/src/db/migrations.ts +0 -60
- package/microservices/microservice-ads/src/index.ts +0 -39
- package/microservices/microservice-ads/src/mcp/index.ts +0 -480
- package/microservices/microservice-analytics/package.json +0 -27
- package/microservices/microservice-analytics/src/cli/index.ts +0 -373
- package/microservices/microservice-analytics/src/db/analytics.ts +0 -564
- package/microservices/microservice-analytics/src/db/database.ts +0 -93
- package/microservices/microservice-analytics/src/db/migrations.ts +0 -50
- package/microservices/microservice-analytics/src/index.ts +0 -37
- package/microservices/microservice-analytics/src/mcp/index.ts +0 -334
- package/microservices/microservice-assets/package.json +0 -27
- package/microservices/microservice-assets/src/cli/index.ts +0 -375
- package/microservices/microservice-assets/src/db/assets.ts +0 -370
- package/microservices/microservice-assets/src/db/database.ts +0 -93
- package/microservices/microservice-assets/src/db/migrations.ts +0 -51
- package/microservices/microservice-assets/src/index.ts +0 -32
- package/microservices/microservice-assets/src/mcp/index.ts +0 -346
- package/microservices/microservice-bookkeeping/package.json +0 -27
- package/microservices/microservice-bookkeeping/src/cli/index.ts +0 -386
- package/microservices/microservice-bookkeeping/src/db/bookkeeping.ts +0 -591
- package/microservices/microservice-bookkeeping/src/db/database.ts +0 -93
- package/microservices/microservice-bookkeeping/src/db/migrations.ts +0 -52
- package/microservices/microservice-bookkeeping/src/index.ts +0 -32
- package/microservices/microservice-bookkeeping/src/mcp/index.ts +0 -284
- package/microservices/microservice-calendar/package.json +0 -27
- package/microservices/microservice-calendar/src/cli/index.ts +0 -287
- package/microservices/microservice-calendar/src/db/calendar.ts +0 -328
- package/microservices/microservice-calendar/src/db/database.ts +0 -82
- package/microservices/microservice-calendar/src/db/migrations.ts +0 -47
- package/microservices/microservice-calendar/src/index.ts +0 -24
- package/microservices/microservice-calendar/src/mcp/index.ts +0 -226
- package/microservices/microservice-company/package.json +0 -27
- package/microservices/microservice-company/src/cli/index.ts +0 -1126
- package/microservices/microservice-company/src/db/company.ts +0 -854
- package/microservices/microservice-company/src/db/database.ts +0 -93
- package/microservices/microservice-company/src/db/migrations.ts +0 -214
- package/microservices/microservice-company/src/db/workflow-migrations.ts +0 -44
- package/microservices/microservice-company/src/index.ts +0 -60
- package/microservices/microservice-company/src/lib/audit.ts +0 -168
- package/microservices/microservice-company/src/lib/finance.ts +0 -299
- package/microservices/microservice-company/src/lib/settings.ts +0 -85
- package/microservices/microservice-company/src/lib/workflows.ts +0 -698
- package/microservices/microservice-company/src/mcp/index.ts +0 -991
- package/microservices/microservice-compliance/package.json +0 -27
- package/microservices/microservice-compliance/src/cli/index.ts +0 -467
- package/microservices/microservice-compliance/src/db/compliance.ts +0 -633
- package/microservices/microservice-compliance/src/db/database.ts +0 -93
- package/microservices/microservice-compliance/src/db/migrations.ts +0 -63
- package/microservices/microservice-compliance/src/index.ts +0 -46
- package/microservices/microservice-compliance/src/mcp/index.ts +0 -438
- package/microservices/microservice-contacts/package.json +0 -27
- package/microservices/microservice-contacts/src/cli/index.ts +0 -393
- package/microservices/microservice-contacts/src/db/companies.ts +0 -167
- package/microservices/microservice-contacts/src/db/contacts.ts +0 -249
- package/microservices/microservice-contacts/src/db/database.ts +0 -93
- package/microservices/microservice-contacts/src/db/migrations.ts +0 -71
- package/microservices/microservice-contacts/src/db/relationships.ts +0 -53
- package/microservices/microservice-contacts/src/index.ts +0 -42
- package/microservices/microservice-contacts/src/mcp/index.ts +0 -303
- package/microservices/microservice-contracts/package.json +0 -27
- package/microservices/microservice-contracts/src/cli/index.ts +0 -770
- package/microservices/microservice-contracts/src/db/contracts.ts +0 -925
- package/microservices/microservice-contracts/src/db/database.ts +0 -93
- package/microservices/microservice-contracts/src/db/migrations.ts +0 -141
- package/microservices/microservice-contracts/src/index.ts +0 -43
- package/microservices/microservice-contracts/src/mcp/index.ts +0 -617
- package/microservices/microservice-crm/package.json +0 -27
- package/microservices/microservice-crm/src/cli/index.ts +0 -396
- package/microservices/microservice-crm/src/db/database.ts +0 -82
- package/microservices/microservice-crm/src/db/migrations.ts +0 -66
- package/microservices/microservice-crm/src/db/pipeline.ts +0 -397
- package/microservices/microservice-crm/src/index.ts +0 -34
- package/microservices/microservice-crm/src/mcp/index.ts +0 -294
- package/microservices/microservice-documents/package.json +0 -27
- package/microservices/microservice-documents/src/cli/index.ts +0 -246
- package/microservices/microservice-documents/src/db/database.ts +0 -82
- package/microservices/microservice-documents/src/db/documents.ts +0 -316
- package/microservices/microservice-documents/src/db/migrations.ts +0 -49
- package/microservices/microservice-documents/src/index.ts +0 -24
- package/microservices/microservice-documents/src/mcp/index.ts +0 -202
- package/microservices/microservice-domains/package.json +0 -27
- package/microservices/microservice-domains/src/cli/index.ts +0 -1111
- package/microservices/microservice-domains/src/db/database.ts +0 -93
- package/microservices/microservice-domains/src/db/domains.ts +0 -1164
- package/microservices/microservice-domains/src/db/migrations.ts +0 -60
- package/microservices/microservice-domains/src/index.ts +0 -65
- package/microservices/microservice-domains/src/lib/brandsight.ts +0 -350
- package/microservices/microservice-domains/src/lib/godaddy.ts +0 -338
- package/microservices/microservice-domains/src/lib/namecheap.ts +0 -262
- package/microservices/microservice-domains/src/lib/registrar.ts +0 -355
- package/microservices/microservice-domains/src/mcp/index.ts +0 -781
- package/microservices/microservice-expenses/package.json +0 -27
- package/microservices/microservice-expenses/src/cli/index.ts +0 -267
- package/microservices/microservice-expenses/src/db/database.ts +0 -82
- package/microservices/microservice-expenses/src/db/expenses.ts +0 -345
- package/microservices/microservice-expenses/src/db/migrations.ts +0 -45
- package/microservices/microservice-expenses/src/index.ts +0 -25
- package/microservices/microservice-expenses/src/mcp/index.ts +0 -196
- package/microservices/microservice-habits/package.json +0 -27
- package/microservices/microservice-habits/src/cli/index.ts +0 -315
- package/microservices/microservice-habits/src/db/database.ts +0 -93
- package/microservices/microservice-habits/src/db/habits.ts +0 -451
- package/microservices/microservice-habits/src/db/migrations.ts +0 -46
- package/microservices/microservice-habits/src/index.ts +0 -31
- package/microservices/microservice-habits/src/mcp/index.ts +0 -313
- package/microservices/microservice-health/package.json +0 -27
- package/microservices/microservice-health/src/cli/index.ts +0 -484
- package/microservices/microservice-health/src/db/database.ts +0 -93
- package/microservices/microservice-health/src/db/health.ts +0 -708
- package/microservices/microservice-health/src/db/migrations.ts +0 -70
- package/microservices/microservice-health/src/index.ts +0 -63
- package/microservices/microservice-health/src/mcp/index.ts +0 -437
- package/microservices/microservice-hiring/package.json +0 -27
- package/microservices/microservice-hiring/src/cli/index.ts +0 -741
- package/microservices/microservice-hiring/src/db/database.ts +0 -93
- package/microservices/microservice-hiring/src/db/hiring.ts +0 -1085
- package/microservices/microservice-hiring/src/db/migrations.ts +0 -89
- package/microservices/microservice-hiring/src/index.ts +0 -80
- package/microservices/microservice-hiring/src/lib/scoring.ts +0 -206
- package/microservices/microservice-hiring/src/mcp/index.ts +0 -709
- package/microservices/microservice-inventory/package.json +0 -27
- package/microservices/microservice-inventory/src/cli/index.ts +0 -365
- package/microservices/microservice-inventory/src/db/database.ts +0 -82
- package/microservices/microservice-inventory/src/db/inventory.ts +0 -393
- package/microservices/microservice-inventory/src/db/migrations.ts +0 -54
- package/microservices/microservice-inventory/src/index.ts +0 -28
- package/microservices/microservice-inventory/src/mcp/index.ts +0 -250
- package/microservices/microservice-invoices/dashboard/dist/assets/index-Bngq7FNM.css +0 -1
- package/microservices/microservice-invoices/dashboard/dist/assets/index-aHW4ARZR.js +0 -124
- package/microservices/microservice-invoices/dashboard/dist/index.html +0 -13
- package/microservices/microservice-invoices/dashboard/index.html +0 -12
- package/microservices/microservice-invoices/dashboard/package.json +0 -29
- package/microservices/microservice-invoices/dashboard/tsconfig.json +0 -14
- package/microservices/microservice-invoices/dashboard/vite.config.ts +0 -15
- package/microservices/microservice-invoices/package.json +0 -30
- package/microservices/microservice-invoices/src/cli/index.ts +0 -308
- package/microservices/microservice-invoices/src/db/business.ts +0 -241
- package/microservices/microservice-invoices/src/db/clients.ts +0 -127
- package/microservices/microservice-invoices/src/db/database.ts +0 -82
- package/microservices/microservice-invoices/src/db/invoices.ts +0 -345
- package/microservices/microservice-invoices/src/db/migrations.ts +0 -184
- package/microservices/microservice-invoices/src/index.ts +0 -56
- package/microservices/microservice-invoices/src/mcp/index.ts +0 -242
- package/microservices/microservice-invoices/src/server/index.ts +0 -162
- package/microservices/microservice-leads/package.json +0 -27
- package/microservices/microservice-leads/src/cli/index.ts +0 -596
- package/microservices/microservice-leads/src/db/database.ts +0 -93
- package/microservices/microservice-leads/src/db/leads.ts +0 -520
- package/microservices/microservice-leads/src/db/lists.ts +0 -151
- package/microservices/microservice-leads/src/db/migrations.ts +0 -93
- package/microservices/microservice-leads/src/index.ts +0 -65
- package/microservices/microservice-leads/src/lib/enrichment.ts +0 -202
- package/microservices/microservice-leads/src/lib/scoring.ts +0 -134
- package/microservices/microservice-leads/src/mcp/index.ts +0 -533
- package/microservices/microservice-notes/package.json +0 -27
- package/microservices/microservice-notes/src/cli/index.ts +0 -63
- package/microservices/microservice-notes/src/db/database.ts +0 -93
- package/microservices/microservice-notes/src/db/migrations.ts +0 -40
- package/microservices/microservice-notes/src/db/notes.ts +0 -114
- package/microservices/microservice-notes/src/index.ts +0 -2
- package/microservices/microservice-notes/src/mcp/index.ts +0 -37
- package/microservices/microservice-notifications/package.json +0 -27
- package/microservices/microservice-notifications/src/cli/index.ts +0 -349
- package/microservices/microservice-notifications/src/db/database.ts +0 -93
- package/microservices/microservice-notifications/src/db/migrations.ts +0 -62
- package/microservices/microservice-notifications/src/db/notifications.ts +0 -509
- package/microservices/microservice-notifications/src/index.ts +0 -41
- package/microservices/microservice-notifications/src/mcp/index.ts +0 -422
- package/microservices/microservice-payments/package.json +0 -27
- package/microservices/microservice-payments/src/cli/index.ts +0 -609
- package/microservices/microservice-payments/src/db/database.ts +0 -93
- package/microservices/microservice-payments/src/db/migrations.ts +0 -81
- package/microservices/microservice-payments/src/db/payments.ts +0 -1204
- package/microservices/microservice-payments/src/index.ts +0 -51
- package/microservices/microservice-payments/src/mcp/index.ts +0 -683
- package/microservices/microservice-payroll/package.json +0 -27
- package/microservices/microservice-payroll/src/cli/index.ts +0 -643
- package/microservices/microservice-payroll/src/db/database.ts +0 -93
- package/microservices/microservice-payroll/src/db/migrations.ts +0 -95
- package/microservices/microservice-payroll/src/db/payroll.ts +0 -1377
- package/microservices/microservice-payroll/src/index.ts +0 -48
- package/microservices/microservice-payroll/src/mcp/index.ts +0 -666
- package/microservices/microservice-products/package.json +0 -27
- package/microservices/microservice-products/src/cli/index.ts +0 -416
- package/microservices/microservice-products/src/db/categories.ts +0 -154
- package/microservices/microservice-products/src/db/database.ts +0 -93
- package/microservices/microservice-products/src/db/migrations.ts +0 -58
- package/microservices/microservice-products/src/db/pricing-tiers.ts +0 -66
- package/microservices/microservice-products/src/db/products.ts +0 -452
- package/microservices/microservice-products/src/index.ts +0 -53
- package/microservices/microservice-products/src/mcp/index.ts +0 -453
- package/microservices/microservice-projects/package.json +0 -27
- package/microservices/microservice-projects/src/cli/index.ts +0 -480
- package/microservices/microservice-projects/src/db/database.ts +0 -93
- package/microservices/microservice-projects/src/db/migrations.ts +0 -65
- package/microservices/microservice-projects/src/db/projects.ts +0 -715
- package/microservices/microservice-projects/src/index.ts +0 -57
- package/microservices/microservice-projects/src/mcp/index.ts +0 -501
- package/microservices/microservice-proposals/package.json +0 -27
- package/microservices/microservice-proposals/src/cli/index.ts +0 -400
- package/microservices/microservice-proposals/src/db/database.ts +0 -93
- package/microservices/microservice-proposals/src/db/migrations.ts +0 -52
- package/microservices/microservice-proposals/src/db/proposals.ts +0 -532
- package/microservices/microservice-proposals/src/index.ts +0 -37
- package/microservices/microservice-proposals/src/mcp/index.ts +0 -375
- package/microservices/microservice-reading/package.json +0 -27
- package/microservices/microservice-reading/src/cli/index.ts +0 -464
- package/microservices/microservice-reading/src/db/database.ts +0 -93
- package/microservices/microservice-reading/src/db/migrations.ts +0 -59
- package/microservices/microservice-reading/src/db/reading.ts +0 -524
- package/microservices/microservice-reading/src/index.ts +0 -51
- package/microservices/microservice-reading/src/mcp/index.ts +0 -368
- package/microservices/microservice-shipping/package.json +0 -27
- package/microservices/microservice-shipping/src/cli/index.ts +0 -606
- package/microservices/microservice-shipping/src/db/database.ts +0 -93
- package/microservices/microservice-shipping/src/db/migrations.ts +0 -69
- package/microservices/microservice-shipping/src/db/shipping.ts +0 -1093
- package/microservices/microservice-shipping/src/index.ts +0 -53
- package/microservices/microservice-shipping/src/mcp/index.ts +0 -533
- package/microservices/microservice-social/package.json +0 -28
- package/microservices/microservice-social/src/cli/index.ts +0 -1583
- package/microservices/microservice-social/src/db/database.ts +0 -93
- package/microservices/microservice-social/src/db/migrations.ts +0 -160
- package/microservices/microservice-social/src/db/social.ts +0 -1076
- package/microservices/microservice-social/src/index.ts +0 -46
- package/microservices/microservice-social/src/lib/audience.ts +0 -353
- package/microservices/microservice-social/src/lib/content-ai.ts +0 -278
- package/microservices/microservice-social/src/lib/media.ts +0 -311
- package/microservices/microservice-social/src/lib/mentions.ts +0 -434
- package/microservices/microservice-social/src/lib/metrics-sync.ts +0 -264
- package/microservices/microservice-social/src/lib/publisher.ts +0 -377
- package/microservices/microservice-social/src/lib/scheduler.ts +0 -229
- package/microservices/microservice-social/src/lib/sentiment.ts +0 -256
- package/microservices/microservice-social/src/lib/threads.ts +0 -291
- package/microservices/microservice-social/src/mcp/index.ts +0 -1425
- package/microservices/microservice-social/src/server/index.ts +0 -441
- package/microservices/microservice-subscriptions/package.json +0 -27
- package/microservices/microservice-subscriptions/src/cli/index.ts +0 -715
- package/microservices/microservice-subscriptions/src/db/database.ts +0 -93
- package/microservices/microservice-subscriptions/src/db/migrations.ts +0 -125
- package/microservices/microservice-subscriptions/src/db/subscriptions.ts +0 -1256
- package/microservices/microservice-subscriptions/src/index.ts +0 -41
- package/microservices/microservice-subscriptions/src/mcp/index.ts +0 -631
- package/microservices/microservice-timesheets/package.json +0 -27
- package/microservices/microservice-timesheets/src/cli/index.ts +0 -373
- package/microservices/microservice-timesheets/src/db/database.ts +0 -82
- package/microservices/microservice-timesheets/src/db/locale.ts +0 -217
- package/microservices/microservice-timesheets/src/db/migrations.ts +0 -74
- package/microservices/microservice-timesheets/src/db/timesheets.ts +0 -447
- package/microservices/microservice-timesheets/src/index.ts +0 -44
- package/microservices/microservice-timesheets/src/mcp/index.ts +0 -269
- package/microservices/microservice-transcriber/package.json +0 -28
- package/microservices/microservice-transcriber/src/cli/index.ts +0 -1593
- package/microservices/microservice-transcriber/src/db/annotations.ts +0 -37
- package/microservices/microservice-transcriber/src/db/comments.ts +0 -166
- package/microservices/microservice-transcriber/src/db/database.ts +0 -82
- package/microservices/microservice-transcriber/src/db/migrations.ts +0 -118
- package/microservices/microservice-transcriber/src/db/proofread.ts +0 -119
- package/microservices/microservice-transcriber/src/db/transcripts.ts +0 -395
- package/microservices/microservice-transcriber/src/index.ts +0 -43
- package/microservices/microservice-transcriber/src/lib/config.ts +0 -77
- package/microservices/microservice-transcriber/src/lib/diff.ts +0 -91
- package/microservices/microservice-transcriber/src/lib/downloader.ts +0 -638
- package/microservices/microservice-transcriber/src/lib/feeds.ts +0 -62
- package/microservices/microservice-transcriber/src/lib/live.ts +0 -94
- package/microservices/microservice-transcriber/src/lib/notion.ts +0 -129
- package/microservices/microservice-transcriber/src/lib/proofread.ts +0 -296
- package/microservices/microservice-transcriber/src/lib/providers.ts +0 -713
- package/microservices/microservice-transcriber/src/lib/summarizer.ts +0 -147
- package/microservices/microservice-transcriber/src/lib/translator.ts +0 -75
- package/microservices/microservice-transcriber/src/lib/webhook.ts +0 -37
- package/microservices/microservice-transcriber/src/mcp/index.ts +0 -1330
- package/microservices/microservice-transcriber/src/server/index.ts +0 -199
- package/microservices/microservice-travel/package.json +0 -27
- package/microservices/microservice-travel/src/cli/index.ts +0 -505
- package/microservices/microservice-travel/src/db/database.ts +0 -93
- package/microservices/microservice-travel/src/db/migrations.ts +0 -77
- package/microservices/microservice-travel/src/db/travel.ts +0 -802
- package/microservices/microservice-travel/src/index.ts +0 -60
- package/microservices/microservice-travel/src/mcp/index.ts +0 -495
- package/microservices/microservice-wiki/package.json +0 -27
- package/microservices/microservice-wiki/src/cli/index.ts +0 -345
- package/microservices/microservice-wiki/src/db/database.ts +0 -93
- package/microservices/microservice-wiki/src/db/migrations.ts +0 -55
- package/microservices/microservice-wiki/src/db/wiki.ts +0 -395
- package/microservices/microservice-wiki/src/index.ts +0 -32
- package/microservices/microservice-wiki/src/mcp/index.ts +0 -344
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import {
|
|
5
|
-
createPipeline,
|
|
6
|
-
listPipelines,
|
|
7
|
-
createStage,
|
|
8
|
-
listStages,
|
|
9
|
-
createDeal,
|
|
10
|
-
getDeal,
|
|
11
|
-
listDeals,
|
|
12
|
-
updateDeal,
|
|
13
|
-
moveDeal,
|
|
14
|
-
closeDeal,
|
|
15
|
-
deleteDeal,
|
|
16
|
-
addActivity,
|
|
17
|
-
listActivities,
|
|
18
|
-
getPipelineSummary,
|
|
19
|
-
} from "../db/pipeline.js";
|
|
20
|
-
|
|
21
|
-
const program = new Command();
|
|
22
|
-
|
|
23
|
-
program
|
|
24
|
-
.name("microservice-crm")
|
|
25
|
-
.description("CRM pipeline management microservice")
|
|
26
|
-
.version("0.0.1");
|
|
27
|
-
|
|
28
|
-
// --- Pipelines ---
|
|
29
|
-
|
|
30
|
-
const pipelineCmd = program
|
|
31
|
-
.command("pipeline")
|
|
32
|
-
.description("Pipeline management");
|
|
33
|
-
|
|
34
|
-
pipelineCmd
|
|
35
|
-
.command("create")
|
|
36
|
-
.description("Create a new pipeline")
|
|
37
|
-
.requiredOption("--name <name>", "Pipeline name")
|
|
38
|
-
.option("--description <text>", "Pipeline description")
|
|
39
|
-
.option("--json", "Output as JSON", false)
|
|
40
|
-
.action((opts) => {
|
|
41
|
-
const pipeline = createPipeline({
|
|
42
|
-
name: opts.name,
|
|
43
|
-
description: opts.description,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
if (opts.json) {
|
|
47
|
-
console.log(JSON.stringify(pipeline, null, 2));
|
|
48
|
-
} else {
|
|
49
|
-
console.log(`Created pipeline: ${pipeline.name} (${pipeline.id})`);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
pipelineCmd
|
|
54
|
-
.command("list")
|
|
55
|
-
.description("List all pipelines")
|
|
56
|
-
.option("--json", "Output as JSON", false)
|
|
57
|
-
.action((opts) => {
|
|
58
|
-
const pipelines = listPipelines();
|
|
59
|
-
|
|
60
|
-
if (opts.json) {
|
|
61
|
-
console.log(JSON.stringify(pipelines, null, 2));
|
|
62
|
-
} else {
|
|
63
|
-
if (pipelines.length === 0) {
|
|
64
|
-
console.log("No pipelines found.");
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
for (const p of pipelines) {
|
|
68
|
-
const desc = p.description ? ` — ${p.description}` : "";
|
|
69
|
-
console.log(` ${p.name}${desc} (${p.id})`);
|
|
70
|
-
}
|
|
71
|
-
console.log(`\n${pipelines.length} pipeline(s)`);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
pipelineCmd
|
|
76
|
-
.command("summary")
|
|
77
|
-
.description("Show pipeline summary with deals per stage")
|
|
78
|
-
.argument("<id>", "Pipeline ID")
|
|
79
|
-
.option("--json", "Output as JSON", false)
|
|
80
|
-
.action((id, opts) => {
|
|
81
|
-
const summary = getPipelineSummary(id);
|
|
82
|
-
if (!summary) {
|
|
83
|
-
console.error(`Pipeline '${id}' not found.`);
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (opts.json) {
|
|
88
|
-
console.log(JSON.stringify(summary, null, 2));
|
|
89
|
-
} else {
|
|
90
|
-
console.log(`\n Pipeline: ${summary.pipeline_name}`);
|
|
91
|
-
console.log(` Total deals: ${summary.total_deals}`);
|
|
92
|
-
console.log(` Open: ${summary.open_deals}`);
|
|
93
|
-
console.log(` Won: ${summary.won_deals}`);
|
|
94
|
-
console.log(` Lost: ${summary.lost_deals}`);
|
|
95
|
-
console.log(` Total value: $${summary.total_value.toFixed(2)}`);
|
|
96
|
-
console.log(` Weighted value: $${summary.weighted_value.toFixed(2)}`);
|
|
97
|
-
if (summary.stages.length > 0) {
|
|
98
|
-
console.log(` Stages:`);
|
|
99
|
-
for (const s of summary.stages) {
|
|
100
|
-
console.log(` ${s.stage_name}: ${s.deal_count} deal(s), $${s.total_value.toFixed(2)}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
console.log();
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// --- Stages ---
|
|
108
|
-
|
|
109
|
-
const stageCmd = program
|
|
110
|
-
.command("stage")
|
|
111
|
-
.description("Stage management");
|
|
112
|
-
|
|
113
|
-
stageCmd
|
|
114
|
-
.command("create")
|
|
115
|
-
.description("Create a stage in a pipeline")
|
|
116
|
-
.requiredOption("--pipeline <id>", "Pipeline ID")
|
|
117
|
-
.requiredOption("--name <name>", "Stage name")
|
|
118
|
-
.option("--sort-order <n>", "Sort order")
|
|
119
|
-
.option("--json", "Output as JSON", false)
|
|
120
|
-
.action((opts) => {
|
|
121
|
-
const stage = createStage({
|
|
122
|
-
pipeline_id: opts.pipeline,
|
|
123
|
-
name: opts.name,
|
|
124
|
-
sort_order: opts.sortOrder !== undefined ? parseInt(opts.sortOrder) : undefined,
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
if (opts.json) {
|
|
128
|
-
console.log(JSON.stringify(stage, null, 2));
|
|
129
|
-
} else {
|
|
130
|
-
console.log(`Created stage: ${stage.name} (${stage.id}) [order: ${stage.sort_order}]`);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
stageCmd
|
|
135
|
-
.command("list")
|
|
136
|
-
.description("List stages in a pipeline")
|
|
137
|
-
.argument("<pipeline-id>", "Pipeline ID")
|
|
138
|
-
.option("--json", "Output as JSON", false)
|
|
139
|
-
.action((pipelineId, opts) => {
|
|
140
|
-
const stages = listStages(pipelineId);
|
|
141
|
-
|
|
142
|
-
if (opts.json) {
|
|
143
|
-
console.log(JSON.stringify(stages, null, 2));
|
|
144
|
-
} else {
|
|
145
|
-
if (stages.length === 0) {
|
|
146
|
-
console.log("No stages found.");
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
for (const s of stages) {
|
|
150
|
-
console.log(` [${s.sort_order}] ${s.name} (${s.id})`);
|
|
151
|
-
}
|
|
152
|
-
console.log(`\n${stages.length} stage(s)`);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// --- Deals ---
|
|
157
|
-
|
|
158
|
-
program
|
|
159
|
-
.command("create")
|
|
160
|
-
.description("Create a new deal")
|
|
161
|
-
.requiredOption("--pipeline <id>", "Pipeline ID")
|
|
162
|
-
.requiredOption("--stage <id>", "Stage ID")
|
|
163
|
-
.requiredOption("--title <title>", "Deal title")
|
|
164
|
-
.option("--value <amount>", "Deal value", "0")
|
|
165
|
-
.option("--currency <code>", "Currency code", "USD")
|
|
166
|
-
.option("--contact-name <name>", "Contact name")
|
|
167
|
-
.option("--contact-email <email>", "Contact email")
|
|
168
|
-
.option("--probability <pct>", "Win probability (0-100)", "0")
|
|
169
|
-
.option("--close-date <date>", "Expected close date (YYYY-MM-DD)")
|
|
170
|
-
.option("--notes <notes>", "Notes")
|
|
171
|
-
.option("--json", "Output as JSON", false)
|
|
172
|
-
.action((opts) => {
|
|
173
|
-
const deal = createDeal({
|
|
174
|
-
pipeline_id: opts.pipeline,
|
|
175
|
-
stage_id: opts.stage,
|
|
176
|
-
title: opts.title,
|
|
177
|
-
value: parseFloat(opts.value),
|
|
178
|
-
currency: opts.currency,
|
|
179
|
-
contact_name: opts.contactName,
|
|
180
|
-
contact_email: opts.contactEmail,
|
|
181
|
-
probability: parseInt(opts.probability),
|
|
182
|
-
expected_close_date: opts.closeDate,
|
|
183
|
-
notes: opts.notes,
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
if (opts.json) {
|
|
187
|
-
console.log(JSON.stringify(deal, null, 2));
|
|
188
|
-
} else {
|
|
189
|
-
console.log(`Created deal: ${deal.title} — $${deal.value.toFixed(2)} (${deal.id})`);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
program
|
|
194
|
-
.command("get")
|
|
195
|
-
.description("Get a deal by ID")
|
|
196
|
-
.argument("<id>", "Deal ID")
|
|
197
|
-
.option("--json", "Output as JSON", false)
|
|
198
|
-
.action((id, opts) => {
|
|
199
|
-
const deal = getDeal(id);
|
|
200
|
-
if (!deal) {
|
|
201
|
-
console.error(`Deal '${id}' not found.`);
|
|
202
|
-
process.exit(1);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (opts.json) {
|
|
206
|
-
console.log(JSON.stringify(deal, null, 2));
|
|
207
|
-
} else {
|
|
208
|
-
console.log(`Deal: ${deal.title}`);
|
|
209
|
-
console.log(` Status: ${deal.status}`);
|
|
210
|
-
console.log(` Value: ${deal.currency} ${deal.value.toFixed(2)}`);
|
|
211
|
-
console.log(` Probability: ${deal.probability}%`);
|
|
212
|
-
if (deal.contact_name) console.log(` Contact: ${deal.contact_name}`);
|
|
213
|
-
if (deal.contact_email) console.log(` Email: ${deal.contact_email}`);
|
|
214
|
-
if (deal.expected_close_date) console.log(` Close date: ${deal.expected_close_date}`);
|
|
215
|
-
if (deal.notes) console.log(` Notes: ${deal.notes}`);
|
|
216
|
-
if (deal.closed_at) console.log(` Closed at: ${deal.closed_at}`);
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
program
|
|
221
|
-
.command("list")
|
|
222
|
-
.description("List deals")
|
|
223
|
-
.option("--pipeline <id>", "Filter by pipeline")
|
|
224
|
-
.option("--stage <id>", "Filter by stage")
|
|
225
|
-
.option("--status <status>", "Filter by status: open|won|lost")
|
|
226
|
-
.option("--limit <n>", "Limit results")
|
|
227
|
-
.option("--json", "Output as JSON", false)
|
|
228
|
-
.action((opts) => {
|
|
229
|
-
const deals = listDeals({
|
|
230
|
-
pipeline_id: opts.pipeline,
|
|
231
|
-
stage_id: opts.stage,
|
|
232
|
-
status: opts.status,
|
|
233
|
-
limit: opts.limit ? parseInt(opts.limit) : undefined,
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
if (opts.json) {
|
|
237
|
-
console.log(JSON.stringify(deals, null, 2));
|
|
238
|
-
} else {
|
|
239
|
-
if (deals.length === 0) {
|
|
240
|
-
console.log("No deals found.");
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
for (const d of deals) {
|
|
244
|
-
const status = d.status.toUpperCase().padEnd(5);
|
|
245
|
-
console.log(` ${status} ${d.title} ${d.currency} ${d.value.toFixed(2)} ${d.probability}%`);
|
|
246
|
-
}
|
|
247
|
-
console.log(`\n${deals.length} deal(s)`);
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
program
|
|
252
|
-
.command("update")
|
|
253
|
-
.description("Update a deal")
|
|
254
|
-
.argument("<id>", "Deal ID")
|
|
255
|
-
.option("--title <title>", "Deal title")
|
|
256
|
-
.option("--value <amount>", "Deal value")
|
|
257
|
-
.option("--currency <code>", "Currency code")
|
|
258
|
-
.option("--contact-name <name>", "Contact name")
|
|
259
|
-
.option("--contact-email <email>", "Contact email")
|
|
260
|
-
.option("--probability <pct>", "Win probability (0-100)")
|
|
261
|
-
.option("--close-date <date>", "Expected close date")
|
|
262
|
-
.option("--notes <notes>", "Notes")
|
|
263
|
-
.option("--json", "Output as JSON", false)
|
|
264
|
-
.action((id, opts) => {
|
|
265
|
-
const input: Record<string, unknown> = {};
|
|
266
|
-
if (opts.title !== undefined) input.title = opts.title;
|
|
267
|
-
if (opts.value !== undefined) input.value = parseFloat(opts.value);
|
|
268
|
-
if (opts.currency !== undefined) input.currency = opts.currency;
|
|
269
|
-
if (opts.contactName !== undefined) input.contact_name = opts.contactName;
|
|
270
|
-
if (opts.contactEmail !== undefined) input.contact_email = opts.contactEmail;
|
|
271
|
-
if (opts.probability !== undefined) input.probability = parseInt(opts.probability);
|
|
272
|
-
if (opts.closeDate !== undefined) input.expected_close_date = opts.closeDate;
|
|
273
|
-
if (opts.notes !== undefined) input.notes = opts.notes;
|
|
274
|
-
|
|
275
|
-
const deal = updateDeal(id, input);
|
|
276
|
-
if (!deal) {
|
|
277
|
-
console.error(`Deal '${id}' not found.`);
|
|
278
|
-
process.exit(1);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (opts.json) {
|
|
282
|
-
console.log(JSON.stringify(deal, null, 2));
|
|
283
|
-
} else {
|
|
284
|
-
console.log(`Updated: ${deal.title} — ${deal.currency} ${deal.value.toFixed(2)}`);
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
|
|
288
|
-
program
|
|
289
|
-
.command("move")
|
|
290
|
-
.description("Move a deal to a different stage")
|
|
291
|
-
.argument("<id>", "Deal ID")
|
|
292
|
-
.requiredOption("--stage <id>", "Target stage ID")
|
|
293
|
-
.option("--json", "Output as JSON", false)
|
|
294
|
-
.action((id, opts) => {
|
|
295
|
-
const deal = moveDeal(id, opts.stage);
|
|
296
|
-
if (!deal) {
|
|
297
|
-
console.error(`Deal '${id}' not found.`);
|
|
298
|
-
process.exit(1);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (opts.json) {
|
|
302
|
-
console.log(JSON.stringify(deal, null, 2));
|
|
303
|
-
} else {
|
|
304
|
-
console.log(`Moved deal '${deal.title}' to stage ${deal.stage_id}`);
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
program
|
|
309
|
-
.command("close")
|
|
310
|
-
.description("Close a deal as won or lost")
|
|
311
|
-
.argument("<id>", "Deal ID")
|
|
312
|
-
.argument("<outcome>", "Outcome: won|lost")
|
|
313
|
-
.option("--json", "Output as JSON", false)
|
|
314
|
-
.action((id, outcome, opts) => {
|
|
315
|
-
if (outcome !== "won" && outcome !== "lost") {
|
|
316
|
-
console.error("Outcome must be 'won' or 'lost'.");
|
|
317
|
-
process.exit(1);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
const deal = closeDeal(id, outcome);
|
|
321
|
-
if (!deal) {
|
|
322
|
-
console.error(`Deal '${id}' not found.`);
|
|
323
|
-
process.exit(1);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
if (opts.json) {
|
|
327
|
-
console.log(JSON.stringify(deal, null, 2));
|
|
328
|
-
} else {
|
|
329
|
-
console.log(`Deal '${deal.title}' closed as ${outcome}.`);
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
program
|
|
334
|
-
.command("delete")
|
|
335
|
-
.description("Delete a deal")
|
|
336
|
-
.argument("<id>", "Deal ID")
|
|
337
|
-
.action((id) => {
|
|
338
|
-
const deleted = deleteDeal(id);
|
|
339
|
-
if (deleted) {
|
|
340
|
-
console.log(`Deleted deal ${id}`);
|
|
341
|
-
} else {
|
|
342
|
-
console.error(`Deal '${id}' not found.`);
|
|
343
|
-
process.exit(1);
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
|
|
347
|
-
// --- Activities ---
|
|
348
|
-
|
|
349
|
-
const activityCmd = program
|
|
350
|
-
.command("activity")
|
|
351
|
-
.description("Deal activity management");
|
|
352
|
-
|
|
353
|
-
activityCmd
|
|
354
|
-
.command("add")
|
|
355
|
-
.description("Add an activity to a deal")
|
|
356
|
-
.requiredOption("--deal <id>", "Deal ID")
|
|
357
|
-
.requiredOption("--description <text>", "Activity description")
|
|
358
|
-
.option("--type <type>", "Activity type: note|call|email|meeting", "note")
|
|
359
|
-
.option("--json", "Output as JSON", false)
|
|
360
|
-
.action((opts) => {
|
|
361
|
-
const activity = addActivity({
|
|
362
|
-
deal_id: opts.deal,
|
|
363
|
-
type: opts.type,
|
|
364
|
-
description: opts.description,
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
if (opts.json) {
|
|
368
|
-
console.log(JSON.stringify(activity, null, 2));
|
|
369
|
-
} else {
|
|
370
|
-
console.log(`Added ${activity.type}: ${activity.description} (${activity.id})`);
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
activityCmd
|
|
375
|
-
.command("list")
|
|
376
|
-
.description("List activities for a deal")
|
|
377
|
-
.argument("<deal-id>", "Deal ID")
|
|
378
|
-
.option("--json", "Output as JSON", false)
|
|
379
|
-
.action((dealId, opts) => {
|
|
380
|
-
const activities = listActivities(dealId);
|
|
381
|
-
|
|
382
|
-
if (opts.json) {
|
|
383
|
-
console.log(JSON.stringify(activities, null, 2));
|
|
384
|
-
} else {
|
|
385
|
-
if (activities.length === 0) {
|
|
386
|
-
console.log("No activities found.");
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
for (const a of activities) {
|
|
390
|
-
console.log(` [${a.type}] ${a.description} (${a.created_at})`);
|
|
391
|
-
}
|
|
392
|
-
console.log(`\n${activities.length} activity(ies)`);
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
program.parse(process.argv);
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Database connection for microservice-crm
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { Database } from "bun:sqlite";
|
|
6
|
-
import { existsSync, mkdirSync } from "node:fs";
|
|
7
|
-
import { dirname, join, resolve } from "node:path";
|
|
8
|
-
import { MIGRATIONS } from "./migrations.js";
|
|
9
|
-
|
|
10
|
-
let _db: Database | null = null;
|
|
11
|
-
|
|
12
|
-
function getDbPath(): string {
|
|
13
|
-
if (process.env["MICROSERVICES_DIR"]) {
|
|
14
|
-
return join(process.env["MICROSERVICES_DIR"], "microservice-crm", "data.db");
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let dir = resolve(process.cwd());
|
|
18
|
-
while (true) {
|
|
19
|
-
const msDir = join(dir, ".microservices");
|
|
20
|
-
if (existsSync(msDir)) return join(msDir, "microservice-crm", "data.db");
|
|
21
|
-
const parent = dirname(dir);
|
|
22
|
-
if (parent === dir) break;
|
|
23
|
-
dir = parent;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const home = process.env["HOME"] || process.env["USERPROFILE"] || "~";
|
|
27
|
-
return join(home, ".microservices", "microservice-crm", "data.db");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function getDatabase(): Database {
|
|
31
|
-
if (_db) return _db;
|
|
32
|
-
|
|
33
|
-
const dbPath = getDbPath();
|
|
34
|
-
const dataDir = dirname(dbPath);
|
|
35
|
-
if (!existsSync(dataDir)) {
|
|
36
|
-
mkdirSync(dataDir, { recursive: true });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
_db = new Database(dbPath);
|
|
40
|
-
_db.exec("PRAGMA journal_mode = WAL");
|
|
41
|
-
_db.exec("PRAGMA foreign_keys = ON");
|
|
42
|
-
|
|
43
|
-
_db.exec(`
|
|
44
|
-
CREATE TABLE IF NOT EXISTS _migrations (
|
|
45
|
-
id INTEGER PRIMARY KEY,
|
|
46
|
-
name TEXT NOT NULL,
|
|
47
|
-
applied_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
48
|
-
)
|
|
49
|
-
`);
|
|
50
|
-
|
|
51
|
-
const applied = _db
|
|
52
|
-
.query("SELECT id FROM _migrations ORDER BY id")
|
|
53
|
-
.all() as { id: number }[];
|
|
54
|
-
const appliedIds = new Set(applied.map((r) => r.id));
|
|
55
|
-
|
|
56
|
-
for (const migration of MIGRATIONS) {
|
|
57
|
-
if (appliedIds.has(migration.id)) continue;
|
|
58
|
-
_db.exec("BEGIN");
|
|
59
|
-
try {
|
|
60
|
-
_db.exec(migration.sql);
|
|
61
|
-
_db.prepare("INSERT INTO _migrations (id, name) VALUES (?, ?)").run(
|
|
62
|
-
migration.id,
|
|
63
|
-
migration.name
|
|
64
|
-
);
|
|
65
|
-
_db.exec("COMMIT");
|
|
66
|
-
} catch (error) {
|
|
67
|
-
_db.exec("ROLLBACK");
|
|
68
|
-
throw new Error(
|
|
69
|
-
`Migration ${migration.id} (${migration.name}) failed: ${error instanceof Error ? error.message : String(error)}`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return _db;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function closeDatabase(): void {
|
|
78
|
-
if (_db) {
|
|
79
|
-
_db.close();
|
|
80
|
-
_db = null;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
export interface MigrationEntry {
|
|
2
|
-
id: number;
|
|
3
|
-
name: string;
|
|
4
|
-
sql: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const MIGRATIONS: MigrationEntry[] = [
|
|
8
|
-
{
|
|
9
|
-
id: 1,
|
|
10
|
-
name: "initial_schema",
|
|
11
|
-
sql: `
|
|
12
|
-
CREATE TABLE IF NOT EXISTS pipelines (
|
|
13
|
-
id TEXT PRIMARY KEY,
|
|
14
|
-
name TEXT NOT NULL,
|
|
15
|
-
description TEXT,
|
|
16
|
-
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
17
|
-
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
CREATE TABLE IF NOT EXISTS stages (
|
|
21
|
-
id TEXT PRIMARY KEY,
|
|
22
|
-
pipeline_id TEXT NOT NULL REFERENCES pipelines(id) ON DELETE CASCADE,
|
|
23
|
-
name TEXT NOT NULL,
|
|
24
|
-
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
25
|
-
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
CREATE TABLE IF NOT EXISTS deals (
|
|
29
|
-
id TEXT PRIMARY KEY,
|
|
30
|
-
pipeline_id TEXT NOT NULL REFERENCES pipelines(id) ON DELETE CASCADE,
|
|
31
|
-
stage_id TEXT NOT NULL REFERENCES stages(id) ON DELETE RESTRICT,
|
|
32
|
-
title TEXT NOT NULL,
|
|
33
|
-
value REAL NOT NULL DEFAULT 0,
|
|
34
|
-
currency TEXT NOT NULL DEFAULT 'USD',
|
|
35
|
-
contact_name TEXT,
|
|
36
|
-
contact_email TEXT,
|
|
37
|
-
probability INTEGER NOT NULL DEFAULT 0,
|
|
38
|
-
expected_close_date TEXT,
|
|
39
|
-
status TEXT NOT NULL DEFAULT 'open' CHECK(status IN ('open', 'won', 'lost')),
|
|
40
|
-
notes TEXT,
|
|
41
|
-
metadata TEXT NOT NULL DEFAULT '{}',
|
|
42
|
-
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
43
|
-
updated_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
44
|
-
closed_at TEXT
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
CREATE TABLE IF NOT EXISTS deal_activities (
|
|
48
|
-
id TEXT PRIMARY KEY,
|
|
49
|
-
deal_id TEXT NOT NULL REFERENCES deals(id) ON DELETE CASCADE,
|
|
50
|
-
type TEXT NOT NULL DEFAULT 'note' CHECK(type IN ('note', 'call', 'email', 'meeting')),
|
|
51
|
-
description TEXT NOT NULL,
|
|
52
|
-
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
CREATE INDEX IF NOT EXISTS idx_stages_pipeline ON stages(pipeline_id);
|
|
56
|
-
CREATE INDEX IF NOT EXISTS idx_stages_sort ON stages(pipeline_id, sort_order);
|
|
57
|
-
CREATE INDEX IF NOT EXISTS idx_deals_pipeline ON deals(pipeline_id);
|
|
58
|
-
CREATE INDEX IF NOT EXISTS idx_deals_stage ON deals(stage_id);
|
|
59
|
-
CREATE INDEX IF NOT EXISTS idx_deals_status ON deals(status);
|
|
60
|
-
CREATE INDEX IF NOT EXISTS idx_deals_contact_email ON deals(contact_email);
|
|
61
|
-
CREATE INDEX IF NOT EXISTS idx_deals_expected_close ON deals(expected_close_date);
|
|
62
|
-
CREATE INDEX IF NOT EXISTS idx_deal_activities_deal ON deal_activities(deal_id);
|
|
63
|
-
CREATE INDEX IF NOT EXISTS idx_pipelines_name ON pipelines(name);
|
|
64
|
-
`,
|
|
65
|
-
},
|
|
66
|
-
];
|