You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
2.2 KiB
119 lines
2.2 KiB
export class Workout {
|
|
private _id?: string;
|
|
private _name?: string;
|
|
private _description?: string;
|
|
private _duration?: number;
|
|
private _image?: string;
|
|
private _video?: string;
|
|
private _nbSeries?: number;
|
|
private _nbRepetitions?: number;
|
|
|
|
constructor({
|
|
id,
|
|
name,
|
|
description,
|
|
duration,
|
|
image,
|
|
video,
|
|
nbSeries,
|
|
nbRepetitions,
|
|
}: {
|
|
id?: string;
|
|
name?: string;
|
|
description?: string;
|
|
duration?: number;
|
|
image?: string;
|
|
video?: string;
|
|
nbSeries?: number;
|
|
nbRepetitions?: number;
|
|
} = {}) {
|
|
this._id = id;
|
|
this._name = name;
|
|
this._description = description;
|
|
this._duration = duration;
|
|
this._image = image;
|
|
this._video = video;
|
|
this._nbSeries = nbSeries;
|
|
this._nbRepetitions = nbRepetitions;
|
|
}
|
|
|
|
// Getters
|
|
get id(): string | undefined {
|
|
return this._id;
|
|
}
|
|
|
|
get name(): string | undefined {
|
|
return this._name;
|
|
}
|
|
|
|
get description(): string | undefined {
|
|
return this._description;
|
|
}
|
|
|
|
get duration(): number | undefined {
|
|
return this._duration;
|
|
}
|
|
|
|
get image(): string | undefined {
|
|
return this._image;
|
|
}
|
|
|
|
get video(): string | undefined {
|
|
return this._video;
|
|
}
|
|
|
|
get nbSeries(): number | undefined {
|
|
return this._nbSeries;
|
|
}
|
|
|
|
get nbRepetitions(): number | undefined {
|
|
return this._nbRepetitions;
|
|
}
|
|
|
|
// Setters
|
|
set id(value: string | undefined) {
|
|
this._id = value;
|
|
}
|
|
|
|
set name(value: string | undefined) {
|
|
this._name = value;
|
|
}
|
|
|
|
set description(value: string | undefined) {
|
|
this._description = value;
|
|
}
|
|
|
|
set duration(value: number | undefined) {
|
|
this._duration = value;
|
|
}
|
|
|
|
set image(value: string | undefined) {
|
|
this._image = value;
|
|
}
|
|
|
|
set video(value: string | undefined) {
|
|
this._video = value;
|
|
}
|
|
|
|
set nbSeries(value: number | undefined) {
|
|
this._nbSeries = value;
|
|
}
|
|
|
|
set nbRepetitions(value: number | undefined) {
|
|
this._nbRepetitions = value;
|
|
}
|
|
|
|
static fromJson(json: any): Workout {
|
|
return new Workout({
|
|
id: json.id,
|
|
name: json.name,
|
|
description: json.description,
|
|
duration: json.duration,
|
|
image: json.image,
|
|
video: json.video,
|
|
nbSeries: json.nbSeries,
|
|
nbRepetitions: json.nbRepetitions,
|
|
});
|
|
}
|
|
}
|