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,
|
||||
})),
|
||||
|
||||
@@ -95,9 +95,6 @@ export async function exportDatasetFromPrismaFor(input: { teamId: string; userId
|
||||
id: c.id,
|
||||
teamId: c.teamId,
|
||||
name: c.name,
|
||||
company: c.company ?? null,
|
||||
country: c.country ?? null,
|
||||
location: c.location ?? null,
|
||||
avatarUrl: c.avatarUrl ?? null,
|
||||
email: c.email ?? null,
|
||||
phone: c.phone ?? null,
|
||||
@@ -144,7 +141,6 @@ export async function exportDatasetFromPrismaFor(input: { teamId: string; userId
|
||||
contactIndex.push({
|
||||
id: c.id,
|
||||
name: c.name,
|
||||
company: c.company ?? null,
|
||||
lastMessageAt,
|
||||
nextEventAt,
|
||||
updatedAt: c.updatedAt,
|
||||
|
||||
@@ -509,9 +509,6 @@ async function getContacts(auth: AuthContext | null) {
|
||||
id: c.id,
|
||||
name: c.name,
|
||||
avatar: c.avatarUrl ?? "",
|
||||
company: c.company ?? "",
|
||||
country: c.country ?? "",
|
||||
location: c.location ?? "",
|
||||
channels: Array.from(channelsByContactId.get(c.id) ?? []),
|
||||
lastContactAt: c.messages[0]?.occurredAt?.toISOString?.() ?? c.updatedAt.toISOString(),
|
||||
description: c.note?.content ?? "",
|
||||
@@ -706,7 +703,7 @@ async function getDeals(auth: AuthContext | null) {
|
||||
const dealsRaw = await prisma.deal.findMany({
|
||||
where: { teamId: ctx.teamId },
|
||||
include: {
|
||||
contact: { select: { name: true, company: true } },
|
||||
contact: { select: { name: true } },
|
||||
steps: { orderBy: [{ order: "asc" }, { createdAt: "asc" }] },
|
||||
},
|
||||
orderBy: { updatedAt: "desc" },
|
||||
@@ -717,7 +714,6 @@ async function getDeals(auth: AuthContext | null) {
|
||||
id: d.id,
|
||||
contact: d.contact.name,
|
||||
title: d.title,
|
||||
company: d.contact.company ?? "",
|
||||
stage: d.stage,
|
||||
amount: d.amount ? String(d.amount) : "",
|
||||
nextStep: d.nextStep ?? "",
|
||||
@@ -1999,9 +1995,6 @@ export const crmGraphqlSchema = buildSchema(`
|
||||
id: ID!
|
||||
name: String!
|
||||
avatar: String!
|
||||
company: String!
|
||||
country: String!
|
||||
location: String!
|
||||
channels: [String!]!
|
||||
lastContactAt: String!
|
||||
description: String!
|
||||
@@ -2054,7 +2047,6 @@ export const crmGraphqlSchema = buildSchema(`
|
||||
id: ID!
|
||||
contact: String!
|
||||
title: String!
|
||||
company: String!
|
||||
stage: String!
|
||||
amount: String!
|
||||
nextStep: String!
|
||||
|
||||
Reference in New Issue
Block a user