Moded track controller related models to a new file
This commit is contained in:
21
src/models/CreateTrack.ts
Normal file
21
src/models/CreateTrack.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user