PrismaP
Prisma2y ago
4 replies
fivewen

How to create Prisma Client's generated types with nested models?

Hi guys,
I am currently trying to define generate model types using Prisma.validator to include relations.

I've followed this documentation: https://www.prisma.io/docs/orm/prisma-client/type-safety/operating-against-partial-structures-of-model-types#problem-using-variations-of-the-generated-model-type

However, I am confused how I can set up with model with nested models.

For example, I have a Post that has UserSocial Model. In addition, UserSocial has 1 to 1 relationship with User model.

I want to generate a PostWithUserSocial but also has the nested User model included.

Does anyone know how I can achieve this?
This page documents various scenarios for using the generated types from the Prisma namespace
Operating against partial structures of your model types | Prisma D...
Was this page helpful?