gymmonk-schema 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/announcement.d.ts +56 -0
- package/dist/announcement.d.ts.map +1 -0
- package/dist/announcement.js +40 -0
- package/dist/announcement.js.map +1 -0
- package/dist/center.d.ts +381 -0
- package/dist/center.d.ts.map +1 -0
- package/dist/center.js +96 -0
- package/dist/center.js.map +1 -0
- package/dist/common.d.ts +28 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +37 -0
- package/dist/common.js.map +1 -1
- package/dist/equipment.d.ts +93 -0
- package/dist/equipment.d.ts.map +1 -0
- package/dist/equipment.js +54 -0
- package/dist/equipment.js.map +1 -0
- package/dist/exercise.d.ts +234 -0
- package/dist/exercise.d.ts.map +1 -0
- package/dist/exercise.js +93 -0
- package/dist/exercise.js.map +1 -0
- package/dist/feedback.d.ts +119 -0
- package/dist/feedback.d.ts.map +1 -0
- package/dist/feedback.js +77 -0
- package/dist/feedback.js.map +1 -0
- package/dist/home.d.ts +74 -0
- package/dist/home.d.ts.map +1 -0
- package/dist/home.js +28 -0
- package/dist/home.js.map +1 -0
- package/dist/index.d.ts +27 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -5
- package/dist/index.js.map +1 -1
- package/dist/insights.d.ts +143 -0
- package/dist/insights.d.ts.map +1 -0
- package/dist/insights.js +79 -0
- package/dist/insights.js.map +1 -0
- package/dist/member-profile.d.ts +312 -0
- package/dist/member-profile.d.ts.map +1 -0
- package/dist/member-profile.js +103 -0
- package/dist/member-profile.js.map +1 -0
- package/dist/member.d.ts +365 -0
- package/dist/member.d.ts.map +1 -0
- package/dist/member.js +169 -0
- package/dist/member.js.map +1 -0
- package/dist/membership-plan.d.ts +244 -0
- package/dist/membership-plan.d.ts.map +1 -0
- package/dist/membership-plan.js +80 -0
- package/dist/membership-plan.js.map +1 -0
- package/dist/membership.d.ts +154 -0
- package/dist/membership.d.ts.map +1 -0
- package/dist/membership.js +103 -0
- package/dist/membership.js.map +1 -0
- package/dist/notification.d.ts +59 -0
- package/dist/notification.d.ts.map +1 -0
- package/dist/notification.js +49 -0
- package/dist/notification.js.map +1 -0
- package/dist/onboarding.d.ts +361 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +74 -0
- package/dist/onboarding.js.map +1 -0
- package/dist/organisation.d.ts +199 -0
- package/dist/organisation.d.ts.map +1 -0
- package/dist/organisation.js +51 -0
- package/dist/organisation.js.map +1 -0
- package/dist/owner-profile.d.ts +50 -0
- package/dist/owner-profile.d.ts.map +1 -0
- package/dist/owner-profile.js +34 -0
- package/dist/owner-profile.js.map +1 -0
- package/dist/pricing.d.ts +103 -0
- package/dist/pricing.d.ts.map +1 -0
- package/dist/pricing.js +73 -0
- package/dist/pricing.js.map +1 -0
- package/dist/session.d.ts +90 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +59 -0
- package/dist/session.js.map +1 -0
- package/dist/shared.d.ts +199 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +107 -0
- package/dist/shared.js.map +1 -0
- package/dist/staff.d.ts +288 -0
- package/dist/staff.d.ts.map +1 -0
- package/dist/staff.js +115 -0
- package/dist/staff.js.map +1 -0
- package/dist/subscription.d.ts +69 -0
- package/dist/subscription.d.ts.map +1 -0
- package/dist/subscription.js +47 -0
- package/dist/subscription.js.map +1 -0
- package/dist/user.d.ts +63 -0
- package/dist/user.d.ts.map +1 -0
- package/dist/user.js +44 -0
- package/dist/user.js.map +1 -0
- package/dist/workout-plan.d.ts +201 -0
- package/dist/workout-plan.d.ts.map +1 -0
- package/dist/workout-plan.js +71 -0
- package/dist/workout-plan.js.map +1 -0
- package/package.json +1 -1
package/dist/user.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Authenticated user identity ("me")
|
|
3
|
+
* ===================================================
|
|
4
|
+
* The identity the whole app boots from — the shape of `GET /users/me`, mirrored
|
|
5
|
+
* from the auth-synced `User`. This is the SSOT for the signed-in user's name,
|
|
6
|
+
* avatar, email, phone, platform roles and status; the member/owner profile
|
|
7
|
+
* modules layer product-specific data on top of it.
|
|
8
|
+
*
|
|
9
|
+
* @module gymmonk-schema/user
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { isoDateTimeSchema, objectIdSchema, optionalTrimmedString, phoneSchema } from './common.js';
|
|
13
|
+
// ─── Platform roles & status ─────────────────────────────────────────────────
|
|
14
|
+
/** Platform-wide roles (empty for most users). Distinct from gym owner/member. */
|
|
15
|
+
export const appRoleSchema = z.enum(['support_agent', 'moderator', 'manager', 'superadmin']);
|
|
16
|
+
export const userStatusSchema = z.enum(['active', 'inactive', 'suspended', 'deleted']);
|
|
17
|
+
// ─── The "me" entity ─────────────────────────────────────────────────────────
|
|
18
|
+
export const meSchema = z.object({
|
|
19
|
+
id: objectIdSchema,
|
|
20
|
+
email: z.string(),
|
|
21
|
+
firstName: z.string(),
|
|
22
|
+
lastName: z.string().nullable(),
|
|
23
|
+
/** Free, user-chosen display name (falls back to first/last at the edge). */
|
|
24
|
+
displayName: z.string().nullable(),
|
|
25
|
+
phone: z.string().nullable(),
|
|
26
|
+
avatar: z.string().nullable(),
|
|
27
|
+
appRoles: z.array(appRoleSchema),
|
|
28
|
+
status: userStatusSchema,
|
|
29
|
+
createdAt: isoDateTimeSchema,
|
|
30
|
+
updatedAt: isoDateTimeSchema,
|
|
31
|
+
});
|
|
32
|
+
// ─── Update the caller's own identity fields ─────────────────────────────────
|
|
33
|
+
/**
|
|
34
|
+
* Patch the product-owned identity fields (name/displayName/phone/avatar).
|
|
35
|
+
* `email` is auth-owned and never updated here.
|
|
36
|
+
*/
|
|
37
|
+
export const updateUserBodySchema = z.object({
|
|
38
|
+
firstName: optionalTrimmedString(80),
|
|
39
|
+
lastName: optionalTrimmedString(80),
|
|
40
|
+
displayName: optionalTrimmedString(100),
|
|
41
|
+
phone: z.preprocess((v) => (typeof v === 'string' && v.trim() === '' ? undefined : v), phoneSchema.optional()),
|
|
42
|
+
avatar: optionalTrimmedString(2000),
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=user.js.map
|
package/dist/user.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../src/user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEpG,gFAAgF;AAEhF,kFAAkF;AAClF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;AAG7F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;AAGvF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,EAAE,EAAE,cAAc;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,6EAA6E;IAC7E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;IAChC,MAAM,EAAE,gBAAgB;IACxB,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC;AAGH,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,SAAS,EAAE,qBAAqB,CAAC,EAAE,CAAC;IACpC,QAAQ,EAAE,qBAAqB,CAAC,EAAE,CAAC;IACnC,WAAW,EAAE,qBAAqB,CAAC,GAAG,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,UAAU,CACjB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,EACjE,WAAW,CAAC,QAAQ,EAAE,CACvB;IACD,MAAM,EAAE,qBAAqB,CAAC,IAAI,CAAC;CACpC,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Authenticated user identity (\"me\")\n * ===================================================\n * The identity the whole app boots from — the shape of `GET /users/me`, mirrored\n * from the auth-synced `User`. This is the SSOT for the signed-in user's name,\n * avatar, email, phone, platform roles and status; the member/owner profile\n * modules layer product-specific data on top of it.\n *\n * @module gymmonk-schema/user\n */\n\nimport { z } from 'zod';\nimport { isoDateTimeSchema, objectIdSchema, optionalTrimmedString, phoneSchema } from './common.js';\n\n// ─── Platform roles & status ─────────────────────────────────────────────────\n\n/** Platform-wide roles (empty for most users). Distinct from gym owner/member. */\nexport const appRoleSchema = z.enum(['support_agent', 'moderator', 'manager', 'superadmin']);\nexport type AppRole = z.infer<typeof appRoleSchema>;\n\nexport const userStatusSchema = z.enum(['active', 'inactive', 'suspended', 'deleted']);\nexport type UserStatus = z.infer<typeof userStatusSchema>;\n\n// ─── The \"me\" entity ─────────────────────────────────────────────────────────\n\nexport const meSchema = z.object({\n id: objectIdSchema,\n email: z.string(),\n firstName: z.string(),\n lastName: z.string().nullable(),\n /** Free, user-chosen display name (falls back to first/last at the edge). */\n displayName: z.string().nullable(),\n phone: z.string().nullable(),\n avatar: z.string().nullable(),\n appRoles: z.array(appRoleSchema),\n status: userStatusSchema,\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Me = z.infer<typeof meSchema>;\n\n// ─── Update the caller's own identity fields ─────────────────────────────────\n\n/**\n * Patch the product-owned identity fields (name/displayName/phone/avatar).\n * `email` is auth-owned and never updated here.\n */\nexport const updateUserBodySchema = z.object({\n firstName: optionalTrimmedString(80),\n lastName: optionalTrimmedString(80),\n displayName: optionalTrimmedString(100),\n phone: z.preprocess(\n (v) => (typeof v === 'string' && v.trim() === '' ? undefined : v),\n phoneSchema.optional(),\n ),\n avatar: optionalTrimmedString(2000),\n});\nexport type UpdateUserBody = z.infer<typeof updateUserBodySchema>;\n"]}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Workout plans (routines)
|
|
3
|
+
* ==========================================
|
|
4
|
+
* A weekly training routine an owner builds from library exercises and assigns
|
|
5
|
+
* to members. Each day carries prescribed exercises (sets / reps / rest). The
|
|
6
|
+
* prescription is stored by exercise ref; the API populates a summary for
|
|
7
|
+
* rendering.
|
|
8
|
+
*
|
|
9
|
+
* @module gymmonk-schema/workout-plan
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
/** One exercise slot in a plan day, referencing a library exercise. */
|
|
13
|
+
export declare const planExerciseInputSchema: z.ZodObject<{
|
|
14
|
+
exerciseId: z.ZodString;
|
|
15
|
+
sets: z.ZodNumber;
|
|
16
|
+
reps: z.ZodString;
|
|
17
|
+
restSec: z.ZodNumber;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type PlanExerciseInput = z.infer<typeof planExerciseInputSchema>;
|
|
20
|
+
export declare const workoutPlanDayInputSchema: z.ZodObject<{
|
|
21
|
+
weekday: z.ZodEnum<{
|
|
22
|
+
mon: "mon";
|
|
23
|
+
tue: "tue";
|
|
24
|
+
wed: "wed";
|
|
25
|
+
thu: "thu";
|
|
26
|
+
fri: "fri";
|
|
27
|
+
sat: "sat";
|
|
28
|
+
sun: "sun";
|
|
29
|
+
}>;
|
|
30
|
+
exercises: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
31
|
+
exerciseId: z.ZodString;
|
|
32
|
+
sets: z.ZodNumber;
|
|
33
|
+
reps: z.ZodString;
|
|
34
|
+
restSec: z.ZodNumber;
|
|
35
|
+
}, z.core.$strip>>>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type WorkoutPlanDayInput = z.infer<typeof workoutPlanDayInputSchema>;
|
|
38
|
+
/** A plan-day exercise with its populated library summary + prescription. */
|
|
39
|
+
export declare const planExerciseSchema: z.ZodObject<{
|
|
40
|
+
exerciseId: z.ZodString;
|
|
41
|
+
slug: z.ZodString;
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
description: z.ZodString;
|
|
44
|
+
thumbnailUrl: z.ZodNullable<z.ZodString>;
|
|
45
|
+
difficulty: z.ZodEnum<{
|
|
46
|
+
beginner: "beginner";
|
|
47
|
+
intermediate: "intermediate";
|
|
48
|
+
advanced: "advanced";
|
|
49
|
+
}>;
|
|
50
|
+
category: z.ZodEnum<{
|
|
51
|
+
cardio: "cardio";
|
|
52
|
+
"upper-body": "upper-body";
|
|
53
|
+
"lower-body": "lower-body";
|
|
54
|
+
core: "core";
|
|
55
|
+
"full-body": "full-body";
|
|
56
|
+
}>;
|
|
57
|
+
targetArea: z.ZodString;
|
|
58
|
+
sets: z.ZodNumber;
|
|
59
|
+
reps: z.ZodString;
|
|
60
|
+
restSec: z.ZodNumber;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export type PlanExercise = z.infer<typeof planExerciseSchema>;
|
|
63
|
+
export declare const planDaySchema: z.ZodObject<{
|
|
64
|
+
weekday: z.ZodEnum<{
|
|
65
|
+
mon: "mon";
|
|
66
|
+
tue: "tue";
|
|
67
|
+
wed: "wed";
|
|
68
|
+
thu: "thu";
|
|
69
|
+
fri: "fri";
|
|
70
|
+
sat: "sat";
|
|
71
|
+
sun: "sun";
|
|
72
|
+
}>;
|
|
73
|
+
exercises: z.ZodArray<z.ZodObject<{
|
|
74
|
+
exerciseId: z.ZodString;
|
|
75
|
+
slug: z.ZodString;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
description: z.ZodString;
|
|
78
|
+
thumbnailUrl: z.ZodNullable<z.ZodString>;
|
|
79
|
+
difficulty: z.ZodEnum<{
|
|
80
|
+
beginner: "beginner";
|
|
81
|
+
intermediate: "intermediate";
|
|
82
|
+
advanced: "advanced";
|
|
83
|
+
}>;
|
|
84
|
+
category: z.ZodEnum<{
|
|
85
|
+
cardio: "cardio";
|
|
86
|
+
"upper-body": "upper-body";
|
|
87
|
+
"lower-body": "lower-body";
|
|
88
|
+
core: "core";
|
|
89
|
+
"full-body": "full-body";
|
|
90
|
+
}>;
|
|
91
|
+
targetArea: z.ZodString;
|
|
92
|
+
sets: z.ZodNumber;
|
|
93
|
+
reps: z.ZodString;
|
|
94
|
+
restSec: z.ZodNumber;
|
|
95
|
+
}, z.core.$strip>>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
|
+
export type PlanDay = z.infer<typeof planDaySchema>;
|
|
98
|
+
export declare const workoutPlanSummarySchema: z.ZodObject<{
|
|
99
|
+
id: z.ZodString;
|
|
100
|
+
centerId: z.ZodString;
|
|
101
|
+
name: z.ZodString;
|
|
102
|
+
description: z.ZodNullable<z.ZodString>;
|
|
103
|
+
focusTags: z.ZodArray<z.ZodString>;
|
|
104
|
+
createdAt: z.ZodISODateTime;
|
|
105
|
+
updatedAt: z.ZodISODateTime;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type WorkoutPlanSummary = z.infer<typeof workoutPlanSummarySchema>;
|
|
108
|
+
export declare const workoutPlanSchema: z.ZodObject<{
|
|
109
|
+
id: z.ZodString;
|
|
110
|
+
centerId: z.ZodString;
|
|
111
|
+
name: z.ZodString;
|
|
112
|
+
description: z.ZodNullable<z.ZodString>;
|
|
113
|
+
focusTags: z.ZodArray<z.ZodString>;
|
|
114
|
+
createdAt: z.ZodISODateTime;
|
|
115
|
+
updatedAt: z.ZodISODateTime;
|
|
116
|
+
days: z.ZodArray<z.ZodObject<{
|
|
117
|
+
weekday: z.ZodEnum<{
|
|
118
|
+
mon: "mon";
|
|
119
|
+
tue: "tue";
|
|
120
|
+
wed: "wed";
|
|
121
|
+
thu: "thu";
|
|
122
|
+
fri: "fri";
|
|
123
|
+
sat: "sat";
|
|
124
|
+
sun: "sun";
|
|
125
|
+
}>;
|
|
126
|
+
exercises: z.ZodArray<z.ZodObject<{
|
|
127
|
+
exerciseId: z.ZodString;
|
|
128
|
+
slug: z.ZodString;
|
|
129
|
+
name: z.ZodString;
|
|
130
|
+
description: z.ZodString;
|
|
131
|
+
thumbnailUrl: z.ZodNullable<z.ZodString>;
|
|
132
|
+
difficulty: z.ZodEnum<{
|
|
133
|
+
beginner: "beginner";
|
|
134
|
+
intermediate: "intermediate";
|
|
135
|
+
advanced: "advanced";
|
|
136
|
+
}>;
|
|
137
|
+
category: z.ZodEnum<{
|
|
138
|
+
cardio: "cardio";
|
|
139
|
+
"upper-body": "upper-body";
|
|
140
|
+
"lower-body": "lower-body";
|
|
141
|
+
core: "core";
|
|
142
|
+
"full-body": "full-body";
|
|
143
|
+
}>;
|
|
144
|
+
targetArea: z.ZodString;
|
|
145
|
+
sets: z.ZodNumber;
|
|
146
|
+
reps: z.ZodString;
|
|
147
|
+
restSec: z.ZodNumber;
|
|
148
|
+
}, z.core.$strip>>;
|
|
149
|
+
}, z.core.$strip>>;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
export type WorkoutPlan = z.infer<typeof workoutPlanSchema>;
|
|
152
|
+
export declare const createWorkoutPlanBodySchema: z.ZodObject<{
|
|
153
|
+
centerId: z.ZodString;
|
|
154
|
+
name: z.ZodString;
|
|
155
|
+
description: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
156
|
+
goals: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
157
|
+
focusTags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
158
|
+
days: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
159
|
+
weekday: z.ZodEnum<{
|
|
160
|
+
mon: "mon";
|
|
161
|
+
tue: "tue";
|
|
162
|
+
wed: "wed";
|
|
163
|
+
thu: "thu";
|
|
164
|
+
fri: "fri";
|
|
165
|
+
sat: "sat";
|
|
166
|
+
sun: "sun";
|
|
167
|
+
}>;
|
|
168
|
+
exercises: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
169
|
+
exerciseId: z.ZodString;
|
|
170
|
+
sets: z.ZodNumber;
|
|
171
|
+
reps: z.ZodString;
|
|
172
|
+
restSec: z.ZodNumber;
|
|
173
|
+
}, z.core.$strip>>>;
|
|
174
|
+
}, z.core.$strip>>>;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
export type CreateWorkoutPlanBody = z.infer<typeof createWorkoutPlanBodySchema>;
|
|
177
|
+
export declare const updateWorkoutPlanBodySchema: z.ZodObject<{
|
|
178
|
+
name: z.ZodOptional<z.ZodString>;
|
|
179
|
+
description: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
|
|
180
|
+
focusTags: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
181
|
+
days: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
182
|
+
weekday: z.ZodEnum<{
|
|
183
|
+
mon: "mon";
|
|
184
|
+
tue: "tue";
|
|
185
|
+
wed: "wed";
|
|
186
|
+
thu: "thu";
|
|
187
|
+
fri: "fri";
|
|
188
|
+
sat: "sat";
|
|
189
|
+
sun: "sun";
|
|
190
|
+
}>;
|
|
191
|
+
exercises: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
192
|
+
exerciseId: z.ZodString;
|
|
193
|
+
sets: z.ZodNumber;
|
|
194
|
+
reps: z.ZodString;
|
|
195
|
+
restSec: z.ZodNumber;
|
|
196
|
+
}, z.core.$strip>>>;
|
|
197
|
+
}, z.core.$strip>>>>;
|
|
198
|
+
goals: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
|
|
199
|
+
}, z.core.$strip>;
|
|
200
|
+
export type UpdateWorkoutPlanBody = z.infer<typeof updateWorkoutPlanBodySchema>;
|
|
201
|
+
//# sourceMappingURL=workout-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workout-plan.d.ts","sourceRoot":"","sources":["../src/workout-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,uEAAuE;AACvE,eAAO,MAAM,uBAAuB;;;;;iBAKlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;iBAGpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAI5E,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;iBAY7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGxB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAIpD,eAAO,MAAM,wBAAwB;;;;;;;;iBAQnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAE5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAI5D,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;iBAOtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;iBAE5B,CAAC;AACb,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Workout plans (routines)
|
|
3
|
+
* ==========================================
|
|
4
|
+
* A weekly training routine an owner builds from library exercises and assigns
|
|
5
|
+
* to members. Each day carries prescribed exercises (sets / reps / rest). The
|
|
6
|
+
* prescription is stored by exercise ref; the API populates a summary for
|
|
7
|
+
* rendering.
|
|
8
|
+
*
|
|
9
|
+
* @module gymmonk-schema/workout-plan
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { isoDateTimeSchema, objectIdSchema, optionalTrimmedString } from './common.js';
|
|
13
|
+
import { difficultySchema, exerciseCategorySchema } from './exercise.js';
|
|
14
|
+
import { weekdaySchema } from './shared.js';
|
|
15
|
+
// ─── Prescription (stored input) ─────────────────────────────────────────────
|
|
16
|
+
/** One exercise slot in a plan day, referencing a library exercise. */
|
|
17
|
+
export const planExerciseInputSchema = z.object({
|
|
18
|
+
exerciseId: objectIdSchema,
|
|
19
|
+
sets: z.number().int().min(1).max(20),
|
|
20
|
+
reps: z.string().trim().min(1).max(40),
|
|
21
|
+
restSec: z.number().int().min(0).max(3600),
|
|
22
|
+
});
|
|
23
|
+
export const workoutPlanDayInputSchema = z.object({
|
|
24
|
+
weekday: weekdaySchema,
|
|
25
|
+
exercises: z.array(planExerciseInputSchema).max(30).default([]),
|
|
26
|
+
});
|
|
27
|
+
// ─── Populated response shapes ───────────────────────────────────────────────
|
|
28
|
+
/** A plan-day exercise with its populated library summary + prescription. */
|
|
29
|
+
export const planExerciseSchema = z.object({
|
|
30
|
+
exerciseId: objectIdSchema,
|
|
31
|
+
slug: z.string(),
|
|
32
|
+
name: z.string(),
|
|
33
|
+
description: z.string(),
|
|
34
|
+
thumbnailUrl: z.string().nullable(),
|
|
35
|
+
difficulty: difficultySchema,
|
|
36
|
+
category: exerciseCategorySchema,
|
|
37
|
+
targetArea: z.string(),
|
|
38
|
+
sets: z.number().int(),
|
|
39
|
+
reps: z.string(),
|
|
40
|
+
restSec: z.number().int(),
|
|
41
|
+
});
|
|
42
|
+
export const planDaySchema = z.object({
|
|
43
|
+
weekday: weekdaySchema,
|
|
44
|
+
exercises: z.array(planExerciseSchema),
|
|
45
|
+
});
|
|
46
|
+
// ─── Entity ──────────────────────────────────────────────────────────────────
|
|
47
|
+
export const workoutPlanSummarySchema = z.object({
|
|
48
|
+
id: objectIdSchema,
|
|
49
|
+
centerId: objectIdSchema,
|
|
50
|
+
name: z.string(),
|
|
51
|
+
description: z.string().nullable(),
|
|
52
|
+
focusTags: z.array(z.string()),
|
|
53
|
+
createdAt: isoDateTimeSchema,
|
|
54
|
+
updatedAt: isoDateTimeSchema,
|
|
55
|
+
});
|
|
56
|
+
export const workoutPlanSchema = workoutPlanSummarySchema.extend({
|
|
57
|
+
days: z.array(planDaySchema),
|
|
58
|
+
});
|
|
59
|
+
// ─── Create / update body ────────────────────────────────────────────────────
|
|
60
|
+
export const createWorkoutPlanBodySchema = z.object({
|
|
61
|
+
centerId: objectIdSchema,
|
|
62
|
+
name: z.string().trim().min(1, 'Plan name is required').max(120),
|
|
63
|
+
description: optionalTrimmedString(2000),
|
|
64
|
+
goals: optionalTrimmedString(400),
|
|
65
|
+
focusTags: z.array(z.string().trim().max(40)).max(20).default([]),
|
|
66
|
+
days: z.array(workoutPlanDayInputSchema).max(7).default([]),
|
|
67
|
+
});
|
|
68
|
+
export const updateWorkoutPlanBodySchema = createWorkoutPlanBodySchema
|
|
69
|
+
.omit({ centerId: true })
|
|
70
|
+
.partial();
|
|
71
|
+
//# sourceMappingURL=workout-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workout-plan.js","sourceRoot":"","sources":["../src/workout-plan.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * gymmonk-schema — Workout plans (routines)\n * ==========================================\n * A weekly training routine an owner builds from library exercises and assigns\n * to members. Each day carries prescribed exercises (sets / reps / rest). The\n * prescription is stored by exercise ref; the API populates a summary for\n * rendering.\n *\n * @module gymmonk-schema/workout-plan\n */\n\nimport { z } from 'zod';\nimport { isoDateTimeSchema, objectIdSchema, optionalTrimmedString } from './common.js';\nimport { difficultySchema, exerciseCategorySchema } from './exercise.js';\nimport { weekdaySchema } from './shared.js';\n\n// ─── Prescription (stored input) ─────────────────────────────────────────────\n\n/** One exercise slot in a plan day, referencing a library exercise. */\nexport const planExerciseInputSchema = z.object({\n exerciseId: objectIdSchema,\n sets: z.number().int().min(1).max(20),\n reps: z.string().trim().min(1).max(40),\n restSec: z.number().int().min(0).max(3600),\n});\nexport type PlanExerciseInput = z.infer<typeof planExerciseInputSchema>;\n\nexport const workoutPlanDayInputSchema = z.object({\n weekday: weekdaySchema,\n exercises: z.array(planExerciseInputSchema).max(30).default([]),\n});\nexport type WorkoutPlanDayInput = z.infer<typeof workoutPlanDayInputSchema>;\n\n// ─── Populated response shapes ───────────────────────────────────────────────\n\n/** A plan-day exercise with its populated library summary + prescription. */\nexport const planExerciseSchema = z.object({\n exerciseId: objectIdSchema,\n slug: z.string(),\n name: z.string(),\n description: z.string(),\n thumbnailUrl: z.string().nullable(),\n difficulty: difficultySchema,\n category: exerciseCategorySchema,\n targetArea: z.string(),\n sets: z.number().int(),\n reps: z.string(),\n restSec: z.number().int(),\n});\nexport type PlanExercise = z.infer<typeof planExerciseSchema>;\n\nexport const planDaySchema = z.object({\n weekday: weekdaySchema,\n exercises: z.array(planExerciseSchema),\n});\nexport type PlanDay = z.infer<typeof planDaySchema>;\n\n// ─── Entity ──────────────────────────────────────────────────────────────────\n\nexport const workoutPlanSummarySchema = z.object({\n id: objectIdSchema,\n centerId: objectIdSchema,\n name: z.string(),\n description: z.string().nullable(),\n focusTags: z.array(z.string()),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type WorkoutPlanSummary = z.infer<typeof workoutPlanSummarySchema>;\n\nexport const workoutPlanSchema = workoutPlanSummarySchema.extend({\n days: z.array(planDaySchema),\n});\nexport type WorkoutPlan = z.infer<typeof workoutPlanSchema>;\n\n// ─── Create / update body ────────────────────────────────────────────────────\n\nexport const createWorkoutPlanBodySchema = z.object({\n centerId: objectIdSchema,\n name: z.string().trim().min(1, 'Plan name is required').max(120),\n description: optionalTrimmedString(2000),\n goals: optionalTrimmedString(400),\n focusTags: z.array(z.string().trim().max(40)).max(20).default([]),\n days: z.array(workoutPlanDayInputSchema).max(7).default([]),\n});\nexport type CreateWorkoutPlanBody = z.infer<typeof createWorkoutPlanBodySchema>;\n\nexport const updateWorkoutPlanBodySchema = createWorkoutPlanBodySchema\n .omit({ centerId: true })\n .partial();\nexport type UpdateWorkoutPlanBody = z.infer<typeof updateWorkoutPlanBodySchema>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gymmonk-schema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Shared Zod schemas, enums and domain types for GymMonk (fitness SaaS) — single source of truth (SSOT) consumed by gymmonk-backend and gymmonk-web-client.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|