return ctx.prisma.product.findMany({ include: { price: { select: { contractor: group === "CONTRACTOR", customer: group === "CUSTOMER", frequent: group === "FREQUENT", professional: group === "PROFESSIONAL", vip: group === "VIP", visitor: group === "VISITOR", }, }, }, });
return ctx.prisma.product.findMany({ include: { price: { select: { contractor: group === "CONTRACTOR", customer: group === "CUSTOMER", frequent: group === "FREQUENT", professional: group === "PROFESSIONAL", vip: group === "VIP", visitor: group === "VISITOR", }, }, }, });
I have the following return and I want to infer the types of a single item, before I added the include bit the code worked, but now it gives me an error, how to set it up correctly?
I thought this might be the problem but even if I just have a price: true the error is the same, I dont need it to tell me what pricing is there, I just dont want it sent to the user, it pretty much just have every price as number | undefined which is fine by me
Prisma Client provides full type safety for queries, even for partial queries or included relations. This page explains how to leverage the generated types and utilities.
Bug description Our backend API has routes where we can optionally perform what the include API does. For example fetch user and optionally include posts written by this user. I expect the inferred...