Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- models.Convos.findAll({
- include: [
- {
- model: models.Messages,
- as: "last_message",
- order: [ [ 'created_at', 'DESC' ]],
- limit: 1,
- }
- ],
- where:{
- [Op.or]: [
- {
- sender_id: req.decoded.id
- },
- {
- recipient_id: req.decoded.id
- }
- ],
- },
- )}
- order: [
- [{model: models.Messages, as: 'last_message'}, 'created_at', 'DESC'],
- ],
- `Unhandled rejection SequelizeDatabaseError: missing FROM-clause entry for table "last_message"`
- Sequelize.literal("`last_message`.`id` IS NOT NULL")
- '$models.Messages.id$': { [Op.ne]: null },
- Sequelize.fn("COUNT", Sequelize.col("last_message")): { [Op.gt]: 0 }
- '$last_message.id$': { [Op.ne]: null }
- $last_message.id$`: {
- [Op.ne]: null
- }
- having: Sequelize.where(Sequelize.fn('COUNT', Sequelize.col('$last_message.id$')), '>=', 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement