fix(crm): include missing columns in CSV/XML lead exports and fetch only latest execution per lead
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- nextjs, postgresql, typescript
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 2
- Fork
- 1
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sumamakhan761/tryinstance
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#65 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
sumamakhan761/tryinstance#64 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
sumamakhan761/tryinstance#63 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#62 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
backend good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sumamakhan761/tryinstance#60 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của sumamakhan761/tryinstance
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
makecindy/cindy#15342 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
kwitsch/claude-code-plugin-tooling#219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
no-repo-link tool-submission
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100