backend/src/models/responses/ResponsePrincipal.ts

33 lines
795 B
TypeScript

import {
IsInt
} from "class-validator";
import { Principal } from '../entities/Principal';
import { ResponseObjectType } from '../enums/ResponseObjectType';
import { IResponse } from './IResponse';
/**
* Defines the principal response.
*/
export abstract class ResponsePrincipal implements IResponse {
/**
* The responseType.
* This contains the type of class/entity this response contains.
*/
responseType: ResponseObjectType = ResponseObjectType.PRINCIPAL;
/**
* The principal's id.
*/
@IsInt()
id: number;
/**
* Creates a ResponsePrincipal object from a principal.
* @param principal The principal the response shall be build for.
*/
public constructor(principal: Principal) {
this.id = principal.id;
}
}