Is there a way to import a type from a Prisma Model on Client
I know that we have inferRouterInputs and inferRouterOutputs, but I dont feel that is what I need.
TRPC provides a way to generate a type from model? or the right only way is literally the output?
13 Replies
Can you rephrase your question? I dont understand what your actually asking
a prisma model?
oh jeez I forgot about mention Prisma - sorry. but yes!
that's literally it!
thank you brodher
![t3ggLove](https://cdn.discordapp.com/emojis/1008231483233808426.png)
enjoying the contact fella, do you know well prisma? I want to create a query that connects to an another model from a many to many and I'm struggling
this is my models and I want to query an item and include the category it has by searching on the many to many ItemCategory
![](https://utfs.io/f/d81f2a16-3d04-4083-b4c2-7707eb7d8579-1nq2cb.png)
would return
Prisma
Relation queries (Concepts)
Prisma Client provides convenient queries for working with relations, such as a fluent API, nested writes (transactions), nested reads and relation filters.
ohh boy, I need to start to explain better my questions lol
thank you! it's almost that
Ive found this article from Prisma Docs before but what I really want is almost that;
by doing that I will get all the register I have from the model ItemCategory that's my control table.
what I really need is a list of the category itself!
The final result I would like to have would be something
![thinkies](https://cdn.discordapp.com/emojis/1079301291295121488.png)
{
id: string,
name: string,
//...
categories: {
id: string,
name: string,
// values from the Category model
}
}
and btw including this category on the Item query it have stopped to retrieve the rest of the item data, it seems they all are set to false. ![thinkies](https://cdn.discordapp.com/emojis/1079301291295121488.png)
I can workaround my need with that but I still think there's a way to make it in one query
![](https://utfs.io/f/1713728e-e883-4059-8f14-9eed3f6617fd-1nq2cb.png)
I still dont know exactly what you want to be honest
I think you want the item + all the categories for that item
Im pretty sure the first thing I wrote (what im replying to) works as well
but this is basically what you just wrote out
its because the first query (the one you wrote first) doesnt provide the category itself and the ids of them