import { Entity, Column, ManyToOne, OneToMany } from "typeorm"; import { IsOptional,} from "class-validator"; import { RunnerGroup } from "./RunnerGroup"; import { Address } from "./Address"; import { RunnerTeam } from "./RunnerTeam"; /** * Defines a runner organisation (business or school for example). */ @Entity() export class RunnerOrganisation extends RunnerGroup { /** * The organisations's address. * Optional */ @IsOptional() @ManyToOne(() => Address, address => address.groups, { nullable: true }) address?: Address; /** * Used to link teams to runner groups. */ @OneToMany(() => RunnerTeam, team => team.parentGroup, { nullable: true }) teams: RunnerTeam[]; }