62 lines
1.1 KiB
TypeScript
62 lines
1.1 KiB
TypeScript
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;
|
|
}
|
|
}
|