Use Prisma's Fluent Api
singerla opened this issue · 2 comments
singerla commented
I was wondering if it is somehow possible to use Prisma's Fluent Api.
While this works with prisma-mock
:
client = createPrismaMock({}, Prisma.dmmf.datamodel);
await client.category.create({
data: {
id: 1,
name: 'cat 1',
},
});
await client.tag.create({
data: {
id: 1,
name: 'tag 1',
categoryId: 1,
},
});
// Nested tags are returned properly:
const tmp = await client.category.findUnique({
where: {
id: 1,
},
include: {
tags: true,
},
});
but this will throw ....findUnique(...).tags is not a function
:
const tmp = await this.prisma.category.findUnique({
where: {
id: 1,
},
}).tags();
Thanks in advance for an answer & thanks a lot for this very useful library!
stijnvanderlaan commented
Hi @singerla Thank you! That is a good question. Unfortunatly no it is indeed not yet supported.