Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+10
-10
@@ -190,17 +190,17 @@ export async function updateLeadStatus(
|
||||
const current = await db.lead.findUnique({ where: { id: leadId }, select: { status: true } });
|
||||
if (!current) return;
|
||||
if (current.status === next) return;
|
||||
await db.$transaction([
|
||||
db.lead.update({ where: { id: leadId }, data: { status: next } }),
|
||||
db.leadEvent.create({
|
||||
await db.$transaction(async (tx) => {
|
||||
await tx.lead.update({ where: { id: leadId }, data: { status: next } });
|
||||
await tx.leadEvent.create({
|
||||
data: {
|
||||
leadId,
|
||||
type: "status-changed",
|
||||
actorId,
|
||||
payload: { from: current.status, to: next } as object,
|
||||
},
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export async function appendNote(leadId: string, body: string, actorId: string | null): Promise<void> {
|
||||
@@ -215,15 +215,15 @@ export async function appendNote(leadId: string, body: string, actorId: string |
|
||||
{ body: (previous?.body as string | undefined) ?? "", at: (previous?.updatedAt as string | undefined) ?? null },
|
||||
],
|
||||
};
|
||||
await db.$transaction([
|
||||
db.lead.update({ where: { id: leadId }, data: { notes: updated as object } }),
|
||||
db.leadEvent.create({
|
||||
await db.$transaction(async (tx) => {
|
||||
await tx.lead.update({ where: { id: leadId }, data: { notes: updated as object } });
|
||||
await tx.leadEvent.create({
|
||||
data: {
|
||||
leadId,
|
||||
type: "note-added",
|
||||
actorId,
|
||||
payload: { length: body.length } as object,
|
||||
},
|
||||
}),
|
||||
]);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user