findall include sequelize code example
Example 1: sequelize include only
Payment.findAll({
where: {
DairyId: req.query.dairyid
},
attributes: {
exclude: ['createdAt', 'updatedAt']
},
include: {
model: Customer,
attributes:['customerName', 'phoneNumber']
}
})
Example 2: nested include sequelize
models.products.findAll({
include: [
{model: models.comments, include: [models.comments.users] }
]
})