Second part of the action comment refactoring
Some checks failed
continuous-integration/drone/pr Build is failing

ref #39
This commit is contained in:
2020-12-21 16:21:12 +01:00
parent 1d0d79f3da
commit 48bef8db60
12 changed files with 79 additions and 49 deletions

View File

@@ -1,23 +1,26 @@
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
import { Track } from '../entities/Track';
/**
* This classed is used to create a new Track entity from a json body (post request).
*/
export class CreateTrack {
/**
* The track's name.
* The new track's name.
*/
@IsString()
@IsNotEmpty()
name: string;
/**
* The track's distance in meters (must be greater than 0).
* The new track's distance in meters (must be greater than 0).
*/
@IsInt()
@IsPositive()
distance: number;
/**
* Converts a Track object based on this.
* Creates a new Track entity from this.
*/
public toTrack(): Track {
let newTrack: Track = new Track();