Cleanup: Renamed the creation folder to the more fitting "actions"

ref #11 #13
This commit is contained in:
2020-12-05 18:45:47 +01:00
parent 5c259484ee
commit 0e924449d6
21 changed files with 32 additions and 9 deletions

View File

@@ -0,0 +1,30 @@
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
import { Track } from '../entities/Track';
export class CreateTrack {
/**
* The track's name.
*/
@IsString()
@IsNotEmpty()
name: string;
/**
* The track's distance in meters (must be greater 0).
*/
@IsInt()
@IsPositive()
distance: number;
/**
* Converts a Track object based on this.
*/
public toTrack(): Track {
let newTrack: Track = new Track();
newTrack.name = this.name;
newTrack.distance = this.distance;
return newTrack;
}
}