Spaces:
Running
Running
File size: 979 Bytes
a99a515 a46fc66 a99a515 |
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 |
import { Expose, Transform } from "class-transformer";
import { serialize } from "@helpers/serialize";
class Preferences {
@Expose()
fitness_goal: string;
@Expose()
target_weight: number;
@Expose()
workout_frequency: number;
@Expose()
preferred_days: any;
@Expose()
workout_place: string;
@Expose()
preferred_equipment: any;
}
export class UserSerialization {
@Expose({ name: "_id" })
id: string;
@Expose()
name: string;
@Expose()
email: string;
@Expose()
image: object;
@Expose()
role: string;
@Expose()
gender: string;
@Expose({ name: "dob" })
@Transform(
({ value }) => new Date().getFullYear() - (new Date(value).getFullYear())
)
age: number;
@Expose()
height: number;
@Expose()
weight: number;
@Expose()
fitness_level: string;
@Expose({ name: "preferences" })
@Transform(
({ value }) => serialize(value, Preferences)
)
preferences: object;
@Expose()
injuries: any;
} |