parent
5bf978d32d
commit
ac0ce799f9
@ -13,5 +13,5 @@ export class Donor extends Participant {
|
|||||||
*/
|
*/
|
||||||
@Column()
|
@Column()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
receiptNeeded = false;
|
receiptNeeded: boolean;
|
||||||
}
|
}
|
@ -1,12 +1,86 @@
|
|||||||
import { Entity, OneToMany } from "typeorm";
|
import { PrimaryGeneratedColumn, Column, OneToMany, ManyToOne, Entity } from "typeorm";
|
||||||
import { Participant } from "./Participant";
|
import {
|
||||||
|
IsEmail,
|
||||||
|
IsInt,
|
||||||
|
IsNotEmpty,
|
||||||
|
IsOptional,
|
||||||
|
IsPhoneNumber,
|
||||||
|
IsString,
|
||||||
|
} from "class-validator";
|
||||||
|
import { Address } from "./Address";
|
||||||
|
import { Donation } from "./Donation";
|
||||||
import { RunnerGroup } from "./RunnerGroup";
|
import { RunnerGroup } from "./RunnerGroup";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a group's contact.
|
* Defines a group's contact.
|
||||||
*/
|
*/
|
||||||
@Entity()
|
@Entity()
|
||||||
export class GroupContact extends Participant{
|
export class GroupContact {
|
||||||
|
/**
|
||||||
|
* Autogenerated unique id (primary key).
|
||||||
|
*/
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
@IsOptional()
|
||||||
|
@IsInt()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The contact's first name.
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsNotEmpty()
|
||||||
|
@IsString()
|
||||||
|
firstname: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The contact's middle name.
|
||||||
|
* Optional
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
middlename?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The contact's last name.
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsOptional()
|
||||||
|
@IsString()
|
||||||
|
lastname: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The contact's address.
|
||||||
|
* Optional
|
||||||
|
*/
|
||||||
|
@IsOptional()
|
||||||
|
@ManyToOne(() => Address, address => address.participants)
|
||||||
|
address?: Address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The contact's phone number.
|
||||||
|
* Optional
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsOptional()
|
||||||
|
@IsPhoneNumber("DE")
|
||||||
|
phone?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The contact's email address.
|
||||||
|
* Optional
|
||||||
|
*/
|
||||||
|
@Column()
|
||||||
|
@IsOptional()
|
||||||
|
@IsEmail()
|
||||||
|
email?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to link the contact as the donor of a donation.
|
||||||
|
*/
|
||||||
|
@OneToMany(() => Donation, donation => donation.donor)
|
||||||
|
donations: Donation[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to link runners to donations.
|
* Used to link runners to donations.
|
||||||
*/
|
*/
|
||||||
|
@ -45,7 +45,7 @@ export class RunnerCard {
|
|||||||
*/
|
*/
|
||||||
@Column()
|
@Column()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
enabled = true;
|
enabled: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to link cards to a track scans.
|
* Used to link cards to a track scans.
|
||||||
|
@ -43,10 +43,4 @@ export abstract class RunnerGroup {
|
|||||||
*/
|
*/
|
||||||
@OneToMany(() => Runner, runner => runner.group)
|
@OneToMany(() => Runner, runner => runner.group)
|
||||||
runners: Runner[];
|
runners: Runner[];
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to link teams to runner groups.
|
|
||||||
*/
|
|
||||||
@OneToMany(() => RunnerTeam, team => team.parentGroup)
|
|
||||||
teams: RunnerTeam[];
|
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
import { Entity, Column, ManyToOne } from "typeorm";
|
import { Entity, Column, ManyToOne, OneToMany } 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";
|
||||||
|
import { RunnerTeam } from "./RunnerTeam";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a runner organisation (business or school for example).
|
* Defines a runner organisation (business or school for example).
|
||||||
@ -16,4 +17,10 @@ export class RunnerOrganisation extends RunnerGroup {
|
|||||||
@IsOptional()
|
@IsOptional()
|
||||||
@ManyToOne(() => Address, address => address.groups)
|
@ManyToOne(() => Address, address => address.groups)
|
||||||
address?: Address;
|
address?: Address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to link teams to runner groups.
|
||||||
|
*/
|
||||||
|
@OneToMany(() => RunnerTeam, team => team.parentGroup)
|
||||||
|
teams: RunnerTeam[];
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
import { Entity, Column, ManyToOne } from "typeorm";
|
import { Entity, Column, ManyToOne } from "typeorm";
|
||||||
import { IsNotEmpty } from "class-validator";
|
import { IsNotEmpty } from "class-validator";
|
||||||
import { RunnerGroup } from "./RunnerGroup";
|
import { RunnerGroup } from "./RunnerGroup";
|
||||||
|
import { RunnerOrganisation } from "./RunnerOrganisation";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a runner team (class or deparment for example).
|
* Defines a runner team (class or deparment for example).
|
||||||
@ -13,6 +14,6 @@ export class RunnerTeam extends RunnerGroup {
|
|||||||
* Optional
|
* Optional
|
||||||
*/
|
*/
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@ManyToOne(() => RunnerGroup, group => group.teams)
|
@ManyToOne(() => RunnerOrganisation, org => org.teams)
|
||||||
parentGroup?: RunnerGroup;
|
parentGroup?: RunnerOrganisation;
|
||||||
}
|
}
|
@ -40,5 +40,5 @@ export abstract class Scan {
|
|||||||
*/
|
*/
|
||||||
@Column()
|
@Column()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
valid = true;
|
valid: boolean;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ export class ScanStation {
|
|||||||
*/
|
*/
|
||||||
@Column()
|
@Column()
|
||||||
@IsBoolean()
|
@IsBoolean()
|
||||||
enabled = true;
|
enabled: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to link track scans to a scan station.
|
* Used to link track scans to a scan station.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user