Added participant abstract class

ref #11
This commit is contained in:
Nicolai Ort 2020-12-01 17:20:43 +01:00
parent a2cf8d1f2c
commit f350007ae5
1 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,73 @@
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
import {
IsEmail,
IsInt,
IsNotEmpty,
IsOptional,
IsPhoneNumber,
IsString,
} from "class-validator";
/**
* Defines the participant interface.
*/
export abstract class IParticipant {
/**
* Autogenerated unique id (primary key).
*/
@PrimaryGeneratedColumn()
@IsOptional()
@IsInt()
id: number;
/**
* The participant's first name.
*/
@Column()
@IsNotEmpty()
@IsString()
firstname: string;
/**
* The participant's middle name.
* Optional
*/
@Column()
@IsOptional()
@IsString()
middlename?: string;
/**
* The participant's last name.
*/
@Column()
@IsOptional()
@IsString()
lastname: string;
/**
* The participant's address.
* Optional
*/
@Column()
@IsOptional()
address?: Location;
/**
* The participant's phone number.
* Optional
*/
@Column()
@IsOptional()
@IsPhoneNumber("DE")
phone?: string;
/**
* The participant's email address.
* Optional
*/
@Column()
@IsOptional()
@IsEmail()
email?: string;
}