hey, what is the reason that WhereUniqueInput does...
# orm-help
v
hey, what is the reason that WhereUniqueInput does not support additional parameters to further limit the scope? https://github.com/prisma/prisma/issues/10376 Seems like a major limitation in the prisma api.
Allowing optional parameters for limiting the scope would be a major DX improvement. It would enable some parts of the code to be fully declarative while now it requires multiple prisma queries and imperative checks. e.g permission checks would become a lot simpler. And it would apply to fetching data, updating & creating data too.
l
How can you limit the scope of a WhereUnique-query? It already assumes you have the id.
v
You have the id, but you might want to also ensure that the user has access to that resource, for example. So it would require you to pass the id, but also allow you to pass in the user id. These are not equal: If you pass in the wrong user id along the id, you would not get the result.
So the query should ensure the unique id, but also allow the rest as optional parameters.
l
An interesting suggestion, but you can also do this query using the non-unique variants?
v
Yeah sure, but that would be a workaround which is suboptimal. Do you think there's a reason not to allow optional extra parameters for unique queries to further limit the scope?
n
Hey Ville 👋 Thank you for the suggestion! We do plan to support additional parameters in
WhereUniqueInput
but don’t have a definite timeline yet.
v
That's great to hear @Nurul! It would be a great addition. Now the permission checks always needs to be done in a separate query which causes unnecessary extra complexity. Allowing it would enable many parts of the code to be fully declarative.
🙌 1