Is it possible to pass a condition in the include array of a findAll query?
For example I have UsersModel, PostsModel and UserVotesModel.
Users can vote on posts.
For the logged in user I want to query posts and include only the vote for the current user. I am not able to do this using Sequelize's include param. Sequelize joins posts and UserVotes on postId, but for this specific query I want to join on both postId and UserId.
Any ideas how to solve this problem?
I just checked Sequelize source code. This is not possible!