Benjamin Smith
02/10/2022, 7:16 PMconst [nResponses, nPromoters, nDetractors] = await prisma.$transaction([
prisma.response.count({
where: {
campaignId
}
}),
prisma.response.count({
where: {
campaignId,
score: {
gte: 9
}
}
}),
prisma.response.count({
where: {
campaignId,
score: {
lte: 6
}
}
})
]);
Benjamin Smith
02/10/2022, 7:18 PMawait prisma.response.aggregate({
where: {
campaignId
},
_count: [
{ _all: true },
{ score: { gte: 9 } },
{ score: { lte: 6 } }
}
});
But I don't think Prisma's API supports it