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
Post a Comment