2
0

♻️ Introduce typebot v6 with events (#1013)

Closes #885
This commit is contained in:
Baptiste Arnaud
2023-11-08 15:34:16 +01:00
committed by GitHub
parent 68e4fc71fb
commit 35300eaf34
634 changed files with 58971 additions and 31449 deletions

View File

@@ -4,18 +4,16 @@ import { InputBlock, SessionState } from '@typebot.io/schemas'
type Props = {
answer: Omit<Prisma.AnswerUncheckedCreateInput, 'resultId'>
block: InputBlock
reply: string
itemId?: string
state: SessionState
}
export const upsertAnswer = async ({ answer, block, state }: Props) => {
export const upsertAnswer = async ({ answer, state }: Props) => {
const resultId = state.typebotsQueue[0].resultId
if (!resultId) return
const where = {
resultId,
blockId: block.id,
groupId: block.groupId,
blockId: answer.blockId,
groupId: answer.groupId,
}
const existingAnswer = await prisma.answer.findUnique({
where: {
@@ -28,7 +26,6 @@ export const upsertAnswer = async ({ answer, block, state }: Props) => {
where,
data: {
content: answer.content,
itemId: answer.itemId,
},
})
return prisma.answer.createMany({