Open ChinaeduO opened 2 months ago
I am facing the exact same problem
You need to remove the groupId prop from everything and use only group prop
Example:
@Entity('pricetypes')
export class PriceType extends BaseEntity {
@ManyToOne(() => Group, group => group.pricetypes)
@JoinColumn({ name: 'group_id', referencedColumnName: 'id' })
group: Group;
// ...more attributes
}
curl -X 'PATCH' \
/
'http://localhost:3000/pricetype/2' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"group": { "id" : 3 }
}'
Hi all,
I have a problem that the library is not updating a foreign key when calling tha API with PATCH.
This is my entity:
This is my referenced group entity:
And my DTOs:
Problem
When creating a
pricetype
everything works as expected, but when updating apricetype
and changing the referencedgroupId
, nothing happens, theFK groupId
is not updated. (Any non-relational column is updated correctly):Result:
groupId
is still the same. Also inside the database.