When checking out the typings for the update method in Prisma ORM, I found that I can only include a where clause for unique fields:
return this.prisma.publication.update({
data,
where: {id},
});
I'd love to combine this with authentication and do something like:
return this.prisma.publication.update({
data,
where: {id, owner: user.id}, <-- Authorisation
});
Is this at all possible with Prisma or do I need a separate query for this that retrieves the instance?
In this case, you would need to use updateMany as you are using a non-unique field along with the unique one.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.