const transaction = await Transaction.findByPk(1, {
attributes: ['id'],
include: [
{
model: TransactionStatus,
as: 'status',
attributes: ['name']
}
]
})
{id: 1, status: { name: "success" } }
{id: 1, status: "success" }
const transaction = await Transaction.findByPk(1, {
attributes: [[sequelize.col('transactionStatus.name'), 'status'], 'id'],
include: [
{
model: TransactionStatus,
as: 'transactionStatus',
attributes: []
}
]
})