Primero, perdón por el mal inglés, hablante no nativo. En Sequelize, he creado un CRUD sin problemas, una gran herramienta ORM, aún así me gustaría crear y devolver datos específicos con una asociación.
async create(req, res){ const {minRoll,maxRoll,typeName} = req.body; const actionType = await ActionType.findOne({ where: {name: typeName} }); if(!actionType){ return res.json({result:false}); } const {id} = actionType; const action = await Action.create({ minRoll: minRoll, maxRoll: maxRoll, type_id: id }); return res.json(action); },¿Cómo crear y devolver acción con una asociación ? Este es mi regreso en Postman en este momento:
"id": 61, "minRoll": 1, "maxRoll": 3, "type_id": 20