How to solve this in Prisma, count related entries of complex query - Prisma