parent
71e3d0efe2
commit
d70c5b1bbc
51
src/models/responses/ResponseSelfServiceDonor.ts
Normal file
51
src/models/responses/ResponseSelfServiceDonor.ts
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import { IsInt, IsString } from "class-validator";
|
||||||
|
import { Donor } from '../entities/Donor';
|
||||||
|
import { ResponseObjectType } from '../enums/ResponseObjectType';
|
||||||
|
import { IResponse } from './IResponse';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the donor selfservice response.
|
||||||
|
* Why? B/C runner's are not allowed to view all information available to admin users.
|
||||||
|
*/
|
||||||
|
export class ResponseSelfServiceDonor implements IResponse {
|
||||||
|
/**
|
||||||
|
* The responseType.
|
||||||
|
* This contains the type of class/entity this response contains.
|
||||||
|
*/
|
||||||
|
responseType: ResponseObjectType = ResponseObjectType.SELFSERVICERUNNER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The participant's id.
|
||||||
|
*/
|
||||||
|
@IsInt()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The participant's first name.
|
||||||
|
*/
|
||||||
|
@IsString()
|
||||||
|
firstname: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The participant's middle name.
|
||||||
|
*/
|
||||||
|
@IsString()
|
||||||
|
middlename?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The participant's last name.
|
||||||
|
*/
|
||||||
|
@IsString()
|
||||||
|
lastname: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a ResponseSelfServiceDonor object from a runner.
|
||||||
|
* @param donor The donor the response shall be build for.
|
||||||
|
*/
|
||||||
|
public constructor(donor: Donor) {
|
||||||
|
this.id = donor.id;
|
||||||
|
this.firstname = donor.firstname;
|
||||||
|
this.middlename = donor.middlename;
|
||||||
|
this.lastname = donor.lastname;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user