parent
c9ba69792f
commit
1dc438beb2
@ -41,7 +41,7 @@ export class CreateRunnerOrganisation extends CreateRunnerGroup {
|
|||||||
|
|
||||||
newRunnerOrganisation.name = this.name;
|
newRunnerOrganisation.name = this.name;
|
||||||
newRunnerOrganisation.contact = await this.getContact();
|
newRunnerOrganisation.contact = await this.getContact();
|
||||||
newRunnerOrganisation.address = await this.getAddress();
|
// newRunnerOrganisation.address = await this.getAddress();
|
||||||
|
|
||||||
return newRunnerOrganisation;
|
return newRunnerOrganisation;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ export class UpdateRunnerOrganisation extends CreateRunnerGroup {
|
|||||||
|
|
||||||
organisation.name = this.name;
|
organisation.name = this.name;
|
||||||
organisation.contact = await this.getContact();
|
organisation.contact = await this.getContact();
|
||||||
organisation.address = await this.getAddress();
|
// organisation.address = await this.getAddress();
|
||||||
|
|
||||||
return organisation;
|
return organisation;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import {
|
|||||||
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||||
import { config } from '../../config';
|
import { config } from '../../config';
|
||||||
import { Participant } from "./Participant";
|
import { Participant } from "./Participant";
|
||||||
import { RunnerOrganisation } from "./RunnerOrganisation";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the Address entity.
|
* Defines the Address entity.
|
||||||
@ -82,9 +81,9 @@ export class Address {
|
|||||||
@OneToMany(() => Participant, participant => participant.address, { nullable: true })
|
@OneToMany(() => Participant, participant => participant.address, { nullable: true })
|
||||||
participants: Participant[];
|
participants: Participant[];
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Used to link the address to runner groups.
|
// * Used to link the address to runner groups.
|
||||||
*/
|
// */
|
||||||
@OneToMany(() => RunnerOrganisation, group => group.address, { nullable: true })
|
// @OneToMany(() => RunnerOrganisation, group => group.address, { nullable: true })
|
||||||
groups: RunnerOrganisation[];
|
// groups: RunnerOrganisation[];
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import {
|
|||||||
IsNotEmpty
|
IsNotEmpty
|
||||||
} from "class-validator";
|
} from "class-validator";
|
||||||
import { Entity, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from "typeorm";
|
import { Entity, ManyToOne, PrimaryGeneratedColumn, TableInheritance } from "typeorm";
|
||||||
import { Participant } from "./Participant";
|
import { Donor } from './Donor';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the Donation entity.
|
* Defines the Donation entity.
|
||||||
@ -24,8 +24,8 @@ export abstract class Donation {
|
|||||||
* The donations's donor.
|
* The donations's donor.
|
||||||
*/
|
*/
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@ManyToOne(() => Participant, donor => donor.donations)
|
@ManyToOne(() => Donor, donor => donor.donations)
|
||||||
donor: Participant;
|
donor: Donor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The donation's amount in cents (or whatever your currency's smallest unit is.).
|
* The donation's amount in cents (or whatever your currency's smallest unit is.).
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { IsBoolean } from "class-validator";
|
import { IsBoolean } from "class-validator";
|
||||||
import { ChildEntity, Column } from "typeorm";
|
import { ChildEntity, Column, OneToMany } from "typeorm";
|
||||||
|
import { Donation } from './Donation';
|
||||||
import { Participant } from "./Participant";
|
import { Participant } from "./Participant";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -14,4 +15,11 @@ export class Donor extends Participant {
|
|||||||
@Column()
|
@Column()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
receiptNeeded: boolean = false;
|
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[];
|
||||||
}
|
}
|
@ -7,10 +7,9 @@ import {
|
|||||||
|
|
||||||
IsString
|
IsString
|
||||||
} from "class-validator";
|
} 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 { config } from '../../config';
|
||||||
import { Address } from "./Address";
|
import { Address } from "./Address";
|
||||||
import { Donation } from "./Donation";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the Participant entity.
|
* Defines the Participant entity.
|
||||||
@ -74,11 +73,4 @@ export abstract class Participant {
|
|||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsEmail()
|
@IsEmail()
|
||||||
email?: string;
|
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[];
|
|
||||||
}
|
}
|
@ -1,6 +1,5 @@
|
|||||||
import { IsInt, IsOptional } from "class-validator";
|
import { IsInt } from "class-validator";
|
||||||
import { ChildEntity, ManyToOne, OneToMany } from "typeorm";
|
import { ChildEntity, OneToMany } from "typeorm";
|
||||||
import { Address } from "./Address";
|
|
||||||
import { Runner } from './Runner';
|
import { Runner } from './Runner';
|
||||||
import { RunnerGroup } from "./RunnerGroup";
|
import { RunnerGroup } from "./RunnerGroup";
|
||||||
import { RunnerTeam } from "./RunnerTeam";
|
import { RunnerTeam } from "./RunnerTeam";
|
||||||
@ -12,12 +11,12 @@ import { RunnerTeam } from "./RunnerTeam";
|
|||||||
@ChildEntity()
|
@ChildEntity()
|
||||||
export class RunnerOrganisation extends RunnerGroup {
|
export class RunnerOrganisation extends RunnerGroup {
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* The organisations's address.
|
// * The organisations's address.
|
||||||
*/
|
// */
|
||||||
@IsOptional()
|
// @IsOptional()
|
||||||
@ManyToOne(() => Address, address => address.groups, { nullable: true })
|
// @ManyToOne(() => Address, address => address.groups, { nullable: true })
|
||||||
address?: Address;
|
// address?: Address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The organisation's teams.
|
* The organisation's teams.
|
||||||
|
@ -32,7 +32,7 @@ export class ResponseRunnerOrganisation extends ResponseRunnerGroup {
|
|||||||
*/
|
*/
|
||||||
public constructor(org: RunnerOrganisation) {
|
public constructor(org: RunnerOrganisation) {
|
||||||
super(org);
|
super(org);
|
||||||
this.address = org.address;
|
// this.address = org.address;
|
||||||
this.teams = org.teams;
|
this.teams = org.teams;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user