Node.js sequence associations, include subject

Is it possible to pass a condition to the findAll query include array?

For example, I have UsersModel, PostsModel and UserVotesModel.

Users can vote on their posts.

For a registered user, I want to request messages and only include voting for the current user. I cannot do this using Sequelize include param. Sequelize combines posts and UserVotes in postId, but for this particular request I want to join both postId and UserId.

Any ideas how to solve this problem?

+4
source share
1 answer

I just checked Sequelize source code. It's impossible!

0
source

Source: https://habr.com/ru/post/1483865/


All Articles