PrismaP
Prisma2y ago
5 replies
fotoflo

How to get the type of a compound query?

how would i get the type of this?

ts 
const commentsPromise = prisma.urlComments.findMany({
    where: {
      urlId,
    },
    include: {
      User: {
        select: {
          name: true,
          email: true,
          image: true,
        },
      },
    },
    orderBy: {
      createdAt: "desc",
    },
  });

  const statusCheckPromise = prisma.statusChecks.findMany({
    where: {
      urlId,
      httpCode: {
        notIn: [200, 301, 302, 303, 307, 308],
      },
    },
    orderBy: {
      createdAt: "desc",
    },
  });

  const [comments, statusChecks] = await prisma.$transaction([
    commentsPromise,
    statusCheckPromise,
  ]);
Was this page helpful?