Ayuda a resolver el problema. La tabla contiene los campos precio y cantidad. Uno de los parámetros de filtrado en la solicitud es el costo. Cómo escribir correctamente y bellamente el filtrado por el parámetro de costo usando Sequilize:
const DESC = query.desc ? 'DESC' : 'ASC'; const where = { ...(query.square_from && { square_feet: { [Op.gte]: query.square_from, }, }), ...(query.square_to && { square_feet: { [Op.lte]: query.square_to, }, }), //?????????????????????????????????????????????????????????? ...(query.total_price_from && Sequelize.where(Sequelize.literal('token_price*lot_size'), { [Op.gte]: query.total_price_from, })), //????????????????????????????????????????????????????????? }; return await this.propertySchema.findAndCountAll({ where, attributes: { exclude: ['createdAt', 'updatedAt'] }, order: [[query.orderby, DESC]], limit: PROPERTIES_BY_PAGE, offset: +(query.page - 1) * PROPERTIES_BY_PAGE, distinct: true, include: [ { model: Files, attributes: { exclude: ['createdAt', 'updatedAt'] }, through: { attributes: ['is_main'], }, }, ], }); } }