2
0

🧐 Add exportResults script

This commit is contained in:
Baptiste Arnaud
2024-01-12 10:16:01 +01:00
parent 5d088b1e64
commit 69b113fc85
32 changed files with 319 additions and 332 deletions

View File

@ -1,5 +1,4 @@
import prisma from '@typebot.io/lib/prisma'
import { getDefinedVariables } from '@typebot.io/lib/results'
import { TypebotInSession } from '@typebot.io/schemas'
type Props = {
@ -27,7 +26,7 @@ export const createResultIfNotExist = async ({
typebotId: typebot.id,
isCompleted: isCompleted ? true : false,
hasStarted,
variables: getDefinedVariables(typebot.variables),
variables: typebot.variables,
},
],
})

View File

@ -1,6 +1,6 @@
import prisma from '@typebot.io/lib/prisma'
import { getDefinedVariables } from '@typebot.io/lib/results'
import { TypebotInSession } from '@typebot.io/schemas'
import { filterVariablesWithValues } from '@typebot.io/variables/filterVariablesWithValues'
type Props = {
resultId: string
@ -18,7 +18,7 @@ export const upsertResult = async ({
where: { id: resultId },
select: { id: true },
})
const variablesWithValue = getDefinedVariables(typebot.variables)
const variablesWithValue = filterVariablesWithValues(typebot.variables)
if (existingResult) {
return prisma.result.updateMany({