Mohamed Lamine
Mohamed Lamine
PPrisma
Created by Mohamed Lamine on 7/28/2024 in #help-and-questions
Why methods of a service not working when $use is used?
No description
4 replies
PPrisma
Created by Mohamed Lamine on 7/28/2024 in #help-and-questions
Why methods of a service not working when $use is used?
Hello @RaphaelEtim thanks for your reply. It seems the (bad) way I implemented it make that this middleware ($use) is going to run every single time I do prisma.whatever.whatever i.e anytime I do a query. So it's normal for findMany to be impacted by the middleware. So I add the following line of code out of the if statement: return next(params); . This ensure that others queries e.g findMany proceed normally when conditions are not met/satisfied.
4 replies