HI! When you want to filter by roles, you need to add the condition inside the ‘where’ clause, but the ‘where’ clause of the ‘user’ not the ‘profile’.
However, the roles field in the User model is defined as an array of Role, and Prisma does not support filtering by array fields directly, especially when using the enum type.
The are a few solutions:
Change the database schemma: Instead of using an array field you could change your db schema to use a junction table to represent the many to many relationship between users and roles, this would allow you to query the relationship table directly papu.
Filter in memory fetching the data: You could fetch all the profiles where ‘isOpentoWork’ is true and then filter in memory yto keep only the profiles where the user’s roles include ‘Candidate’
Remember the first solution is the best in long term because it leveranges the db for what it does best " querying data", I hope to help u I’m not a native English speaker so sorry for my writing skills