gymmonk-schema 0.2.0 → 0.3.1
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 +421 -0
- package/dist/onboarding.d.ts.map +1 -0
- package/dist/onboarding.js +124 -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/common.js
CHANGED
|
@@ -32,4 +32,41 @@ export const paginationSchema = z.object({
|
|
|
32
32
|
page: z.coerce.number().int().min(1).default(1),
|
|
33
33
|
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
34
34
|
});
|
|
35
|
+
// ─── Contact primitives (India) ──────────────────────────────────────────────
|
|
36
|
+
/**
|
|
37
|
+
* A bare 10-digit Indian mobile number. Stored RAW (no `+91`) app-wide — the
|
|
38
|
+
* country code is display-only. Mirrors the jansathi phone-number standard.
|
|
39
|
+
*/
|
|
40
|
+
export const phoneSchema = z
|
|
41
|
+
.string()
|
|
42
|
+
.trim()
|
|
43
|
+
.regex(/^[6-9]\d{9}$/, 'Enter a valid 10-digit mobile number');
|
|
44
|
+
/** Optional phone — empty/whitespace becomes `undefined`. */
|
|
45
|
+
export const optionalPhoneSchema = z.preprocess(emptyStringToUndefined, phoneSchema.optional());
|
|
46
|
+
/** A 6-digit Indian postal PIN code. */
|
|
47
|
+
export const pincodeSchema = z
|
|
48
|
+
.string()
|
|
49
|
+
.trim()
|
|
50
|
+
.regex(/^\d{6}$/, 'Enter a valid 6-digit pincode');
|
|
51
|
+
/** Optional email — empty/whitespace becomes `undefined`, else validated. */
|
|
52
|
+
export const optionalEmailSchema = z.preprocess(emptyStringToUndefined, z.email('Enter a valid email').optional());
|
|
53
|
+
// ─── Date & time primitives ──────────────────────────────────────────────────
|
|
54
|
+
/** A calendar date with no time component, `YYYY-MM-DD`. */
|
|
55
|
+
export const isoDateSchema = z
|
|
56
|
+
.string()
|
|
57
|
+
.trim()
|
|
58
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, 'Expected an YYYY-MM-DD date');
|
|
59
|
+
/** A full ISO-8601 timestamp, e.g. `2026-08-06T09:30:00.000Z`. */
|
|
60
|
+
export const isoDateTimeSchema = z.iso.datetime({ offset: true });
|
|
61
|
+
/** Time of day in 24-hour `HH:MM`. */
|
|
62
|
+
export const timeOfDaySchema = z
|
|
63
|
+
.string()
|
|
64
|
+
.trim()
|
|
65
|
+
.regex(/^([01]\d|2[0-3]):[0-5]\d$/, 'Expected an HH:MM time');
|
|
66
|
+
// ─── Money ───────────────────────────────────────────────────────────────────
|
|
67
|
+
/**
|
|
68
|
+
* A whole-rupee (INR) amount. GymMonk prices are whole rupees; format with a
|
|
69
|
+
* `₹` and grouping at the edge, never store the formatted string.
|
|
70
|
+
*/
|
|
71
|
+
export const priceInrSchema = z.number().int().min(0);
|
|
35
72
|
//# sourceMappingURL=common.js.map
|
package/dist/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAc,EAAW,EAAE;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACvE,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,yEAAyE;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAS,GAAG,GAAG,EAAE,EAAE,CACvD,CAAC,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEpF,gFAAgF;AAEhF,kDAAkD;AAClD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,IAAI,EAAE;KACN,KAAK,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;AAG5C,gFAAgF;AAEhF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAC3D,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Shared helpers and primitives\n * ==============================================\n * The stable building blocks reused across every GymMonk domain schema.\n * Mirrors the `dating-schema` / `near-me-schema` idiom: pure Zod, const-object\n * enums fed to `z.enum(...)`, NodeNext `.js` import specifiers.\n *\n * @module gymmonk-schema/common\n */\n\nimport { z } from 'zod';\n\n// ─── String helpers ──────────────────────────────────────────────────────────\n\n/**\n * Converts empty / whitespace-only strings to `undefined`\n * so Zod `.optional()` treats them as \"not provided\".\n */\nexport const emptyStringToUndefined = (value: unknown): unknown => {\n if (typeof value === 'string' && value.trim() === '') return undefined;\n return value;\n};\n\n/** Optional trimmed string. Empty strings are coerced to `undefined`. */\nexport const optionalTrimmedString = (maxLength = 100) =>\n z.preprocess(emptyStringToUndefined, z.string().trim().max(maxLength).optional());\n\n// ─── Identifiers ─────────────────────────────────────────────────────────────\n\n/** A 24-character hex MongoDB ObjectId string. */\nexport const objectIdSchema = z\n .string()\n .trim()\n .regex(/^[0-9a-fA-F]{24}$/, 'Invalid id');\nexport type ObjectIdString = z.infer<typeof objectIdSchema>;\n\n// ─── Pagination ──────────────────────────────────────────────────────────────\n\n/** Pagination query params shared across list endpoints. */\nexport const paginationSchema = z.object({\n page: z.coerce.number().int().min(1).default(1),\n limit: z.coerce.number().int().min(1).max(100).default(20),\n});\nexport type Pagination = z.infer<typeof paginationSchema>;\n"]}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAc,EAAW,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AAC,CAAC;AAEhG,wCAAwC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,IAAI,EAAE;KACN,KAAK,CAAC,SAAS,EAAE,+BAA+B,CAAC,CAAC;AAGrD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,UAAU,CAC7C,sBAAsB,EACtB,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE,CAC1C,CAAC;AAEF,gFAAgF;AAEhF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,MAAM,EAAE;KACR,IAAI,EAAE;KACN,KAAK,CAAC,qBAAqB,EAAE,6BAA6B,CAAC,CAAC;AAG/D,kEAAkE;AAClE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAGlE,sCAAsC;AACtC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,EAAE;KACR,IAAI,EAAE;KACN,KAAK,CAAC,2BAA2B,EAAE,wBAAwB,CAAC,CAAC;AAGhE,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Shared helpers and primitives\n * ==============================================\n * The stable building blocks reused across every GymMonk domain schema.\n * Mirrors the `dating-schema` / `near-me-schema` idiom: pure Zod, const-object\n * enums fed to `z.enum(...)`, NodeNext `.js` import specifiers.\n *\n * @module gymmonk-schema/common\n */\n\nimport { z } from 'zod';\n\n// ─── String helpers ──────────────────────────────────────────────────────────\n\n/**\n * Converts empty / whitespace-only strings to `undefined`\n * so Zod `.optional()` treats them as \"not provided\".\n */\nexport const emptyStringToUndefined = (value: unknown): unknown => {\n if (typeof value === 'string' && value.trim() === '') return undefined;\n return value;\n};\n\n/** Optional trimmed string. Empty strings are coerced to `undefined`. */\nexport const optionalTrimmedString = (maxLength = 100) =>\n z.preprocess(emptyStringToUndefined, z.string().trim().max(maxLength).optional());\n\n// ─── Identifiers ─────────────────────────────────────────────────────────────\n\n/** A 24-character hex MongoDB ObjectId string. */\nexport const objectIdSchema = z\n .string()\n .trim()\n .regex(/^[0-9a-fA-F]{24}$/, 'Invalid id');\nexport type ObjectIdString = z.infer<typeof objectIdSchema>;\n\n// ─── Pagination ──────────────────────────────────────────────────────────────\n\n/** Pagination query params shared across list endpoints. */\nexport const paginationSchema = z.object({\n page: z.coerce.number().int().min(1).default(1),\n limit: z.coerce.number().int().min(1).max(100).default(20),\n});\nexport type Pagination = z.infer<typeof paginationSchema>;\n\n// ─── Contact primitives (India) ──────────────────────────────────────────────\n\n/**\n * A bare 10-digit Indian mobile number. Stored RAW (no `+91`) app-wide — the\n * country code is display-only. Mirrors the jansathi phone-number standard.\n */\nexport const phoneSchema = z\n .string()\n .trim()\n .regex(/^[6-9]\\d{9}$/, 'Enter a valid 10-digit mobile number');\nexport type Phone = z.infer<typeof phoneSchema>;\n\n/** Optional phone — empty/whitespace becomes `undefined`. */\nexport const optionalPhoneSchema = z.preprocess(emptyStringToUndefined, phoneSchema.optional());\n\n/** A 6-digit Indian postal PIN code. */\nexport const pincodeSchema = z\n .string()\n .trim()\n .regex(/^\\d{6}$/, 'Enter a valid 6-digit pincode');\nexport type Pincode = z.infer<typeof pincodeSchema>;\n\n/** Optional email — empty/whitespace becomes `undefined`, else validated. */\nexport const optionalEmailSchema = z.preprocess(\n emptyStringToUndefined,\n z.email('Enter a valid email').optional(),\n);\n\n// ─── Date & time primitives ──────────────────────────────────────────────────\n\n/** A calendar date with no time component, `YYYY-MM-DD`. */\nexport const isoDateSchema = z\n .string()\n .trim()\n .regex(/^\\d{4}-\\d{2}-\\d{2}$/, 'Expected an YYYY-MM-DD date');\nexport type IsoDate = z.infer<typeof isoDateSchema>;\n\n/** A full ISO-8601 timestamp, e.g. `2026-08-06T09:30:00.000Z`. */\nexport const isoDateTimeSchema = z.iso.datetime({ offset: true });\nexport type IsoDateTime = z.infer<typeof isoDateTimeSchema>;\n\n/** Time of day in 24-hour `HH:MM`. */\nexport const timeOfDaySchema = z\n .string()\n .trim()\n .regex(/^([01]\\d|2[0-3]):[0-5]\\d$/, 'Expected an HH:MM time');\nexport type TimeOfDay = z.infer<typeof timeOfDaySchema>;\n\n// ─── Money ───────────────────────────────────────────────────────────────────\n\n/**\n * A whole-rupee (INR) amount. GymMonk prices are whole rupees; format with a\n * `₹` and grouping at the edge, never store the formatted string.\n */\nexport const priceInrSchema = z.number().int().min(0);\nexport type PriceInr = z.infer<typeof priceInrSchema>;\n"]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Equipment
|
|
3
|
+
* ==========================
|
|
4
|
+
* A center's equipment inventory. The owner UI groups items by category and
|
|
5
|
+
* shows per-category counts; the entity is a per-item record scoped to a center.
|
|
6
|
+
*
|
|
7
|
+
* @module gymmonk-schema/equipment
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export declare const EQUIPMENT_CATEGORIES: readonly ["cardio", "strength", "weight", "training", "recovery", "custom"];
|
|
11
|
+
export declare const equipmentCategorySchema: z.ZodEnum<{
|
|
12
|
+
custom: "custom";
|
|
13
|
+
cardio: "cardio";
|
|
14
|
+
strength: "strength";
|
|
15
|
+
weight: "weight";
|
|
16
|
+
training: "training";
|
|
17
|
+
recovery: "recovery";
|
|
18
|
+
}>;
|
|
19
|
+
export type EquipmentCategory = z.infer<typeof equipmentCategorySchema>;
|
|
20
|
+
export declare const equipmentSchema: z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
centerId: z.ZodString;
|
|
23
|
+
category: z.ZodEnum<{
|
|
24
|
+
custom: "custom";
|
|
25
|
+
cardio: "cardio";
|
|
26
|
+
strength: "strength";
|
|
27
|
+
weight: "weight";
|
|
28
|
+
training: "training";
|
|
29
|
+
recovery: "recovery";
|
|
30
|
+
}>;
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
quantity: z.ZodNumber;
|
|
33
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
34
|
+
createdAt: z.ZodISODateTime;
|
|
35
|
+
updatedAt: z.ZodISODateTime;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type Equipment = z.infer<typeof equipmentSchema>;
|
|
38
|
+
/** Per-category rollup the owner equipment list renders. */
|
|
39
|
+
export declare const equipmentCategorySummarySchema: z.ZodObject<{
|
|
40
|
+
category: z.ZodEnum<{
|
|
41
|
+
custom: "custom";
|
|
42
|
+
cardio: "cardio";
|
|
43
|
+
strength: "strength";
|
|
44
|
+
weight: "weight";
|
|
45
|
+
training: "training";
|
|
46
|
+
recovery: "recovery";
|
|
47
|
+
}>;
|
|
48
|
+
label: z.ZodString;
|
|
49
|
+
count: z.ZodNumber;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export type EquipmentCategorySummary = z.infer<typeof equipmentCategorySummarySchema>;
|
|
52
|
+
export declare const createEquipmentBodySchema: z.ZodObject<{
|
|
53
|
+
centerId: z.ZodString;
|
|
54
|
+
category: z.ZodEnum<{
|
|
55
|
+
custom: "custom";
|
|
56
|
+
cardio: "cardio";
|
|
57
|
+
strength: "strength";
|
|
58
|
+
weight: "weight";
|
|
59
|
+
training: "training";
|
|
60
|
+
recovery: "recovery";
|
|
61
|
+
}>;
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
quantity: z.ZodDefault<z.ZodNumber>;
|
|
64
|
+
notes: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export type CreateEquipmentBody = z.infer<typeof createEquipmentBodySchema>;
|
|
67
|
+
export declare const updateEquipmentBodySchema: z.ZodObject<{
|
|
68
|
+
name: z.ZodOptional<z.ZodString>;
|
|
69
|
+
category: z.ZodOptional<z.ZodEnum<{
|
|
70
|
+
custom: "custom";
|
|
71
|
+
cardio: "cardio";
|
|
72
|
+
strength: "strength";
|
|
73
|
+
weight: "weight";
|
|
74
|
+
training: "training";
|
|
75
|
+
recovery: "recovery";
|
|
76
|
+
}>>;
|
|
77
|
+
quantity: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
78
|
+
notes: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
export type UpdateEquipmentBody = z.infer<typeof updateEquipmentBodySchema>;
|
|
81
|
+
export declare const equipmentQuerySchema: z.ZodObject<{
|
|
82
|
+
centerId: z.ZodString;
|
|
83
|
+
category: z.ZodOptional<z.ZodEnum<{
|
|
84
|
+
custom: "custom";
|
|
85
|
+
cardio: "cardio";
|
|
86
|
+
strength: "strength";
|
|
87
|
+
weight: "weight";
|
|
88
|
+
training: "training";
|
|
89
|
+
recovery: "recovery";
|
|
90
|
+
}>>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
export type EquipmentQuery = z.infer<typeof equipmentQuerySchema>;
|
|
93
|
+
//# sourceMappingURL=equipment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equipment.d.ts","sourceRoot":"","sources":["../src/equipment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,oBAAoB,6EAOvB,CAAC;AACX,eAAO,MAAM,uBAAuB;;;;;;;EAA+B,CAAC;AACpE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAIxE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;iBAS1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,4DAA4D;AAC5D,eAAO,MAAM,8BAA8B;;;;;;;;;;;iBAIzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAItF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;iBAMpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;iBAE1B,CAAC;AACb,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAI5E,eAAO,MAAM,oBAAoB;;;;;;;;;;iBAG/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Equipment
|
|
3
|
+
* ==========================
|
|
4
|
+
* A center's equipment inventory. The owner UI groups items by category and
|
|
5
|
+
* shows per-category counts; the entity is a per-item record scoped to a center.
|
|
6
|
+
*
|
|
7
|
+
* @module gymmonk-schema/equipment
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { isoDateTimeSchema, objectIdSchema, optionalTrimmedString } from './common.js';
|
|
11
|
+
// ─── Category ────────────────────────────────────────────────────────────────
|
|
12
|
+
export const EQUIPMENT_CATEGORIES = [
|
|
13
|
+
'cardio',
|
|
14
|
+
'strength',
|
|
15
|
+
'weight',
|
|
16
|
+
'training',
|
|
17
|
+
'recovery',
|
|
18
|
+
'custom',
|
|
19
|
+
];
|
|
20
|
+
export const equipmentCategorySchema = z.enum(EQUIPMENT_CATEGORIES);
|
|
21
|
+
// ─── Entity ──────────────────────────────────────────────────────────────────
|
|
22
|
+
export const equipmentSchema = z.object({
|
|
23
|
+
id: objectIdSchema,
|
|
24
|
+
centerId: objectIdSchema,
|
|
25
|
+
category: equipmentCategorySchema,
|
|
26
|
+
name: z.string(),
|
|
27
|
+
quantity: z.number().int().nonnegative(),
|
|
28
|
+
notes: z.string().nullable(),
|
|
29
|
+
createdAt: isoDateTimeSchema,
|
|
30
|
+
updatedAt: isoDateTimeSchema,
|
|
31
|
+
});
|
|
32
|
+
/** Per-category rollup the owner equipment list renders. */
|
|
33
|
+
export const equipmentCategorySummarySchema = z.object({
|
|
34
|
+
category: equipmentCategorySchema,
|
|
35
|
+
label: z.string(),
|
|
36
|
+
count: z.number().int().nonnegative(),
|
|
37
|
+
});
|
|
38
|
+
// ─── Create / update body ────────────────────────────────────────────────────
|
|
39
|
+
export const createEquipmentBodySchema = z.object({
|
|
40
|
+
centerId: objectIdSchema,
|
|
41
|
+
category: equipmentCategorySchema,
|
|
42
|
+
name: z.string().trim().min(1, 'Name is required').max(120),
|
|
43
|
+
quantity: z.number().int().min(1).max(100000).default(1),
|
|
44
|
+
notes: optionalTrimmedString(500),
|
|
45
|
+
});
|
|
46
|
+
export const updateEquipmentBodySchema = createEquipmentBodySchema
|
|
47
|
+
.omit({ centerId: true })
|
|
48
|
+
.partial();
|
|
49
|
+
// ─── List query ──────────────────────────────────────────────────────────────
|
|
50
|
+
export const equipmentQuerySchema = z.object({
|
|
51
|
+
centerId: objectIdSchema,
|
|
52
|
+
category: equipmentCategorySchema.optional(),
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=equipment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equipment.js","sourceRoot":"","sources":["../src/equipment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEvF,gFAAgF;AAEhF,MAAM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C,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD,KAAK,EAAE,qBAAqB,CAAC,GAAG,CAAC;CAClC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,yBAAyB,GAAG,yBAAyB;KAC/D,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;KACxB,OAAO,EAAE,CAAC;AAGb,gFAAgF;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,uBAAuB,CAAC,QAAQ,EAAE;CAC7C,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Equipment\n * ==========================\n * A center's equipment inventory. The owner UI groups items by category and\n * shows per-category counts; the entity is a per-item record scoped to a center.\n *\n * @module gymmonk-schema/equipment\n */\n\nimport { z } from 'zod';\nimport { isoDateTimeSchema, objectIdSchema, optionalTrimmedString } from './common.js';\n\n// ─── Category ────────────────────────────────────────────────────────────────\n\nexport const EQUIPMENT_CATEGORIES = [\n 'cardio',\n 'strength',\n 'weight',\n 'training',\n 'recovery',\n 'custom',\n] as const;\nexport const equipmentCategorySchema = z.enum(EQUIPMENT_CATEGORIES);\nexport type EquipmentCategory = z.infer<typeof equipmentCategorySchema>;\n\n// ─── Entity ──────────────────────────────────────────────────────────────────\n\nexport const equipmentSchema = z.object({\n id: objectIdSchema,\n centerId: objectIdSchema,\n category: equipmentCategorySchema,\n name: z.string(),\n quantity: z.number().int().nonnegative(),\n notes: z.string().nullable(),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Equipment = z.infer<typeof equipmentSchema>;\n\n/** Per-category rollup the owner equipment list renders. */\nexport const equipmentCategorySummarySchema = z.object({\n category: equipmentCategorySchema,\n label: z.string(),\n count: z.number().int().nonnegative(),\n});\nexport type EquipmentCategorySummary = z.infer<typeof equipmentCategorySummarySchema>;\n\n// ─── Create / update body ────────────────────────────────────────────────────\n\nexport const createEquipmentBodySchema = z.object({\n centerId: objectIdSchema,\n category: equipmentCategorySchema,\n name: z.string().trim().min(1, 'Name is required').max(120),\n quantity: z.number().int().min(1).max(100000).default(1),\n notes: optionalTrimmedString(500),\n});\nexport type CreateEquipmentBody = z.infer<typeof createEquipmentBodySchema>;\n\nexport const updateEquipmentBodySchema = createEquipmentBodySchema\n .omit({ centerId: true })\n .partial();\nexport type UpdateEquipmentBody = z.infer<typeof updateEquipmentBodySchema>;\n\n// ─── List query ──────────────────────────────────────────────────────────────\n\nexport const equipmentQuerySchema = z.object({\n centerId: objectIdSchema,\n category: equipmentCategorySchema.optional(),\n});\nexport type EquipmentQuery = z.infer<typeof equipmentQuerySchema>;\n"]}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Exercise library
|
|
3
|
+
* ==================================
|
|
4
|
+
* The catalog of exercises. Global entries (centerId null) plus gym-custom ones
|
|
5
|
+
* an owner authors. Difficulty/category/muscle vocabularies are normalised to
|
|
6
|
+
* lowercase; the frontend title-cases for display.
|
|
7
|
+
*
|
|
8
|
+
* @module gymmonk-schema/exercise
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
export declare const difficultySchema: z.ZodEnum<{
|
|
12
|
+
beginner: "beginner";
|
|
13
|
+
intermediate: "intermediate";
|
|
14
|
+
advanced: "advanced";
|
|
15
|
+
}>;
|
|
16
|
+
export type Difficulty = z.infer<typeof difficultySchema>;
|
|
17
|
+
export declare const exerciseCategorySchema: z.ZodEnum<{
|
|
18
|
+
cardio: "cardio";
|
|
19
|
+
"upper-body": "upper-body";
|
|
20
|
+
"lower-body": "lower-body";
|
|
21
|
+
core: "core";
|
|
22
|
+
"full-body": "full-body";
|
|
23
|
+
}>;
|
|
24
|
+
export type ExerciseCategory = z.infer<typeof exerciseCategorySchema>;
|
|
25
|
+
/** Normalised superset of the target-muscle vocabulary used across the app. */
|
|
26
|
+
export declare const MUSCLE_GROUPS: readonly ["chest", "back", "shoulders", "biceps", "triceps", "forearms", "quads", "hamstrings", "glutes", "calves", "legs", "core", "obliques", "lower-back", "full-body", "cardio"];
|
|
27
|
+
export declare const muscleGroupSchema: z.ZodEnum<{
|
|
28
|
+
cardio: "cardio";
|
|
29
|
+
core: "core";
|
|
30
|
+
"full-body": "full-body";
|
|
31
|
+
chest: "chest";
|
|
32
|
+
back: "back";
|
|
33
|
+
shoulders: "shoulders";
|
|
34
|
+
biceps: "biceps";
|
|
35
|
+
triceps: "triceps";
|
|
36
|
+
forearms: "forearms";
|
|
37
|
+
quads: "quads";
|
|
38
|
+
hamstrings: "hamstrings";
|
|
39
|
+
glutes: "glutes";
|
|
40
|
+
calves: "calves";
|
|
41
|
+
legs: "legs";
|
|
42
|
+
obliques: "obliques";
|
|
43
|
+
"lower-back": "lower-back";
|
|
44
|
+
}>;
|
|
45
|
+
export type MuscleGroup = z.infer<typeof muscleGroupSchema>;
|
|
46
|
+
export declare const exerciseSetSchema: z.ZodObject<{
|
|
47
|
+
order: z.ZodNumber;
|
|
48
|
+
reps: z.ZodString;
|
|
49
|
+
weight: z.ZodString;
|
|
50
|
+
tempo: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type ExerciseSet = z.infer<typeof exerciseSetSchema>;
|
|
53
|
+
export declare const exerciseSummarySchema: z.ZodObject<{
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
slug: z.ZodString;
|
|
56
|
+
name: z.ZodString;
|
|
57
|
+
difficulty: z.ZodEnum<{
|
|
58
|
+
beginner: "beginner";
|
|
59
|
+
intermediate: "intermediate";
|
|
60
|
+
advanced: "advanced";
|
|
61
|
+
}>;
|
|
62
|
+
category: z.ZodEnum<{
|
|
63
|
+
cardio: "cardio";
|
|
64
|
+
"upper-body": "upper-body";
|
|
65
|
+
"lower-body": "lower-body";
|
|
66
|
+
core: "core";
|
|
67
|
+
"full-body": "full-body";
|
|
68
|
+
}>;
|
|
69
|
+
targetArea: z.ZodString;
|
|
70
|
+
thumbnailUrl: z.ZodNullable<z.ZodString>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export type ExerciseSummary = z.infer<typeof exerciseSummarySchema>;
|
|
73
|
+
export declare const exerciseSchema: z.ZodObject<{
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
slug: z.ZodString;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
difficulty: z.ZodEnum<{
|
|
78
|
+
beginner: "beginner";
|
|
79
|
+
intermediate: "intermediate";
|
|
80
|
+
advanced: "advanced";
|
|
81
|
+
}>;
|
|
82
|
+
category: z.ZodEnum<{
|
|
83
|
+
cardio: "cardio";
|
|
84
|
+
"upper-body": "upper-body";
|
|
85
|
+
"lower-body": "lower-body";
|
|
86
|
+
core: "core";
|
|
87
|
+
"full-body": "full-body";
|
|
88
|
+
}>;
|
|
89
|
+
targetArea: z.ZodString;
|
|
90
|
+
thumbnailUrl: z.ZodNullable<z.ZodString>;
|
|
91
|
+
centerId: z.ZodNullable<z.ZodString>;
|
|
92
|
+
description: z.ZodString;
|
|
93
|
+
youtubeId: z.ZodNullable<z.ZodString>;
|
|
94
|
+
posterUrl: z.ZodNullable<z.ZodString>;
|
|
95
|
+
targetMuscles: z.ZodArray<z.ZodEnum<{
|
|
96
|
+
cardio: "cardio";
|
|
97
|
+
core: "core";
|
|
98
|
+
"full-body": "full-body";
|
|
99
|
+
chest: "chest";
|
|
100
|
+
back: "back";
|
|
101
|
+
shoulders: "shoulders";
|
|
102
|
+
biceps: "biceps";
|
|
103
|
+
triceps: "triceps";
|
|
104
|
+
forearms: "forearms";
|
|
105
|
+
quads: "quads";
|
|
106
|
+
hamstrings: "hamstrings";
|
|
107
|
+
glutes: "glutes";
|
|
108
|
+
calves: "calves";
|
|
109
|
+
legs: "legs";
|
|
110
|
+
obliques: "obliques";
|
|
111
|
+
"lower-back": "lower-back";
|
|
112
|
+
}>>;
|
|
113
|
+
sets: z.ZodArray<z.ZodObject<{
|
|
114
|
+
order: z.ZodNumber;
|
|
115
|
+
reps: z.ZodString;
|
|
116
|
+
weight: z.ZodString;
|
|
117
|
+
tempo: z.ZodString;
|
|
118
|
+
}, z.core.$strip>>;
|
|
119
|
+
formTips: z.ZodArray<z.ZodString>;
|
|
120
|
+
createdAt: z.ZodISODateTime;
|
|
121
|
+
updatedAt: z.ZodISODateTime;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export type Exercise = z.infer<typeof exerciseSchema>;
|
|
124
|
+
export declare const createExerciseBodySchema: z.ZodObject<{
|
|
125
|
+
centerId: z.ZodString;
|
|
126
|
+
name: z.ZodString;
|
|
127
|
+
description: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
128
|
+
category: z.ZodEnum<{
|
|
129
|
+
cardio: "cardio";
|
|
130
|
+
"upper-body": "upper-body";
|
|
131
|
+
"lower-body": "lower-body";
|
|
132
|
+
core: "core";
|
|
133
|
+
"full-body": "full-body";
|
|
134
|
+
}>;
|
|
135
|
+
difficulty: z.ZodEnum<{
|
|
136
|
+
beginner: "beginner";
|
|
137
|
+
intermediate: "intermediate";
|
|
138
|
+
advanced: "advanced";
|
|
139
|
+
}>;
|
|
140
|
+
targetArea: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
141
|
+
youtubeId: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
142
|
+
thumbnailUrl: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
143
|
+
posterUrl: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
144
|
+
targetMuscles: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
145
|
+
cardio: "cardio";
|
|
146
|
+
core: "core";
|
|
147
|
+
"full-body": "full-body";
|
|
148
|
+
chest: "chest";
|
|
149
|
+
back: "back";
|
|
150
|
+
shoulders: "shoulders";
|
|
151
|
+
biceps: "biceps";
|
|
152
|
+
triceps: "triceps";
|
|
153
|
+
forearms: "forearms";
|
|
154
|
+
quads: "quads";
|
|
155
|
+
hamstrings: "hamstrings";
|
|
156
|
+
glutes: "glutes";
|
|
157
|
+
calves: "calves";
|
|
158
|
+
legs: "legs";
|
|
159
|
+
obliques: "obliques";
|
|
160
|
+
"lower-back": "lower-back";
|
|
161
|
+
}>>>;
|
|
162
|
+
sets: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
163
|
+
order: z.ZodNumber;
|
|
164
|
+
reps: z.ZodString;
|
|
165
|
+
weight: z.ZodString;
|
|
166
|
+
tempo: z.ZodString;
|
|
167
|
+
}, z.core.$strip>>>;
|
|
168
|
+
formTips: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
export type CreateExerciseBody = z.infer<typeof createExerciseBodySchema>;
|
|
171
|
+
export declare const updateExerciseBodySchema: z.ZodObject<{
|
|
172
|
+
name: z.ZodOptional<z.ZodString>;
|
|
173
|
+
description: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
|
|
174
|
+
category: z.ZodOptional<z.ZodEnum<{
|
|
175
|
+
cardio: "cardio";
|
|
176
|
+
"upper-body": "upper-body";
|
|
177
|
+
"lower-body": "lower-body";
|
|
178
|
+
core: "core";
|
|
179
|
+
"full-body": "full-body";
|
|
180
|
+
}>>;
|
|
181
|
+
difficulty: z.ZodOptional<z.ZodEnum<{
|
|
182
|
+
beginner: "beginner";
|
|
183
|
+
intermediate: "intermediate";
|
|
184
|
+
advanced: "advanced";
|
|
185
|
+
}>>;
|
|
186
|
+
targetArea: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
|
|
187
|
+
thumbnailUrl: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
|
|
188
|
+
youtubeId: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
|
|
189
|
+
posterUrl: z.ZodOptional<z.ZodPreprocess<z.ZodOptional<z.ZodString>>>;
|
|
190
|
+
targetMuscles: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
191
|
+
cardio: "cardio";
|
|
192
|
+
core: "core";
|
|
193
|
+
"full-body": "full-body";
|
|
194
|
+
chest: "chest";
|
|
195
|
+
back: "back";
|
|
196
|
+
shoulders: "shoulders";
|
|
197
|
+
biceps: "biceps";
|
|
198
|
+
triceps: "triceps";
|
|
199
|
+
forearms: "forearms";
|
|
200
|
+
quads: "quads";
|
|
201
|
+
hamstrings: "hamstrings";
|
|
202
|
+
glutes: "glutes";
|
|
203
|
+
calves: "calves";
|
|
204
|
+
legs: "legs";
|
|
205
|
+
obliques: "obliques";
|
|
206
|
+
"lower-back": "lower-back";
|
|
207
|
+
}>>>>;
|
|
208
|
+
sets: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
209
|
+
order: z.ZodNumber;
|
|
210
|
+
reps: z.ZodString;
|
|
211
|
+
weight: z.ZodString;
|
|
212
|
+
tempo: z.ZodString;
|
|
213
|
+
}, z.core.$strip>>>>;
|
|
214
|
+
formTips: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString>>>;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
export type UpdateExerciseBody = z.infer<typeof updateExerciseBodySchema>;
|
|
217
|
+
export declare const exerciseLibraryQuerySchema: z.ZodObject<{
|
|
218
|
+
centerId: z.ZodOptional<z.ZodString>;
|
|
219
|
+
category: z.ZodOptional<z.ZodEnum<{
|
|
220
|
+
cardio: "cardio";
|
|
221
|
+
"upper-body": "upper-body";
|
|
222
|
+
"lower-body": "lower-body";
|
|
223
|
+
core: "core";
|
|
224
|
+
"full-body": "full-body";
|
|
225
|
+
}>>;
|
|
226
|
+
difficulty: z.ZodOptional<z.ZodEnum<{
|
|
227
|
+
beginner: "beginner";
|
|
228
|
+
intermediate: "intermediate";
|
|
229
|
+
advanced: "advanced";
|
|
230
|
+
}>>;
|
|
231
|
+
q: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
232
|
+
}, z.core.$strip>;
|
|
233
|
+
export type ExerciseLibraryQuery = z.infer<typeof exerciseLibraryQuerySchema>;
|
|
234
|
+
//# sourceMappingURL=exercise.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exercise.d.ts","sourceRoot":"","sources":["../src/exercise.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,gBAAgB;;;;EAAmD,CAAC;AACjF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,sBAAsB;;;;;;EAMjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,+EAA+E;AAC/E,eAAO,MAAM,aAAa,sLAiBhB,CAAC;AACX,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;EAAwB,CAAC;AACvD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAI5D,eAAO,MAAM,iBAAiB;;;;;iBAK5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAI5D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;iBAQhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAIpE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAUzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAItD,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAanC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA8D,CAAC;AACpG,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAI1E,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;iBAKrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
package/dist/exercise.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Exercise library
|
|
3
|
+
* ==================================
|
|
4
|
+
* The catalog of exercises. Global entries (centerId null) plus gym-custom ones
|
|
5
|
+
* an owner authors. Difficulty/category/muscle vocabularies are normalised to
|
|
6
|
+
* lowercase; the frontend title-cases for display.
|
|
7
|
+
*
|
|
8
|
+
* @module gymmonk-schema/exercise
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { isoDateTimeSchema, objectIdSchema, optionalTrimmedString } from './common.js';
|
|
12
|
+
// ─── Enums ───────────────────────────────────────────────────────────────────
|
|
13
|
+
export const difficultySchema = z.enum(['beginner', 'intermediate', 'advanced']);
|
|
14
|
+
export const exerciseCategorySchema = z.enum([
|
|
15
|
+
'cardio',
|
|
16
|
+
'upper-body',
|
|
17
|
+
'lower-body',
|
|
18
|
+
'core',
|
|
19
|
+
'full-body',
|
|
20
|
+
]);
|
|
21
|
+
/** Normalised superset of the target-muscle vocabulary used across the app. */
|
|
22
|
+
export const MUSCLE_GROUPS = [
|
|
23
|
+
'chest',
|
|
24
|
+
'back',
|
|
25
|
+
'shoulders',
|
|
26
|
+
'biceps',
|
|
27
|
+
'triceps',
|
|
28
|
+
'forearms',
|
|
29
|
+
'quads',
|
|
30
|
+
'hamstrings',
|
|
31
|
+
'glutes',
|
|
32
|
+
'calves',
|
|
33
|
+
'legs',
|
|
34
|
+
'core',
|
|
35
|
+
'obliques',
|
|
36
|
+
'lower-back',
|
|
37
|
+
'full-body',
|
|
38
|
+
'cardio',
|
|
39
|
+
];
|
|
40
|
+
export const muscleGroupSchema = z.enum(MUSCLE_GROUPS);
|
|
41
|
+
// ─── Prescribed sets (on the detail view) ────────────────────────────────────
|
|
42
|
+
export const exerciseSetSchema = z.object({
|
|
43
|
+
order: z.number().int().min(1),
|
|
44
|
+
reps: z.string().trim().min(1),
|
|
45
|
+
weight: z.string().trim(),
|
|
46
|
+
tempo: z.string().trim(),
|
|
47
|
+
});
|
|
48
|
+
// ─── Summary (library card) ──────────────────────────────────────────────────
|
|
49
|
+
export const exerciseSummarySchema = z.object({
|
|
50
|
+
id: objectIdSchema,
|
|
51
|
+
slug: z.string(),
|
|
52
|
+
name: z.string(),
|
|
53
|
+
difficulty: difficultySchema,
|
|
54
|
+
category: exerciseCategorySchema,
|
|
55
|
+
targetArea: z.string(),
|
|
56
|
+
thumbnailUrl: z.string().nullable(),
|
|
57
|
+
});
|
|
58
|
+
// ─── Detail (full entity) ────────────────────────────────────────────────────
|
|
59
|
+
export const exerciseSchema = exerciseSummarySchema.extend({
|
|
60
|
+
centerId: objectIdSchema.nullable(),
|
|
61
|
+
description: z.string(),
|
|
62
|
+
youtubeId: z.string().nullable(),
|
|
63
|
+
posterUrl: z.string().nullable(),
|
|
64
|
+
targetMuscles: z.array(muscleGroupSchema),
|
|
65
|
+
sets: z.array(exerciseSetSchema),
|
|
66
|
+
formTips: z.array(z.string()),
|
|
67
|
+
createdAt: isoDateTimeSchema,
|
|
68
|
+
updatedAt: isoDateTimeSchema,
|
|
69
|
+
});
|
|
70
|
+
// ─── Create / update body ────────────────────────────────────────────────────
|
|
71
|
+
export const createExerciseBodySchema = z.object({
|
|
72
|
+
centerId: objectIdSchema,
|
|
73
|
+
name: z.string().trim().min(1, 'Name is required').max(120),
|
|
74
|
+
description: optionalTrimmedString(4000),
|
|
75
|
+
category: exerciseCategorySchema,
|
|
76
|
+
difficulty: difficultySchema,
|
|
77
|
+
targetArea: optionalTrimmedString(120),
|
|
78
|
+
youtubeId: optionalTrimmedString(40),
|
|
79
|
+
thumbnailUrl: optionalTrimmedString(2000),
|
|
80
|
+
posterUrl: optionalTrimmedString(2000),
|
|
81
|
+
targetMuscles: z.array(muscleGroupSchema).max(16).default([]),
|
|
82
|
+
sets: z.array(exerciseSetSchema).max(20).default([]),
|
|
83
|
+
formTips: z.array(z.string().trim().max(400)).max(20).default([]),
|
|
84
|
+
});
|
|
85
|
+
export const updateExerciseBodySchema = createExerciseBodySchema.omit({ centerId: true }).partial();
|
|
86
|
+
// ─── Library query ───────────────────────────────────────────────────────────
|
|
87
|
+
export const exerciseLibraryQuerySchema = z.object({
|
|
88
|
+
centerId: objectIdSchema.optional(),
|
|
89
|
+
category: exerciseCategorySchema.optional(),
|
|
90
|
+
difficulty: difficultySchema.optional(),
|
|
91
|
+
q: optionalTrimmedString(120),
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=exercise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exercise.js","sourceRoot":"","sources":["../src/exercise.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEvF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;AAGjF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC3C,QAAQ;IACR,YA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AE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAClE,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,wBAAwB,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;AAGpG,gFAAgF;AAEhF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,EAAE,sBAAsB,CAAC,QAAQ,EAAE;IAC3C,UAAU,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IACvC,CAAC,EAAE,qBAAqB,CAAC,GAAG,CAAC;CAC9B,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Exercise library\n * ==================================\n * The catalog of exercises. Global entries (centerId null) plus gym-custom ones\n * an owner authors. Difficulty/category/muscle vocabularies are normalised to\n * lowercase; the frontend title-cases for display.\n *\n * @module gymmonk-schema/exercise\n */\n\nimport { z } from 'zod';\nimport { isoDateTimeSchema, objectIdSchema, optionalTrimmedString } from './common.js';\n\n// ─── Enums ───────────────────────────────────────────────────────────────────\n\nexport const difficultySchema = z.enum(['beginner', 'intermediate', 'advanced']);\nexport type Difficulty = z.infer<typeof difficultySchema>;\n\nexport const exerciseCategorySchema = z.enum([\n 'cardio',\n 'upper-body',\n 'lower-body',\n 'core',\n 'full-body',\n]);\nexport type ExerciseCategory = z.infer<typeof exerciseCategorySchema>;\n\n/** Normalised superset of the target-muscle vocabulary used across the app. */\nexport const MUSCLE_GROUPS = [\n 'chest',\n 'back',\n 'shoulders',\n 'biceps',\n 'triceps',\n 'forearms',\n 'quads',\n 'hamstrings',\n 'glutes',\n 'calves',\n 'legs',\n 'core',\n 'obliques',\n 'lower-back',\n 'full-body',\n 'cardio',\n] as const;\nexport const muscleGroupSchema = z.enum(MUSCLE_GROUPS);\nexport type MuscleGroup = z.infer<typeof muscleGroupSchema>;\n\n// ─── Prescribed sets (on the detail view) ────────────────────────────────────\n\nexport const exerciseSetSchema = z.object({\n order: z.number().int().min(1),\n reps: z.string().trim().min(1),\n weight: z.string().trim(),\n tempo: z.string().trim(),\n});\nexport type ExerciseSet = z.infer<typeof exerciseSetSchema>;\n\n// ─── Summary (library card) ──────────────────────────────────────────────────\n\nexport const exerciseSummarySchema = z.object({\n id: objectIdSchema,\n slug: z.string(),\n name: z.string(),\n difficulty: difficultySchema,\n category: exerciseCategorySchema,\n targetArea: z.string(),\n thumbnailUrl: z.string().nullable(),\n});\nexport type ExerciseSummary = z.infer<typeof exerciseSummarySchema>;\n\n// ─── Detail (full entity) ────────────────────────────────────────────────────\n\nexport const exerciseSchema = exerciseSummarySchema.extend({\n centerId: objectIdSchema.nullable(),\n description: z.string(),\n youtubeId: z.string().nullable(),\n posterUrl: z.string().nullable(),\n targetMuscles: z.array(muscleGroupSchema),\n sets: z.array(exerciseSetSchema),\n formTips: z.array(z.string()),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type Exercise = z.infer<typeof exerciseSchema>;\n\n// ─── Create / update body ────────────────────────────────────────────────────\n\nexport const createExerciseBodySchema = z.object({\n centerId: objectIdSchema,\n name: z.string().trim().min(1, 'Name is required').max(120),\n description: optionalTrimmedString(4000),\n category: exerciseCategorySchema,\n difficulty: difficultySchema,\n targetArea: optionalTrimmedString(120),\n youtubeId: optionalTrimmedString(40),\n thumbnailUrl: optionalTrimmedString(2000),\n posterUrl: optionalTrimmedString(2000),\n targetMuscles: z.array(muscleGroupSchema).max(16).default([]),\n sets: z.array(exerciseSetSchema).max(20).default([]),\n formTips: z.array(z.string().trim().max(400)).max(20).default([]),\n});\nexport type CreateExerciseBody = z.infer<typeof createExerciseBodySchema>;\n\nexport const updateExerciseBodySchema = createExerciseBodySchema.omit({ centerId: true }).partial();\nexport type UpdateExerciseBody = z.infer<typeof updateExerciseBodySchema>;\n\n// ─── Library query ───────────────────────────────────────────────────────────\n\nexport const exerciseLibraryQuerySchema = z.object({\n centerId: objectIdSchema.optional(),\n category: exerciseCategorySchema.optional(),\n difficulty: difficultySchema.optional(),\n q: optionalTrimmedString(120),\n});\nexport type ExerciseLibraryQuery = z.infer<typeof exerciseLibraryQuerySchema>;\n"]}
|