Skip to content

Commit

Permalink
馃 Add deleteChatSession script
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 2, 2024
1 parent 60f3b13 commit fee6b2d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
28 changes: 28 additions & 0 deletions packages/scripts/deleteChatSession.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { PrismaClient } from '@typebot.io/prisma'
import { promptAndSetEnvironment } from './utils'
import * as p from '@clack/prompts'

const deleteChatSession = async () => {
await promptAndSetEnvironment('production')

const id = await p.text({
message: 'Session ID?',
})

if (!id || typeof id !== 'string') {
console.log('No ID provided')
return
}

const prisma = new PrismaClient()

const chatSession = await prisma.chatSession.delete({
where: {
id,
},
})

console.log(JSON.stringify(chatSession, null, 2))
}

deleteChatSession()
3 changes: 2 additions & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"redeemCoupon": "tsx redeemCoupon.ts",
"exportResults": "tsx exportResults.ts",
"updateUserEmail": "tsx updateUserEmail.ts",
"inspectChatSession": "tsx inspectChatSession.ts"
"inspectChatSession": "tsx inspectChatSession.ts",
"deleteChatSession": "tsx deleteChatSession.ts"
},
"devDependencies": {
"@typebot.io/emails": "workspace:*",
Expand Down

0 comments on commit fee6b2d

Please sign in to comment.