File size: 1,198 Bytes
e22ef60
339fa48
 
e22ef60
339fa48
 
 
5bd994f
 
 
e22ef60
339fa48
 
 
 
 
 
 
 
b561958
 
 
 
339fa48
 
e22ef60
 
 
339fa48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { Expose, Transform } from "class-transformer";
import { SwaggerResponseProperty } from "@lib/decorators/swagger-response-property.decorator";
import { IngredientSerialization } from "./ingredient.serialization";
import { serialize } from "@helpers/serialize";


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

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

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

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

  @Expose()
  @SwaggerResponseProperty({ type: [IngredientSerialization] })
  @Transform(
    ({ value }) => serialize(value, IngredientSerialization)
  )
  ingredients: any;

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

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

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

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

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