Now with even more inheritance and fancy stuff: RunnerResponses now get their information from participant responses
ref #13
This commit is contained in:
61
src/models/responses/ResponseParticipant.ts
Normal file
61
src/models/responses/ResponseParticipant.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user