2
0

build(lib): 🔖 Update lib to 2.1.3

This commit is contained in:
Baptiste Arnaud
2022-03-04 17:00:30 +01:00
parent 93639c1fc6
commit 2a31b13cb3
3 changed files with 2 additions and 4 deletions

View File

@ -14,14 +14,12 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
})
if (!typebot) return res.status(400).send({ message: 'Typebot not found' })
const limit = Number(req.query.limit)
console.log(limit, typebot.id)
const results = (await prisma.result.findMany({
where: { typebotId: typebot.id },
orderBy: { createdAt: 'desc' },
take: limit,
include: { answers: true },
})) as unknown as ResultWithAnswers[]
console.log(results)
return res.send({
results: results.map(parseAnswers(typebot as unknown as Typebot)),
})