moahmedwafy commited on
Commit
d8b75ae
·
unverified ·
2 Parent(s): 8a3b286 169f8e5

Merge pull request #82 from Modarb-Ai-Trainer/updates

Browse files
src/common/models/user.model.ts CHANGED
@@ -26,11 +26,11 @@ export interface IUser {
26
  fitness_goal: FitnessGoal;
27
  target_weight: number;
28
  workout_frequency: number;
29
- preferred_days: [PreferredDay];
30
  workout_place: WorkoutPlace;
31
- preferred_equipment: [PreferredEquipment];
32
  };
33
- injuries: [Injury];
34
  }
35
 
36
  const userSchema = new Schema({
 
26
  fitness_goal: FitnessGoal;
27
  target_weight: number;
28
  workout_frequency: number;
29
+ preferred_days: PreferredDay[];
30
  workout_place: WorkoutPlace;
31
+ preferred_equipment: PreferredEquipment[];
32
  };
33
+ injuries: Injury[];
34
  }
35
 
36
  const userSchema = new Schema({
src/modules/users/modules/user-registered-workouts/controllers/user-registered-workouts.controller.ts CHANGED
@@ -2,7 +2,7 @@ import { UserRegisteredWorkoutsService } from "../services/user-registered-worko
2
  import { Request, Response } from "express";
3
  import { JsonResponse } from "@lib/responses/json-response";
4
  import { parsePaginationQuery } from "@helpers/pagination";
5
- import { paramsValidator, bodyValidator } from "@helpers/validation.helper";
6
  import { asyncHandler } from "@helpers/async-handler";
7
  import { BaseController } from "@lib/controllers/controller.base";
8
  import { Controller } from "@lib/decorators/controller.decorator";
@@ -14,12 +14,14 @@ import { UsersGuardMiddleware } from "modules/users/common/guards/users.guard";
14
  import { createUserRegisteredWorkoutsSchema } from "../validations/create-user-registered-workouts.validation";
15
  import {
16
  SwaggerGet,
 
17
  SwaggerPost,
18
  } from "@lib/decorators/swagger-routes.decorator";
19
  import { SwaggerSummary } from "@lib/decorators/swagger-summary.decorator";
20
  import { SwaggerDescription } from "@lib/decorators/swagger-description.decorator";
21
  import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
22
- import { SwaggerRequest } from "@lib/decorators/swagger-request.decorator"; 4
 
23
 
24
 
25
  interface userRequest extends Request {
@@ -33,40 +35,45 @@ export class userRegisteredWorkoutsController extends BaseController {
33
 
34
  setRoutes(): void {
35
  this.router.get("/:id", asyncHandler(this.get));
36
- // this.router.get("/", asyncHandler(this.list));
37
- // this.router.post(
38
- // "/",
39
- // bodyValidator(createUserRegisteredWorkoutsSchema),
40
- // asyncHandler(this.create)
41
- // );
 
 
 
 
 
42
  }
43
 
44
- // @SwaggerGet()
45
- // @SwaggerResponse([UserRegisteredWorkoutsPopulateSerialization])
46
- // @SwaggerSummary("List my workouts")
47
- // @SwaggerDescription("List all user registered workouts (workouts that the user had started)")
48
- // list = async (req: userRequest, res: Response) => {
49
- // const paginationQuery = parsePaginationQuery(req.query);
50
- // const { docs, paginationData } =
51
- // await this.userRegisteredWorkoutsService.list(
52
- // { user: req.jwtPayload.id, is_active: true },
53
- // paginationQuery,
54
- // {
55
- // populateArray: [
56
- // { path: "workout" },
57
- // { path: "weeks.days.exercises" },
58
- // ],
59
- // }
60
- // );
61
 
62
- // return JsonResponse.success(
63
- // {
64
- // data: serialize(docs, UserRegisteredWorkoutsPopulateSerialization),
65
- // meta: paginationData,
66
- // },
67
- // res
68
- // );
69
- // };
70
 
71
  @SwaggerGet("/:id")
72
  @SwaggerResponse(UserRegisteredWorkoutsPopulateSerialization)
@@ -95,19 +102,39 @@ export class userRegisteredWorkoutsController extends BaseController {
95
  };
96
 
97
 
98
- // @SwaggerPost()
99
- // @SwaggerResponse(UserRegisteredWorkoutsSerialization)
100
- // @SwaggerRequest(createUserRegisteredWorkoutsSchema)
101
- // @SwaggerSummary("Create workout")
102
- // @SwaggerDescription("Create a new workout for the user")
103
- // create = async (req: userRequest, res: Response) => {
104
- // const data = await this.userRegisteredWorkoutsService.create(req.body);
105
- // return JsonResponse.success(
106
- // {
107
- // status: 201,
108
- // data: serialize(data.toJSON(), UserRegisteredWorkoutsSerialization),
109
- // },
110
- // res
111
- // );
112
- // };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  }
 
2
  import { Request, Response } from "express";
3
  import { JsonResponse } from "@lib/responses/json-response";
4
  import { parsePaginationQuery } from "@helpers/pagination";
5
+ import { bodyValidator } from "@helpers/validation.helper";
6
  import { asyncHandler } from "@helpers/async-handler";
7
  import { BaseController } from "@lib/controllers/controller.base";
8
  import { Controller } from "@lib/decorators/controller.decorator";
 
14
  import { createUserRegisteredWorkoutsSchema } from "../validations/create-user-registered-workouts.validation";
15
  import {
16
  SwaggerGet,
17
+ SwaggerPatch,
18
  SwaggerPost,
19
  } from "@lib/decorators/swagger-routes.decorator";
20
  import { SwaggerSummary } from "@lib/decorators/swagger-summary.decorator";
21
  import { SwaggerDescription } from "@lib/decorators/swagger-description.decorator";
22
  import { SwaggerResponse } from "@lib/decorators/swagger-response.decorator";
23
+ import { SwaggerRequest } from "@lib/decorators/swagger-request.decorator";import { updateUserRegisteredWorkoutsSchema } from "../validations/update-user-registered-workouts.validation";
24
+ 4
25
 
26
 
27
  interface userRequest extends Request {
 
35
 
36
  setRoutes(): void {
37
  this.router.get("/:id", asyncHandler(this.get));
38
+ this.router.get("/", asyncHandler(this.list));
39
+ this.router.post(
40
+ "/",
41
+ bodyValidator(createUserRegisteredWorkoutsSchema),
42
+ asyncHandler(this.create)
43
+ );
44
+ this.router.patch(
45
+ "/:id/progress/:week/:day",
46
+ bodyValidator(updateUserRegisteredWorkoutsSchema),
47
+ asyncHandler(this.updateProgress)
48
+ );
49
  }
50
 
51
+ @SwaggerGet()
52
+ @SwaggerResponse([UserRegisteredWorkoutsPopulateSerialization])
53
+ @SwaggerSummary("List my workouts")
54
+ @SwaggerDescription("List all user registered workouts (workouts that the user had started)")
55
+ list = async (req: userRequest, res: Response) => {
56
+ const paginationQuery = parsePaginationQuery(req.query);
57
+ const { docs, paginationData } =
58
+ await this.userRegisteredWorkoutsService.list(
59
+ { user: req.jwtPayload.id, is_active: true },
60
+ paginationQuery,
61
+ {
62
+ populateArray: [
63
+ { path: "workout" },
64
+ { path: "weeks.days.exercises" },
65
+ ],
66
+ }
67
+ );
68
 
69
+ return JsonResponse.success(
70
+ {
71
+ data: serialize(docs, UserRegisteredWorkoutsPopulateSerialization),
72
+ meta: paginationData,
73
+ },
74
+ res
75
+ );
76
+ };
77
 
78
  @SwaggerGet("/:id")
79
  @SwaggerResponse(UserRegisteredWorkoutsPopulateSerialization)
 
102
  };
103
 
104
 
105
+ @SwaggerPost()
106
+ @SwaggerResponse(UserRegisteredWorkoutsSerialization)
107
+ @SwaggerRequest(createUserRegisteredWorkoutsSchema)
108
+ @SwaggerSummary("Create workout")
109
+ @SwaggerDescription("Create a new workout for the user")
110
+ create = async (req: userRequest, res: Response) => {
111
+ const data = await this.userRegisteredWorkoutsService.createForUser(req.body, req.jwtPayload.id);
112
+ return JsonResponse.success(
113
+ {
114
+ status: 201,
115
+ data: serialize(data.toJSON(), UserRegisteredWorkoutsSerialization),
116
+ },
117
+ res
118
+ );
119
+ };
120
+
121
+ @SwaggerPatch('/:id/progress/:week/:day')
122
+ @SwaggerResponse({})
123
+ @SwaggerRequest(updateUserRegisteredWorkoutsSchema)
124
+ @SwaggerSummary("Update Workout Progress")
125
+ @SwaggerDescription("Update the progress of a workout")
126
+ updateProgress = async (req: userRequest, res: Response) => {
127
+ const urwId: string = req.params.id;
128
+ const weekNumber: number = Number(req.params.week);
129
+ const dayNumber: number = Number(req.params.day);
130
+ await this.userRegisteredWorkoutsService.updateForUser({
131
+ urwId, weekNumber, dayNumber
132
+ }, req.body, req.jwtPayload.id);
133
+ return JsonResponse.success(
134
+ {
135
+ message: "Workout updated successfully",
136
+ },
137
+ res
138
+ );
139
+ };
140
  }
src/modules/users/modules/user-registered-workouts/services/user-registered-workouts.service.ts CHANGED
@@ -1,4 +1,50 @@
1
  import { UserRegisteredWorkout } from "@common/models/user-registered-workout.model";
2
  import { CrudService } from "@lib/services/crud.service";
 
 
 
 
3
 
4
- export class UserRegisteredWorkoutsService extends CrudService(UserRegisteredWorkout) {}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import { UserRegisteredWorkout } from "@common/models/user-registered-workout.model";
2
  import { CrudService } from "@lib/services/crud.service";
3
+ import { ICreateUserRegisteredWorkouts } from "../validations/create-user-registered-workouts.validation";
4
+ import { WorkoutService } from "../../workouts/services/workouts.service";
5
+ import { IUpdateUserRegisteredWorkouts } from "../validations/update-user-registered-workouts.validation";
6
+ import { HttpError } from "@lib/error-handling/http-error";
7
 
8
+ export class UserRegisteredWorkoutsService extends CrudService(UserRegisteredWorkout) {
9
+ private workoutsService: WorkoutService = new WorkoutService();
10
+
11
+ async createForUser(data: ICreateUserRegisteredWorkouts, userId: string) {
12
+ const workout = await this.workoutsService.findOneOrFail({
13
+ _id: data.workout,
14
+ });
15
+ return await this.create({
16
+ ...data,
17
+ user: userId,
18
+ weeks: workout.template_weeks,
19
+ is_active: true,
20
+ });
21
+ }
22
+
23
+ async updateForUser(workoutProps: {urwId: string; weekNumber: number; dayNumber: number}, data: IUpdateUserRegisteredWorkouts, userId: string) {
24
+ // find workout
25
+ const workout = await this.findOneOrFail({
26
+ _id: workoutProps.urwId,
27
+ user: userId,
28
+ });
29
+
30
+ // find week
31
+ const week = workout.weeks.find(w => w.week_number === workoutProps.weekNumber);
32
+ if(!week) throw new HttpError(404, 'Workout Week Not Found');
33
+ const weekIndex = workout.weeks.indexOf(week);
34
+
35
+ // find day
36
+ const day = week.days.find(d => d.day_number === workoutProps.dayNumber);
37
+ if(!day) throw new HttpError(404, 'Workout Day Not Found');
38
+ const dayIndex = week.days.indexOf(day)
39
+
40
+ // update day and week
41
+ day.is_done = true;
42
+ week.days[dayIndex] = day;
43
+ week.is_done = week.days.every(d => d.is_done);
44
+ workout.weeks[weekIndex] = week;
45
+
46
+ // save changes
47
+ workout.markModified('weeks');
48
+ return workout.save()
49
+ }
50
+ }
src/modules/users/modules/user-registered-workouts/validations/create-user-registered-workouts.validation.ts CHANGED
@@ -26,92 +26,9 @@ export interface ICreateUserRegisteredWorkouts {
26
  }
27
 
28
  export const createUserRegisteredWorkoutsSchema = createSchema<ICreateUserRegisteredWorkouts>({
29
- user: joi.string().empty().required().messages({
30
- "string.base": "please enter a valid user id",
31
- "any.required": "user id is required",
32
- "string.empty": "user id can not be empty",
33
- }),
34
- is_active: joi.boolean().empty().optional().messages({
35
- "boolean.base": "please enter a valid isActive",
36
- "boolean.empty": "isActive can not be empty",
37
- }),
38
- workout: joi.string().empty().required().messages({
39
- "string.base": "please enter a valid workout id",
40
- "any.required": "workout id is required",
41
- "string.empty": "workout id can not be empty",
42
- }),
43
- weeks: joi.array().empty().required().items(
44
- joi.object({
45
- week_number: joi.number().integer().empty().required().messages({
46
- "number.base": "please enter a valid week number",
47
- "any.required": "week number is required",
48
- "number.empty": "week number can not be empty",
49
- "number.integer": "week number must be an integer",
50
- }),
51
- week_name: joi.string().empty().required().messages({
52
- "string.base": "please enter a valid week name",
53
- "any.required": "week name is required",
54
- "string.empty": "week name can not be empty",
55
- }),
56
- week_description: joi.string().empty().required().messages({
57
- "string.base": "please enter a valid week description",
58
- "any.required": "week description is required",
59
- "string.empty": "week description can not be empty",
60
- }),
61
- is_done: joi.boolean().empty().optional().messages({
62
- "boolean.base": "please enter a valid isDone",
63
- "boolean.empty": "isDone can not be empty",
64
- }),
65
- days: joi.array().required().items(
66
- joi.object({
67
- day_number: joi.number().empty().integer().min(1).max(7).required().messages({
68
- "number.base": "Please enter a valid day number",
69
- "any.required": "day number is required",
70
- "number.empty": "day number cannot be empty",
71
- "number.integer": "day number must be an integer",
72
- "number.min": "day number must be between 1 and 7",
73
- "number.max": "day number must be between 1 and 7"
74
- }),
75
- total_number_exercises: joi.number().empty().integer().required().messages({
76
- "number.base": "Please enter a valid total number exercises",
77
- "any.required": "total number exercises is required",
78
- "number.empty": "total number exercises cannot be empty",
79
- "number.integer": "total number exercises must be an integer",
80
- }),
81
- day_type: joi.string().empty().required().messages({
82
- "string.base": "please enter a valid day type",
83
- "any.required": "day type is required",
84
- "string.empty": "day type can not be empty",
85
- }),
86
- exercises: joi.array().empty().required().items(
87
- joi.string().empty().required().messages({
88
- "string.base": "please enter a valid exercise id",
89
- "any.required": "exercise id is required",
90
- "string.empty": "exercise id can not be empty",
91
- }),).messages({
92
- "array.base": "please enter a valid exercises array",
93
- "any.required": "exercises array is required",
94
- "array.empty": "exercises array can not be empty",
95
- }),
96
- is_done: joi.boolean().empty().optional().messages({
97
- "boolean.base": "please enter a valid isDone",
98
- "boolean.empty": "isDone can not be empty",
99
- }),
100
- }).empty().messages({
101
- "object.base": "please enter a valid day object",
102
- "any.required": "day object is required",
103
- "object.empty": "day object can not be empty",
104
- })
105
- ),
106
- }).empty().messages({
107
- "array.base": "please enter a valid days array",
108
- "any.required": "days array is required",
109
- "array.empty": "days array can not be empty",
110
-
111
- })
112
- ).messages({
113
- "array.base": "please enter a valid weeks array",
114
- "any.required": "weeks array is required",
115
- "array.empty": "weeks array can not be empty",
116
- }),
117
- });
 
26
  }
27
 
28
  export const createUserRegisteredWorkoutsSchema = createSchema<ICreateUserRegisteredWorkouts>({
29
+ workout: joi.string().empty().required().messages({
30
+ "string.base": "please enter a valid workout id",
31
+ "any.required": "workout id is required",
32
+ "string.empty": "workout id can not be empty",
33
+ }),
34
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/modules/users/modules/user-registered-workouts/validations/update-user-registered-workouts.validation.ts CHANGED
@@ -2,105 +2,8 @@ import * as joi from "joi";
2
  import { createSchema } from "@helpers/create-schema";
3
 
4
 
5
-
6
  export interface IUpdateUserRegisteredWorkouts {
7
- user?: string;
8
- workout?: string;
9
- is_active?: Boolean;
10
- weeks?: [
11
- {
12
- week_number?: number;
13
- week_name?: string,
14
- week_description?: string,
15
- is_done?: boolean,
16
- days?: [
17
- {
18
- day_number?: number,
19
- total_number_exercises?: number,
20
- day_type?: string,
21
- exercises?: [string],
22
- is_done?: boolean,
23
- },
24
- ],
25
- },
26
- ]
27
  }
28
 
29
-
30
  export const updateUserRegisteredWorkoutsSchema = createSchema<IUpdateUserRegisteredWorkouts>({
31
- user: joi.string().empty().optional().messages({
32
- "string.base": "please enter a valid user id",
33
- "string.empty": "user id can not be empty",
34
- }),
35
- is_active: joi.boolean().empty().optional().messages({
36
- "boolean.base": "please enter a valid isActive",
37
- "boolean.empty": "isActive can not be empty",
38
- }),
39
- workout: joi.string().empty().optional().messages({
40
- "string.base": "please enter a valid workout id",
41
- "string.empty": "workout id can not be empty",
42
- }),
43
- weeks: joi.array().empty().optional().items(
44
- joi.object({
45
- week_number: joi.number().integer().empty().optional().messages({
46
- "number.base": "please enter a valid week number",
47
- "number.empty": "week number can not be empty",
48
- "number.integer": "week number must be an integer",
49
- }),
50
- week_name: joi.string().empty().optional().messages({
51
- "string.base": "please enter a valid week name",
52
- "string.empty": "week name can not be empty",
53
- }),
54
- week_description: joi.string().empty().optional().messages({
55
- "string.base": "please enter a valid week description",
56
- "string.empty": "week description can not be empty",
57
- }),
58
- is_done: joi.boolean().empty().optional().messages({
59
- "boolean.base": "please enter a valid isDone",
60
- "boolean.empty": "isDone can not be empty",
61
- }),
62
- days: joi.array().optional().items(
63
- joi.object({
64
- day_number: joi.number().empty().integer().min(1).max(7).optional().messages({
65
- "number.base": "Please enter a valid day number",
66
- "number.empty": "day number cannot be empty",
67
- "number.integer": "day number must be an integer",
68
- "number.min": "day number must be between 1 and 7",
69
- "number.max": "day number must be between 1 and 7"
70
- }),
71
- total_number_exercises: joi.number().empty().integer().optional().messages({
72
- "number.base": "Please enter a valid total number exercises",
73
- "number.empty": "total number exercises cannot be empty",
74
- "number.integer": "total number exercises must be an integer",
75
- }),
76
- day_type: joi.string().empty().optional().messages({
77
- "string.base": "please enter a valid day type",
78
- "string.empty": "day type can not be empty",
79
- }),
80
- exercises: joi.array().empty().optional().items(
81
- joi.string().empty().optional().messages({
82
- "string.base": "please enter a valid exercise id",
83
- "string.empty": "exercise id can not be empty",
84
- }),).messages({
85
- "array.base": "please enter a valid exercises array",
86
- "array.empty": "exercises array can not be empty",
87
- }),
88
- is_done: joi.boolean().empty().optional().messages({
89
- "boolean.base": "please enter a valid isDone",
90
- "boolean.empty": "isDone can not be empty",
91
- }),
92
- }).empty().messages({
93
- "object.base": "please enter a valid day object",
94
- "object.empty": "day object can not be empty",
95
- })
96
- ),
97
- }).empty().messages({
98
- "array.base": "please enter a valid days array",
99
- "array.empty": "days array can not be empty",
100
-
101
- })
102
- ).messages({
103
- "array.base": "please enter a valid weeks array",
104
- "array.empty": "weeks array can not be empty",
105
- }),
106
- });
 
2
  import { createSchema } from "@helpers/create-schema";
3
 
4
 
 
5
  export interface IUpdateUserRegisteredWorkouts {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  }
7
 
 
8
  export const updateUserRegisteredWorkoutsSchema = createSchema<IUpdateUserRegisteredWorkouts>({
9
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/seeder/seeders/admins.seeder.ts CHANGED
@@ -5,11 +5,11 @@ import { seederWrapper } from "seeder/helpers/seeder-wrapper";
5
  export default seederWrapper(Admin, async () => {
6
  // create super admin
7
  await Admin.create({
 
8
  email: "[email protected]",
9
  password: "super",
10
- role: Role.SUPER_ADMIN,
11
  gender: "M1 Abrams Tank",
12
- name: "Super Admin",
13
- dob: new Date(),
14
  });
15
  });
 
5
  export default seederWrapper(Admin, async () => {
6
  // create super admin
7
  await Admin.create({
8
+ name: "Super Admin",
9
  email: "[email protected]",
10
  password: "super",
11
+ image: `https://placehold.co/300x400`,
12
  gender: "M1 Abrams Tank",
13
+ role: Role.SUPER_ADMIN,
 
14
  });
15
  });
src/seeder/seeders/users.seeder.ts ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { AuthenticatableType } from "@common/enums/authenticatable-type.enum";
2
+ import { FitnessGoal } from "@common/enums/fitness-goal.enum";
3
+ import { FitnessLevel } from "@common/enums/fitness-level.enum";
4
+ import { Injury } from "@common/enums/injury.enum";
5
+ import { PreferredDay } from "@common/enums/preferred-day.enum";
6
+ import { PreferredEquipment } from "@common/enums/preferred-equipment.enum";
7
+ import { WorkoutPlace } from "@common/enums/workout-place.enum";
8
+ import { IUser, User } from "@common/models/user.model";
9
+ import { seederWrapper } from "seeder/helpers/seeder-wrapper";
10
+
11
+ export default seederWrapper(User, async () => {
12
+ // 10 users
13
+ await Promise.all(Array.from({ length: 10 }, (_, i) => i).map(async function (i) {
14
+ const o: IUser = {
15
+ name: `User ${i}`,
16
+ email: `user-${i}@app.com`,
17
+ password: "password",
18
+ image: `https://placehold.co/300x400`,
19
+ gender: (i as number % 2 === 0) ?
20
+ 'male' :
21
+ 'female',
22
+ height: 170,
23
+ weight: 70,
24
+ fitness_level: [FitnessLevel.BEGINNER, FitnessLevel.INTERMEDIATE, FitnessLevel.ADVANCED][i % 3],
25
+ preferences: {
26
+ fitness_goal: [FitnessGoal.LOSE_WEIGHT, FitnessGoal.GAIN_MUSCLE, FitnessGoal.GET_FITTER][i % 3],
27
+ target_weight: 60,
28
+ workout_frequency: 3,
29
+ preferred_days: [PreferredDay.MONDAY, PreferredDay.TUESDAY, PreferredDay.WEDNESDAY],
30
+ workout_place: [WorkoutPlace.GYM, WorkoutPlace.HOME, WorkoutPlace.BOTH][i % 3],
31
+ preferred_equipment: [[PreferredEquipment.BARBELLS, PreferredEquipment.DUMBBELLS, PreferredEquipment.GYM_MACHINES, PreferredEquipment.RESISTANCE_BAND, PreferredEquipment.BODYWEIGHT][i % 5]],
32
+ },
33
+ injuries: [[Injury.ARMS, Injury.BACK, Injury.NECK, Injury.SHOULDERS, Injury.KNEES][i % 5]],
34
+ dob: new Date(1990, 1, 1),
35
+ role: AuthenticatableType.USER,
36
+ };
37
+ await User.create(o);
38
+ }))
39
+ })