16
packages/bot-engine/queries/saveSetVariableHistoryItems.ts
Normal file
16
packages/bot-engine/queries/saveSetVariableHistoryItems.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import prisma from '@typebot.io/lib/prisma'
|
||||
import { Prisma } from '@typebot.io/prisma'
|
||||
import { SetVariableHistoryItem } from '@typebot.io/schemas'
|
||||
|
||||
export const saveSetVariableHistoryItems = (
|
||||
setVariableHistory: SetVariableHistoryItem[]
|
||||
) =>
|
||||
prisma.setVariableHistoryItem.createMany({
|
||||
data: {
|
||||
...setVariableHistory.map((item) => ({
|
||||
...item,
|
||||
value: item.value === null ? Prisma.JsonNull : item.value,
|
||||
})),
|
||||
},
|
||||
skipDuplicates: true,
|
||||
})
|
||||
Reference in New Issue
Block a user