Ashiqur Rahman
07/11/2020, 11:59 AMif (testUser.roles.includes('ADMIN')) {
return prisma.user.findMany({
take,
skip,
include: { posts: true },
where: { roles: 'USER' },
});
}
How can I filter roles property in where selector. [roles is an array]Stefan Trivuncic
07/12/2020, 2:00 AMUser has an assigned role, you can just use the findMany method and filter for all the users who have the role ADMIN. How have you structured your User model?