Now with even more inheritance and fancy stuff: RunnerResponses now get their information from participant responses

ref #13
This commit is contained in:
2020-12-04 22:00:48 +01:00
parent 7b08489533
commit b480912bd8
2 changed files with 66 additions and 51 deletions

View File

@@ -0,0 +1,61 @@
import {
IsInt,
IsString
} from "class-validator";
import { Participant } from '../entities/Participant';
/**
* Defines a participant response.
*/
export abstract class ResponseParticipant {
/**
* Autogenerated unique id (primary key).
*/
@IsInt()
id: number;;
/**
* The participant's first name.
*/
@IsString()
firstname: string;
/**
* The participant's middle name.
* Optional.
*/
@IsString()
middlename?: string;
/**
* The participant's last name.
*/
@IsString()
lastname: string;
/**
* The participant's phone number.
* Optional.
*/
@IsString()
phone?: string;
/**
* The participant's e-mail address.
* Optional.
*/
@IsString()
email?: string;
public constructor(participant: Participant) {
this.id = participant.id;
this.firstname = participant.firstname;
this.middlename = participant.middlename;
this.lastname = participant.lastname;
this.phone = participant.phone;
this.email = participant.email;
}
}