require contactId for contact summary updates
This commit is contained in:
@@ -795,13 +795,16 @@ export async function runLangGraphCrmAgentFor(input: {
|
||||
}
|
||||
|
||||
if (raw.action === "updateContactSummary") {
|
||||
const contactName = (raw.contact ?? "").trim();
|
||||
const contactId = (raw.contactId ?? "").trim();
|
||||
const content = (raw.summary ?? raw.content ?? "").trim();
|
||||
if (!contactName) throw new Error("contact is required");
|
||||
if (!contactId) throw new Error("contactId is required");
|
||||
if (!content) throw new Error("summary is required");
|
||||
|
||||
const contact = await resolveContact(input.teamId, contactName);
|
||||
if (!contact) throw new Error("contact not found");
|
||||
const contact = await prisma.contact.findFirst({
|
||||
where: { id: contactId, teamId: input.teamId },
|
||||
select: { id: true, name: true },
|
||||
});
|
||||
if (!contact) throw new Error("contactId not found");
|
||||
await prisma.contactNote.upsert({
|
||||
where: { contactId: contact.id },
|
||||
update: { content },
|
||||
|
||||
Reference in New Issue
Block a user