Aydrian Howard
07/06/2022, 1:25 PMimport type { CartItem } from "@prisma/client";
, that type doesn't include the product fields. Here is my query:
const items = await db.cartItem.findMany({
select: { id: true, product: { select: { name: true, price: true } } },
where: { userId }
});
Thanksnikolasburk
import { Prisma } from '@prisma/client'
type CartItemWithProduct = Prisma.CartItemGetPayload<{
select: {
id: true,
product: {
select: {
name: true,
price: true
}
}
}
}>
Aydrian Howard
07/06/2022, 1:47 PMnikolasburk
nikolasburk
Aydrian Howard
07/06/2022, 2:18 PM