70 lines
981 B
TypeScript

import {
IsInt,
IsNotEmpty,
IsObject,
IsOptional,
IsPositive,
IsString,
ValidateNested
} from "class-validator";
import { RunnerGroup } from './RunnerGroup';
/**
* Defines the runner class (from which the runner sponsoring contracts get generated).
*/
export class Runner {
/**
* The runner's id.
*/
@IsInt()
@IsPositive()
id: number;
/**
* The runner's first name.
*/
@IsString()
@IsNotEmpty()
firstname: string;
/**
* The runner's middle name.
*/
@IsString()
@IsOptional()
middlename?: string;
/**
* The runner's last name.
*/
@IsString()
@IsNotEmpty()
lastname: string;
/**
* The runner's group.
*/
@IsObject()
@ValidateNested()
group: RunnerGroup;
/**
* The total distance ran by the runner.
*/
@IsInt()
distance: number;
constructor() {
console.log("called")
}
}