Я пытаюсь использовать замены с запросом sequelize.literal ().
router.get('/posts/testapik', function(req, res)
{
const user_id = req.session.user_id;
const status ="accept"
Posts.findAll({include:[{ model: Likes},{ model: Comments},{ model: Users}],
where:{user_id:{[Op.in]:[sequelize.literal('SELECT `Follows`.receiver_id FROM `follows` AS `Follows` WHERE `Follows`.user_id=? and `Follows`.status=?',{ replacements: [user_id,status], type: sequelize.QueryTypes.SELECT })]}}
})
.then(users =>
{
res.send(users);
})
});
Но он возвращает следующую ошибку
original:
{ Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '? and `Follows`.status=?)' at line 1