latest work #20

Merged
philipp merged 233 commits from dev into main 2020-12-09 18:49:33 +00:00
2 changed files with 13 additions and 3 deletions
Showing only changes of commit a6222a8025 - Show all commits

View File

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany } from "typeorm";
import { Entity, Column, OneToMany, ManyToOne } from "typeorm";
import { IsNotEmpty,} from "class-validator";
import { Participant } from "./Participant";
import { RunnerGroup } from "./RunnerGroup";
@ -14,9 +14,12 @@ export class Runner extends Participant {
*/
@Column()
@IsNotEmpty()
//TODO:Relation
@ManyToOne(() => RunnerGroup, group => group.runners)
group: RunnerGroup;
/**
* Used to link runners to donations.
*/
@OneToMany(() => DistanceDonation, distanceDonation => distanceDonation.runner)
distanceDonations: DistanceDonation[];
}

View File

@ -1,4 +1,4 @@
import { PrimaryGeneratedColumn, Column } from "typeorm";
import { PrimaryGeneratedColumn, Column, OneToMany } from "typeorm";
import {
IsInt,
IsNotEmpty,
@ -6,6 +6,7 @@ import {
IsString,
} from "class-validator";
import { GroupContact } from "./GroupContact";
import { Runner } from "./Runner";
/**
* Defines the runnerGroup interface.
@ -35,4 +36,10 @@ export abstract class RunnerGroup {
@IsOptional()
//TODO: Relationship
contact?: GroupContact;
/**
* Used to link runners to a runner group.
*/
@OneToMany(() => Runner, runner => runner.group)
runners: Runner[];
}