Mitigated circular dependency (to be fixed)

ref #65
This commit is contained in:
2021-01-02 18:12:18 +01:00
parent c9ba69792f
commit 1dc438beb2
8 changed files with 29 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
import { IsBoolean } from "class-validator";
import { ChildEntity, Column } from "typeorm";
import { ChildEntity, Column, OneToMany } from "typeorm";
import { Donation } from './Donation';
import { Participant } from "./Participant";
/**
@@ -14,4 +15,11 @@ export class Donor extends Participant {
@Column()
@IsBoolean()
receiptNeeded: boolean = false;
/**
* Used to link the participant as the donor of a donation.
* Attention: Only runner's can be associated as a distanceDonations distance source.
*/
@OneToMany(() => Donation, donation => donation.donor, { nullable: true })
donations: Donation[];
}