Added relations to RunnerOrganisation
This commit is contained in:
parent
f28b08ed65
commit
7ac46a7cc7
@ -7,6 +7,7 @@ import {
|
|||||||
IsString,
|
IsString,
|
||||||
} from "class-validator";
|
} from "class-validator";
|
||||||
import { Participant } from "./Participant";
|
import { Participant } from "./Participant";
|
||||||
|
import { RunnerOrganisation } from "./RunnerOrganisation";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a address (to be used for contact information).
|
* Defines a address (to be used for contact information).
|
||||||
@ -77,4 +78,10 @@ export class Address {
|
|||||||
*/
|
*/
|
||||||
@OneToMany(() => Participant, participant => participant.address)
|
@OneToMany(() => Participant, participant => participant.address)
|
||||||
participants: Participant[];
|
participants: Participant[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to link the address to runner groups.
|
||||||
|
*/
|
||||||
|
@OneToMany(() => RunnerOrganisation, group => group.address)
|
||||||
|
groups: RunnerOrganisation[];
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Entity, Column } from "typeorm";
|
import { Entity, Column, ManyToOne } from "typeorm";
|
||||||
import { IsOptional,} from "class-validator";
|
import { IsOptional,} from "class-validator";
|
||||||
import { RunnerGroup } from "./RunnerGroup";
|
import { RunnerGroup } from "./RunnerGroup";
|
||||||
import { Address } from "./Address";
|
import { Address } from "./Address";
|
||||||
@ -15,6 +15,6 @@ export class RunnerOrganisation extends RunnerGroup {
|
|||||||
*/
|
*/
|
||||||
@Column()
|
@Column()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
//TODO: Relationship
|
@ManyToOne(() => Address, address => address.groups)
|
||||||
address?: Address;
|
address?: Address;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user