2
0
Files
bot/apps/viewer/src/features/chat/helpers/getSessionState.ts
2023-03-15 12:21:52 +01:00

13 lines
392 B
TypeScript

import prisma from '@/lib/prisma'
import { ChatSession } from '@typebot.io/schemas'
export const getSession = async (
sessionId: string
): Promise<Pick<ChatSession, 'state' | 'id'> | null> => {
const session = (await prisma.chatSession.findUnique({
where: { id: sessionId },
select: { id: true, state: true },
})) as Pick<ChatSession, 'state' | 'id'> | null
return session
}