diff --git a/src/models/actions/CreateRunnerOrganisation.ts b/src/models/actions/CreateRunnerOrganisation.ts index 017675e..a0733de 100644 --- a/src/models/actions/CreateRunnerOrganisation.ts +++ b/src/models/actions/CreateRunnerOrganisation.ts @@ -41,7 +41,7 @@ export class CreateRunnerOrganisation extends CreateRunnerGroup { newRunnerOrganisation.name = this.name; newRunnerOrganisation.contact = await this.getContact(); - newRunnerOrganisation.address = await this.getAddress(); + // newRunnerOrganisation.address = await this.getAddress(); return newRunnerOrganisation; } diff --git a/src/models/actions/UpdateRunnerOrganisation.ts b/src/models/actions/UpdateRunnerOrganisation.ts index 3a5b1fb..9a2cafa 100644 --- a/src/models/actions/UpdateRunnerOrganisation.ts +++ b/src/models/actions/UpdateRunnerOrganisation.ts @@ -45,7 +45,7 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup { organisation.name = this.name; organisation.contact = await this.getContact(); - organisation.address = await this.getAddress(); + // organisation.address = await this.getAddress(); return organisation; } diff --git a/src/models/entities/Address.ts b/src/models/entities/Address.ts index 99d69ce..bd3cd32 100644 --- a/src/models/entities/Address.ts +++ b/src/models/entities/Address.ts @@ -8,7 +8,6 @@ import { import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm"; import { config } from '../../config'; import { Participant } from "./Participant"; -import { RunnerOrganisation } from "./RunnerOrganisation"; /** * Defines the Address entity. @@ -82,9 +81,9 @@ export class Address { @OneToMany(() => Participant, participant => participant.address, { nullable: true }) participants: Participant[]; - /** - * Used to link the address to runner groups. - */ - @OneToMany(() => RunnerOrganisation, group => group.address, { nullable: true }) - groups: RunnerOrganisation[]; + // /** + // * Used to link the address to runner groups. + // */ + // @OneToMany(() => RunnerOrganisation, group => group.address, { nullable: true }) + // groups: RunnerOrganisation[]; } diff --git a/src/models/entities/Donation.ts b/src/models/entities/Donation.ts index 3ddc272..eea23b5 100644 --- a/src/models/entities/Donation.ts +++ b/src/models/entities/Donation.ts @@ -3,7 +3,7 @@ import { IsNotEmpty } from "class-validator"; import { Entity, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from "typeorm"; -import { Participant } from "./Participant"; +import { Donor } from './Donor'; /** * Defines the Donation entity. @@ -24,8 +24,8 @@ export abstract class Donation { * The donations's donor. */ @IsNotEmpty() - @ManyToOne(() => Participant, donor => donor.donations) - donor: Participant; + @ManyToOne(() => Donor, donor => donor.donations) + donor: Donor; /** * The donation's amount in cents (or whatever your currency's smallest unit is.). diff --git a/src/models/entities/Donor.ts b/src/models/entities/Donor.ts index c0f914e..188ed09 100644 --- a/src/models/entities/Donor.ts +++ b/src/models/entities/Donor.ts @@ -1,5 +1,6 @@ import { IsBoolean } from "class-validator"; -import { ChildEntity, Column } from "typeorm"; +import { ChildEntity, Column, OneToMany } from "typeorm"; +import { Donation } from './Donation'; import { Participant } from "./Participant"; /** @@ -14,4 +15,11 @@ export class Donor extends Participant { @Column() @IsBoolean() receiptNeeded: boolean = false; + + /** + * Used to link the participant as the donor of a donation. + * Attention: Only runner's can be associated as a distanceDonations distance source. + */ + @OneToMany(() => Donation, donation => donation.donor, { nullable: true }) + donations: Donation[]; } \ No newline at end of file diff --git a/src/models/entities/Participant.ts b/src/models/entities/Participant.ts index e2e2263..19af17e 100644 --- a/src/models/entities/Participant.ts +++ b/src/models/entities/Participant.ts @@ -7,10 +7,9 @@ import { IsString } from "class-validator"; -import { Column, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn, TableInheritance } from "typeorm"; +import { Column, Entity, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from "typeorm"; import { config } from '../../config'; import { Address } from "./Address"; -import { Donation } from "./Donation"; /** * Defines the Participant entity. @@ -74,11 +73,4 @@ export abstract class Participant { @IsOptional() @IsEmail() email?: string; - - /** - * Used to link the participant as the donor of a donation. - * Attention: Only runner's can be associated as a distanceDonations distance source. - */ - @OneToMany(() => Donation, donation => donation.donor, { nullable: true }) - donations: Donation[]; } \ No newline at end of file diff --git a/src/models/entities/RunnerOrganisation.ts b/src/models/entities/RunnerOrganisation.ts index 877784b..7110b09 100644 --- a/src/models/entities/RunnerOrganisation.ts +++ b/src/models/entities/RunnerOrganisation.ts @@ -1,6 +1,5 @@ -import { IsInt, IsOptional } from "class-validator"; -import { ChildEntity, ManyToOne, OneToMany } from "typeorm"; -import { Address } from "./Address"; +import { IsInt } from "class-validator"; +import { ChildEntity, OneToMany } from "typeorm"; import { Runner } from './Runner'; import { RunnerGroup } from "./RunnerGroup"; import { RunnerTeam } from "./RunnerTeam"; @@ -12,12 +11,12 @@ import { RunnerTeam } from "./RunnerTeam"; @ChildEntity() export class RunnerOrganisation extends RunnerGroup { - /** - * The organisations's address. - */ - @IsOptional() - @ManyToOne(() => Address, address => address.groups, { nullable: true }) - address?: Address; + // /** + // * The organisations's address. + // */ + // @IsOptional() + // @ManyToOne(() => Address, address => address.groups, { nullable: true }) + // address?: Address; /** * The organisation's teams. diff --git a/src/models/responses/ResponseRunnerOrganisation.ts b/src/models/responses/ResponseRunnerOrganisation.ts index edc1ff0..8e31a71 100644 --- a/src/models/responses/ResponseRunnerOrganisation.ts +++ b/src/models/responses/ResponseRunnerOrganisation.ts @@ -32,7 +32,7 @@ export class ResponseRunnerOrganisation extends ResponseRunnerGroup { */ public constructor(org: RunnerOrganisation) { super(org); - this.address = org.address; + // this.address = org.address; this.teams = org.teams; } }