As said in the title, i’m trying to update a OneToOne relation, but on only one side of the relation. For example :
"block": {
"type": "title",
"id": "d9e49507-834b-4366-afef-c673aff583cb",
"titleBlock": {
"title": "coucou"
}
}
Here, Block and TitleBlock are tied by a a OneToOne relationship
If I try to update the Block entity by its id, and its related TitleBlock but without specifying its id, I get a duplicate key error.
What I suspect is happening, is : TypeORM tries to create a new TitleBlock, with the relevant blockId, before unlinking the old one. So it fails, because it would mean 2 titleBlocks with the same blockId.
Does anyone know how I can manage to handle this case, or if it is even possible ?
Thanks in advance !