2023-09-20 15:26:52 +02:00
|
|
|
import prisma from '@typebot.io/lib/prisma'
|
2024-04-06 15:08:57 +02:00
|
|
|
import { Prisma } from '@typebot.io/prisma'
|
2023-07-18 14:31:20 +02:00
|
|
|
import { SessionState } from '@typebot.io/schemas'
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
id: string
|
|
|
|
|
state: SessionState
|
2024-04-24 16:11:06 +02:00
|
|
|
isReplying: boolean | undefined
|
2023-07-18 14:31:20 +02:00
|
|
|
}
|
|
|
|
|
|
2024-04-06 15:08:57 +02:00
|
|
|
export const updateSession = ({
|
|
|
|
|
id,
|
|
|
|
|
state,
|
2024-04-18 09:38:22 +02:00
|
|
|
isReplying,
|
2024-04-06 15:08:57 +02:00
|
|
|
}: Props): Prisma.PrismaPromise<any> =>
|
2023-07-18 14:31:20 +02:00
|
|
|
prisma.chatSession.updateMany({
|
|
|
|
|
where: { id },
|
|
|
|
|
data: {
|
|
|
|
|
state,
|
2024-04-18 09:38:22 +02:00
|
|
|
isReplying,
|
2023-07-18 14:31:20 +02:00
|
|
|
},
|
|
|
|
|
})
|