remove contact company/country/location across db and ui
This commit is contained in:
@@ -10,7 +10,6 @@ import type { ChangeSet } from "../utils/changeSet";
|
||||
type ContactIndexRow = {
|
||||
id: string;
|
||||
name: string;
|
||||
company: string | null;
|
||||
lastMessageAt: string | null;
|
||||
nextEventAt: string | null;
|
||||
updatedAt: string;
|
||||
@@ -108,9 +107,8 @@ async function readJsonl(p: string): Promise<any[]> {
|
||||
}
|
||||
|
||||
function formatContactLine(c: ContactIndexRow) {
|
||||
const company = c.company ? ` (${c.company})` : "";
|
||||
const lastAt = c.lastMessageAt ? new Date(c.lastMessageAt).toLocaleString("ru-RU") : "нет";
|
||||
return `- ${c.name}${company} · последнее: ${lastAt}`;
|
||||
return `- ${c.name} · последнее: ${lastAt}`;
|
||||
}
|
||||
|
||||
export async function runCrmAgent(userText: string): Promise<AgentReply> {
|
||||
@@ -227,7 +225,7 @@ export async function runCrmAgentFor(
|
||||
lines.push("");
|
||||
lines.push("Фокус дня (если нужно добить прогресс):");
|
||||
for (const c of followups) {
|
||||
lines.push(`- Написать follow-up: ${c.name}${c.company ? ` (${c.company})` : ""}`);
|
||||
lines.push(`- Написать follow-up: ${c.name}`);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -184,7 +184,7 @@ async function buildCrmSnapshot(input: SnapshotOptions) {
|
||||
orderBy: { updatedAt: "desc" },
|
||||
take: 20,
|
||||
include: {
|
||||
contact: { select: { name: true, company: true } },
|
||||
contact: { select: { name: true } },
|
||||
steps: { select: { id: true, title: true, status: true, dueAt: true, order: true, completedAt: true }, orderBy: [{ order: "asc" }, { createdAt: "asc" }] },
|
||||
},
|
||||
}),
|
||||
@@ -247,15 +247,11 @@ async function buildCrmSnapshot(input: SnapshotOptions) {
|
||||
updatedAt: iso(d.updatedAt),
|
||||
contact: {
|
||||
name: d.contact.name,
|
||||
company: d.contact.company,
|
||||
},
|
||||
})),
|
||||
contacts: contacts.map((c) => ({
|
||||
id: c.id,
|
||||
name: c.name,
|
||||
company: c.company,
|
||||
country: c.country,
|
||||
location: c.location,
|
||||
email: c.email,
|
||||
phone: c.phone,
|
||||
avatarUrl: c.avatarUrl,
|
||||
@@ -549,7 +545,6 @@ export async function runLangGraphCrmAgentFor(input: {
|
||||
? {
|
||||
OR: [
|
||||
{ name: { contains: q } },
|
||||
{ company: { contains: q } },
|
||||
{ email: { contains: q } },
|
||||
{ phone: { contains: q } },
|
||||
],
|
||||
@@ -593,9 +588,6 @@ export async function runLangGraphCrmAgentFor(input: {
|
||||
items: items.map((c) => ({
|
||||
id: c.id,
|
||||
name: c.name,
|
||||
company: c.company,
|
||||
country: c.country,
|
||||
location: c.location,
|
||||
email: c.email,
|
||||
phone: c.phone,
|
||||
summary: c.note?.content ?? null,
|
||||
@@ -711,9 +703,6 @@ export async function runLangGraphCrmAgentFor(input: {
|
||||
contact: {
|
||||
id: contact.id,
|
||||
name: contact.name,
|
||||
company: contact.company,
|
||||
country: contact.country,
|
||||
location: contact.location,
|
||||
email: contact.email,
|
||||
phone: contact.phone,
|
||||
updatedAt: contact.updatedAt.toISOString(),
|
||||
@@ -790,7 +779,7 @@ export async function runLangGraphCrmAgentFor(input: {
|
||||
orderBy: { startsAt: "asc" },
|
||||
skip: offset,
|
||||
take: limit,
|
||||
include: { contact: { select: { id: true, name: true, company: true } } },
|
||||
include: { contact: { select: { id: true, name: true } } },
|
||||
}),
|
||||
]);
|
||||
|
||||
@@ -817,7 +806,6 @@ export async function runLangGraphCrmAgentFor(input: {
|
||||
? {
|
||||
id: e.contact.id,
|
||||
name: e.contact.name,
|
||||
company: e.contact.company,
|
||||
}
|
||||
: null,
|
||||
})),
|
||||
|
||||
Reference in New Issue
Block a user