2
0

(typebotLink) Better typebot link with merge option

Closes #675
This commit is contained in:
Baptiste Arnaud
2023-08-24 07:48:30 +02:00
parent 0acede92ef
commit ee3b94c35d
59 changed files with 1147 additions and 696 deletions

View File

@@ -12,12 +12,13 @@ type Props = {
state: SessionState
}
export const upsertAnswer = async ({ answer, reply, block, state }: Props) => {
if (!state.result?.id) return
const resultId = state.typebotsQueue[0].resultId
if (!resultId) return
if (reply.includes('http') && block.type === InputBlockType.FILE) {
answer.storageUsed = await computeStorageUsed(reply)
}
const where = {
resultId: state.result.id,
resultId,
blockId: block.id,
groupId: block.groupId,
}
@@ -37,7 +38,7 @@ export const upsertAnswer = async ({ answer, reply, block, state }: Props) => {
},
})
return prisma.answer.createMany({
data: [{ ...answer, resultId: state.result.id }],
data: [{ ...answer, resultId }],
})
}