TypeORM OneToMany relation to multiple fields

Viewed 135

How to make something like this scheme in TypeORM?

Entity Child:

@Field(() => Parent, { nullable: true })
@ManyToOne(() => Parent, (parent) => parent.children)
father: Parent;

@Field(() => Parent, { nullable: true })
@ManyToOne(() => Parent, (parent) => parent.children)
mother: Parent;

Entity Parent:

@OneToMany(() => Child, 'mother') // missing father
children: Child[];

My problem is how to make OneToMany relation to mother AND father on entity Parent.

0 Answers
Related