How to Add Another Nested Element to the Child?

2 views
Skip to first unread message

FrontCat BackEnd

unread,
Jun 22, 2021, 1:35:36 AM6/22/21
to Sequelize

 Hello everyone ! There are two models: Actors and Films. Many-to-Many connection. I'm trying to write a CRUD but I have a problem with UpdatActor it only updates the Actor. How do I write UpdateActor () so that I can add another movie to the Actor?


async updateActor(req, res, next) {
try {
await Actor.update(req.body, {where:{
id:req.params.id
}})
let updated = await Actor.findByPk(req.params.id)
return res.json(updated)
} catch (err) {}
}
Reply all
Reply to author
Forward
0 new messages