Moded track controller related models to a new file

This commit is contained in:
2020-12-03 17:43:24 +01:00
parent a86465c554
commit da4597fa62
2 changed files with 32 additions and 20 deletions

21
src/models/CreateTrack.ts Normal file
View File

@@ -0,0 +1,21 @@
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
import { Track } from './Track';
export class CreateTrack {
@IsString()
@IsNotEmpty()
name: string;
@IsInt()
@IsPositive()
distance: number;
public getTrack(): Track {
let newTrack: Track = new Track();
newTrack.name = this.name;
newTrack.distance = this.distance;
return newTrack;
}
}