Models Price, Varient One ,Varient Two ,Item
One Item have varient one and varient two , and many prices
They are my relations
db.tbl_itemPrice.belongsTo(db.tbl_varientOne,{foreignKey:'varientOne'})
db.tbl_itemPrice.belongsTo(db.tbl_varientTwo,{foreignKey:'varientTwo'})
db.tbl_item.hasMany(db.tbl_price,{foreignKey:'item'})
And then I want to join the table item , price, varient one and varient two . This is my controller-
exports.find = (req, res) => {
Price.findAll ({
include:[{
model:VarientOne,VarientTwo
}],
}).then (item => {
res.send(item)
});
};
How can I join all above tables in sequelize