File size: 2,095 Bytes
d491754
eb78df6
da50ce9
eb78df6
 
 
da50ce9
eb78df6
 
 
da50ce9
eb78df6
 
 
 
 
da50ce9
eb78df6
 
 
da50ce9
eb78df6
 
d491754
339fa48
 
 
 
 
 
 
 
 
 
d491754
 
da50ce9
d491754
 
 
da50ce9
d491754
eb78df6
 
da50ce9
eb78df6
 
cbdd38a
 
 
 
eb78df6
da50ce9
eb78df6
 
 
ce1ade1
da50ce9
eb78df6
 
 
da50ce9
eb78df6
 
 
da50ce9
eb78df6
 
 
da50ce9
eb78df6
 
 
da50ce9
eb78df6
 
 
d836ad1
eb78df6
 
 
da50ce9
eb78df6
f402448
 
 
 
eb78df6
 
ce1ade1
da50ce9
f402448
9d56cbc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { Expose, Transform } from "class-transformer";
import { serialize } from "@helpers/serialize";
import { SwaggerResponseProperty } from "@lib/decorators/swagger-response-property.decorator";

class ExpectedDurationRange {
  @Expose()
  @SwaggerResponseProperty({ type: "number" })
  min: number;

  @Expose()
  @SwaggerResponseProperty({ type: "number" })
  max: number;
}

class Media {
  @Expose()
  @SwaggerResponseProperty({ type: "string" })
  type: string;

  @Expose()
  @SwaggerResponseProperty({ type: "string" })
  url: string;
}

class TargetMuscles {
  @Expose()
  @SwaggerResponseProperty({ type: "string" })
  primary: string;

  @Expose()
  @SwaggerResponseProperty({ type: "string" })
  secondary: string;
}

export class ExerciseSerialization {
  @Expose({ name: "_id" })
  @SwaggerResponseProperty({ type: "string" })
  id: string;

  @Expose()
  @SwaggerResponseProperty({ type: "string" })
  name: string;

  @Expose()
  @SwaggerResponseProperty({ type: "string" })
  category: string;

  @Expose()
  @SwaggerResponseProperty({ type: "string" })
  exerciseType: string;

  @Expose()
  @SwaggerResponseProperty({ type: "number" })
  duration: number | null;

  @Expose({ name: "expectedDurationRange" })
  @SwaggerResponseProperty({ type: ExpectedDurationRange })
  @Transform(({ value }) => serialize(value, ExpectedDurationRange))
  expectedDurationRange: object;

  @Expose()
  @SwaggerResponseProperty({ type: "number" })
  reps: number;

  @Expose()
  @SwaggerResponseProperty({ type: "number" })
  sets: number;

  @Expose()
  @SwaggerResponseProperty({ type: "string" })
  instructions: string;

  @Expose()
  @SwaggerResponseProperty({ type: "string" })
  benefits: string;

  @Expose()
  @SwaggerResponseProperty({ type: TargetMuscles })
  targetMuscles: any;

  @Expose()
  @SwaggerResponseProperty({ type: ["string"] })
  equipments: any;
  
  @Expose()
  @SwaggerResponseProperty('string')
  coverImage: string;

  @Expose({ name: "media" })
  @SwaggerResponseProperty({ type: Media })
  @Transform(({ value }) => serialize(value, Media))
  media: Media;
}