diff --git a/src/models/Runner.ts b/src/models/Runner.ts index 3db90fc..dc2cbe2 100644 --- a/src/models/Runner.ts +++ b/src/models/Runner.ts @@ -4,6 +4,7 @@ import { Participant } from "./Participant"; import { RunnerGroup } from "./RunnerGroup"; import { DistanceDonation } from "./DistanceDonation"; import { RunnerCard } from "./RunnerCard"; +import { Scan } from "./Scan"; /** * Defines a runner. @@ -29,4 +30,10 @@ export class Runner extends Participant { */ @OneToMany(() => RunnerCard, card => card.runner) cards: RunnerCard[]; + + /** + * Used to link runners to a scans + */ + @OneToMany(() => Scan, scan => scan.runner) + scans: Scan[]; } diff --git a/src/models/Scan.ts b/src/models/Scan.ts index 3991b7a..51d71c3 100644 --- a/src/models/Scan.ts +++ b/src/models/Scan.ts @@ -1,4 +1,4 @@ -import { PrimaryGeneratedColumn, Column } from "typeorm"; +import { PrimaryGeneratedColumn, Column, ManyToOne } from "typeorm"; import { IsInt, IsNotEmpty, @@ -24,7 +24,7 @@ export abstract class Scan { */ @Column() @IsNotEmpty() - //TODO: Relationship + @ManyToOne(() => Runner, runner => runner.scans) runner: Runner; /**