2
0

(setVariable) Add Transcription system var (#1507)

Closes #1484
This commit is contained in:
Baptiste Arnaud
2024-05-15 14:24:55 +02:00
committed by GitHub
parent ec7ff8d9ca
commit 40f21203b5
102 changed files with 2911 additions and 986 deletions

View File

@@ -2,6 +2,7 @@ import { Prisma, PrismaClient } from '@typebot.io/prisma'
import { Block, Typebot } from '@typebot.io/schemas'
import { deleteFilesFromBucket } from '@typebot.io/lib/s3/deleteFilesFromBucket'
import { InputBlockType } from '@typebot.io/schemas/features/blocks/inputs/constants'
import { isDefined } from '@typebot.io/lib'
type ArchiveResultsProps = {
typebot: Pick<Typebot, 'groups'>
@@ -42,6 +43,7 @@ export const archiveResults =
},
select: {
id: true,
lastChatSessionId: true,
},
take: batchSize,
})
@@ -76,6 +78,30 @@ export const archiveResults =
resultId: { in: resultIds },
},
}),
prisma.answerV2.deleteMany({
where: {
resultId: { in: resultIds },
},
}),
prisma.visitedEdge.deleteMany({
where: {
resultId: { in: resultIds },
},
}),
prisma.setVariableHistoryItem.deleteMany({
where: {
resultId: { in: resultIds },
},
}),
prisma.chatSession.deleteMany({
where: {
id: {
in: resultsToDelete
.map((r) => r.lastChatSessionId)
.filter(isDefined),
},
},
}),
prisma.result.updateMany({
where: {
id: { in: resultIds },