fix(crm): include missing columns in CSV/XML lead exports and fetch only latest execution per lead
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- nextjs, postgresql, typescript
調査の方向性
Start with getLeads in apps/api/src/crm/crm.service.ts and the export field definitions and CSV/XML methods in apps/api/src/crm/services/crm-export.service.ts. Trace how lead enrichment supplies the five named export columns and how automation executions are selected. Done means CSV/XML exports include those values with batched, capped processing, and the leads page fetches only the latest execution per lead.
索引モデルが issue の本文から書いたものです。
説明
Problem Description
In apps/api/src/crm/crm.service.ts (getLeads), there are two issues:
-
CSV / XML exports are missing 5 columns and have no row limit (lines 128-189):
- When exporting leads (
?export=csvor?export=xml),getLeadsonly loads basic lead profiles andcontactCapturerecords. - It skips loading
conversation,automationExecution, andaudienceListMembers- so Origin Automation, Origin Folder, Audience List, In Sales Chat, and Conversation Stage all come out blank in the downloaded file. - It also loads every lead at once with no
takelimit, which can crash or time out on large accounts (10k+ leads).
- When exporting leads (
-
CRM Leads page loads too much old automation history (lines 244-270):
- For the leads shown on the page,
automationExecution.findManyloads every past automation run (including the fullautomation.nodesflow JSON), even though the code only uses the latest 1 run per lead.
- For the leads shown on the page,
Expected Behavior
- CSV and XML exports include Origin Automation, Origin Folder, Audience List, In Sales Chat, and Conversation Stage, and process/cap large exports safely so the server doesn't run out of memory.
- The CRM Leads page only fetches the latest 1
automationExecutionper lead instead of all historical runs.
Where to Look
apps/api/src/crm/crm.service.ts(getLeads, lines 128-270)apps/api/src/crm/services/crm-export.service.ts(getExportFieldDefinitions,exportAsCSV,exportAsXML)
Solution / Implementation Guide
- Fetch only the latest run per lead (
crm.service.ts):- Add
distinct: ['instagramUserId']toprisma.automationExecution.findMany(it is already sorted bystartedAt: 'desc', so Postgres will return only the newest execution per user).
- Add
- Reuse the enrichment logic for CSV/XML exports:
- Extract a small helper to enrich leads with
contactCapture,conversation, latestautomationExecution, andaudienceListMembers. - Use it in the export path too, fetching in batches (e.g., 500-1,000 leads at a time, with a safe max export cap like 10,000 rows).
- Extract a small helper to enrich leads with
- 主要言語
- TypeScript
- スター
- 2
- フォーク
- 1
- 平均マージ
- 6分
- マージ済み PR(30日)
- 27
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sumamakhan761/tryinstance のほかの issue
-
backend good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sumamakhan761/tryinstance#65 ·
メンテナーはふだん 1 日以内に返信
-
backend good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
sumamakhan761/tryinstance#64 ·
メンテナーはふだん 1 日以内に返信
-
backend good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
sumamakhan761/tryinstance#63 ·
メンテナーはふだん 1 日以内に返信
-
backend good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sumamakhan761/tryinstance#62 ·
メンテナーはふだん 1 日以内に返信
-
backend good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sumamakhan761/tryinstance#60 ·
メンテナーはふだん 1 日以内に返信
sumamakhan761/tryinstance の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
makecindy/cindy#15342 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
kwitsch/claude-code-plugin-tooling#219 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
no-repo-link tool-submission
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100