I’m trying to persist relational data in myql database with typeORM and nestjs but it’s showing an error apparently in the database
the entity
@ManyToMany(()=> Stock, stock => stock.seals)
@JoinTable()
stock: Stock[];
the service
var c = getConnection().getRepository(Seals).save(createSealDto)
return c
the error
ERROR [ExceptionsHandler] Cannot add or update a child row: a foreign key constraint fails (`stocksystem`.`stock_seals_seals`, CONSTRAINT `FK_70140d58e95fbceed988b224e64` FOREIGN KEY (`stockId`) REFERENCES `stock` (`id`) ON DELETE CASCADE ON UPDATE CASCADE)
my payload
{"client":{"id":1},"stock":[{"id":1},{"id":1}],"price":398}