node.js - How i can merge two query in one findAndCount in sequelize? -


need make 1 findandcount() 2 partially different query

userid comes param, , return result depending on whether param buyerid in order or contained sellerid in good

models.order.findandcountall({     distinct: true,     limit,     offset,     where: {       archived: 1,       buyerid: userid,     },     include: [{       model: models.good,       where: { type: 'lineup' },       as: 'good',       include: userinclude     }]   }); 

and

models.order.findandcountall({     distinct: true,     limit,     offset,     where: {       archived: 1,     },     include: [{       model: models.good,       where: { type: 'lineup', sellerid: userid },       as: 'good',       include: userinclude     }]   }); 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -