Code + comment cleanup for the entities

ref #39
This commit is contained in:
2020-12-21 15:29:32 +01:00
parent a03f1a438d
commit d20d738218
21 changed files with 156 additions and 87 deletions

View File

@@ -13,7 +13,8 @@ import { Address } from "./Address";
import { Donation } from "./Donation";
/**
* Defines the participant interface.
* Defines the Participant entity.
* Participans can donate and therefor be associated with donation entities.
*/
@Entity()
@TableInheritance({ column: { name: "type", type: "varchar" } })
@@ -35,7 +36,6 @@ export abstract class Participant {
/**
* The participant's middle name.
* Optional
*/
@Column({ nullable: true })
@IsOptional()
@@ -52,14 +52,14 @@ export abstract class Participant {
/**
* The participant's address.
* Optional
* This is a address object to prevent any formatting differences.
*/
@ManyToOne(() => Address, address => address.participants, { nullable: true })
address?: Address;
/**
* The participant's phone number.
* Optional
* This will be validated against the configured country phone numer syntax (default: international).
*/
@Column({ nullable: true })
@IsOptional()
@@ -68,7 +68,7 @@ export abstract class Participant {
/**
* The participant's email address.
* Optional
* Can be used to contact the participant.
*/
@Column({ nullable: true })
@IsOptional()
@@ -77,6 +77,7 @@ export abstract class Participant {
/**
* 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[];