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 = {
|
2023-08-29 10:01:28 +02:00
|
|
|
id?: string
|
2023-07-18 14:31:20 +02:00
|
|
|
state: SessionState
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-06 15:08:57 +02:00
|
|
|
export const createSession = ({
|
|
|
|
|
id,
|
|
|
|
|
state,
|
|
|
|
|
}: Props): Prisma.PrismaPromise<any> =>
|
2023-07-18 14:31:20 +02:00
|
|
|
prisma.chatSession.create({
|
|
|
|
|
data: {
|
2023-08-29 10:01:28 +02:00
|
|
|
id,
|
2023-07-18 14:31:20 +02:00
|
|
|
state,
|
|
|
|
|
},
|
|
|
|
|
})
|