2
0
Files
bot/packages/bot-engine/queries/setChatSessionHasReplying.ts

21 lines
491 B
TypeScript
Raw Normal View History

import prisma from '@typebot.io/lib/prisma'
type Props = {
existingSessionId: string | undefined
newSessionId: string
}
export const setChatSessionHasReplying = async ({
existingSessionId,
newSessionId,
}: Props) => {
if (existingSessionId) {
return prisma.chatSession.updateMany({
where: { id: existingSessionId },
data: { isReplying: true },
})
}
return prisma.chatSession.createMany({
data: { id: newSessionId, isReplying: true, state: {} },
})
}