fivewen
fivewen
PPrisma
Created by fivewen on 5/26/2024 in #help-and-questions
How to create Prisma Client's generated types with nested models?
One more question, how should I nest when it has a self-relationship? For example, I want to implement a comment type where comment has replies mapped which is a list of comments. So far, this is what I have:
const commentWithRelations = Prisma.validator<Prisma.CommentDefaultArgs>()({
include: {
replies : true,
author: {
include : {
user: true
}
}
},
})
const commentWithRelations = Prisma.validator<Prisma.CommentDefaultArgs>()({
include: {
replies : true,
author: {
include : {
user: true
}
}
},
})
5 replies
PPrisma
Created by fivewen on 5/26/2024 in #help-and-questions
How to create Prisma Client's generated types with nested models?
Worked like a charm. That's intuitive, thanks!
5 replies