backend/src/models/responses/ResponseTrack.ts

36 lines
590 B
TypeScript

import {
IsInt,
IsString
} from "class-validator";
import { Track } from '../entities/Track';
/**
* Defines a track of given length.
*/
export class ResponseTrack {
/**
* Autogenerated unique id (primary key).
*/
@IsInt()
id: number;;
/**
* The track's name.
*/
@IsString()
name: string;
/**
* The track's length/distance in meters.
*/
@IsInt()
distance: number;
public constructor(track: Track) {
this.id = track.id;
this.name = track.name;
this.distance = track.distance;
}
}