2
0

🧐 Add more data inspection scripts

This commit is contained in:
Baptiste Arnaud
2024-01-08 13:47:23 +01:00
parent 244a29423b
commit 3775919543
3 changed files with 85 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
import { PrismaClient } from '@typebot.io/prisma'
import { promptAndSetEnvironment } from './utils'
import * as p from '@clack/prompts'
const getCoupon = async () => {
await promptAndSetEnvironment('production')
const val = (await p.text({
message: 'Enter coupon code',
})) as string
const prisma = new PrismaClient({
log: [{ emit: 'event', level: 'query' }, 'info', 'warn', 'error'],
})
const coupon = await prisma.coupon.findFirst({
where: {
code: val,
},
})
if (!coupon) {
console.log('Coupon not found')
return
}
console.log(JSON.stringify(coupon, null, 2))
}
getCoupon()