feature/11-new_classes #15

Merged
niggl merged 55 commits from feature/11-new_classes into dev 2020-12-02 17:48:19 +00:00
2 changed files with 9 additions and 2 deletions
Showing only changes of commit 029e4beaf5 - Show all commits

View File

@ -3,6 +3,7 @@ import { IsNotEmpty,} from "class-validator";
import { Participant } from "./Participant";
import { RunnerGroup } from "./RunnerGroup";
import { DistanceDonation } from "./DistanceDonation";
import { RunnerCard } from "./RunnerCard";
/**
* Defines a runner.
@ -22,4 +23,10 @@ export class Runner extends Participant {
*/
@OneToMany(() => DistanceDonation, distanceDonation => distanceDonation.runner)
distanceDonations: DistanceDonation[];
/**
* Used to link runners to cards.
*/
@OneToMany(() => RunnerCard, card => card.runner)
cards: RunnerCard[];
}

View File

@ -1,4 +1,4 @@
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne } from "typeorm";
import {
IsBoolean,
IsInt,
@ -26,7 +26,7 @@ export class RunnerCard {
*/
@Column()
@IsOptional()
//TODO: Relation
@ManyToOne(() => Runner, runner => runner.cards)
runner: Runner;
/**