Using Sequelize, i have an special attribute that i created using sequelize.fn("MIN", sequelize.col("column")), and i want to use this inside an include, like that:
const proposal = await ProposalHistory.findAll({
attributes: [
sequelize.fn("MIN", sequelize.col("createDate")), <- THIS IS THE SPECIAL ATTRIBUTE
"fk_id_proposal",
],
include: [
{
model: Proposal,
as: "proposal",
attributes: [
"status",
[
Sequelize.literal(
`sum(case when || HERE I WANT TO USE || >= '${MIN.createDate}')`
),
"Implanted",
],
]
Is this possible? How can i do this?