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
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — In-app notifications
|
|
3
|
+
* =====================================
|
|
4
|
+
* The member/owner notification feed. `unread` and relative time are DERIVED at
|
|
5
|
+
* the edge from `readAt` / `createdAt`.
|
|
6
|
+
*
|
|
7
|
+
* @module gymmonk-schema/notification
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export declare const notificationCategorySchema: z.ZodEnum<{
|
|
11
|
+
rest: "rest";
|
|
12
|
+
payment: "payment";
|
|
13
|
+
move: "move";
|
|
14
|
+
milestone: "milestone";
|
|
15
|
+
recap: "recap";
|
|
16
|
+
challenge: "challenge";
|
|
17
|
+
fuel: "fuel";
|
|
18
|
+
announcement: "announcement";
|
|
19
|
+
membership: "membership";
|
|
20
|
+
system: "system";
|
|
21
|
+
}>;
|
|
22
|
+
export type NotificationCategory = z.infer<typeof notificationCategorySchema>;
|
|
23
|
+
export declare const notificationSchema: z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
userId: z.ZodString;
|
|
26
|
+
category: z.ZodEnum<{
|
|
27
|
+
rest: "rest";
|
|
28
|
+
payment: "payment";
|
|
29
|
+
move: "move";
|
|
30
|
+
milestone: "milestone";
|
|
31
|
+
recap: "recap";
|
|
32
|
+
challenge: "challenge";
|
|
33
|
+
fuel: "fuel";
|
|
34
|
+
announcement: "announcement";
|
|
35
|
+
membership: "membership";
|
|
36
|
+
system: "system";
|
|
37
|
+
}>;
|
|
38
|
+
title: z.ZodString;
|
|
39
|
+
body: z.ZodString;
|
|
40
|
+
actionUrl: z.ZodNullable<z.ZodString>;
|
|
41
|
+
readAt: z.ZodNullable<z.ZodISODateTime>;
|
|
42
|
+
createdAt: z.ZodISODateTime;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type AppNotification = z.infer<typeof notificationSchema>;
|
|
45
|
+
export declare const notificationListQuerySchema: z.ZodObject<{
|
|
46
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
47
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
48
|
+
unreadOnly: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
|
|
49
|
+
true: "true";
|
|
50
|
+
false: "false";
|
|
51
|
+
}>>, z.ZodTransform<boolean, "true" | "false" | undefined>>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
export type NotificationListQuery = z.infer<typeof notificationListQuerySchema>;
|
|
54
|
+
/** Mark specific notifications read; empty `ids` = mark all read. */
|
|
55
|
+
export declare const markNotificationsReadBodySchema: z.ZodObject<{
|
|
56
|
+
ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export type MarkNotificationsReadBody = z.infer<typeof markNotificationsReadBodySchema>;
|
|
59
|
+
//# sourceMappingURL=notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../src/notification.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,0BAA0B;;;;;;;;;;;EAWrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAI9E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;iBAU7B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAIjE,eAAO,MAAM,2BAA2B;;;;;;;iBAOtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,qEAAqE;AACrE,eAAO,MAAM,+BAA+B;;iBAE1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — In-app notifications
|
|
3
|
+
* =====================================
|
|
4
|
+
* The member/owner notification feed. `unread` and relative time are DERIVED at
|
|
5
|
+
* the edge from `readAt` / `createdAt`.
|
|
6
|
+
*
|
|
7
|
+
* @module gymmonk-schema/notification
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { isoDateTimeSchema, objectIdSchema, paginationSchema } from './common.js';
|
|
11
|
+
// ─── Category (also drives the feed icon) ────────────────────────────────────
|
|
12
|
+
export const notificationCategorySchema = z.enum([
|
|
13
|
+
'move',
|
|
14
|
+
'milestone',
|
|
15
|
+
'recap',
|
|
16
|
+
'challenge',
|
|
17
|
+
'rest',
|
|
18
|
+
'fuel',
|
|
19
|
+
'announcement',
|
|
20
|
+
'membership',
|
|
21
|
+
'payment',
|
|
22
|
+
'system',
|
|
23
|
+
]);
|
|
24
|
+
// ─── Entity ──────────────────────────────────────────────────────────────────
|
|
25
|
+
export const notificationSchema = z.object({
|
|
26
|
+
id: objectIdSchema,
|
|
27
|
+
userId: objectIdSchema,
|
|
28
|
+
category: notificationCategorySchema,
|
|
29
|
+
title: z.string(),
|
|
30
|
+
body: z.string(),
|
|
31
|
+
/** Optional deep-link the card opens. */
|
|
32
|
+
actionUrl: z.string().nullable(),
|
|
33
|
+
readAt: isoDateTimeSchema.nullable(),
|
|
34
|
+
createdAt: isoDateTimeSchema,
|
|
35
|
+
});
|
|
36
|
+
// ─── Query ───────────────────────────────────────────────────────────────────
|
|
37
|
+
export const notificationListQuerySchema = paginationSchema.extend({
|
|
38
|
+
// Query booleans arrive as strings — `z.coerce.boolean("false")` is `true`
|
|
39
|
+
// (any non-empty string is truthy), so parse the literal instead.
|
|
40
|
+
unreadOnly: z
|
|
41
|
+
.enum(['true', 'false'])
|
|
42
|
+
.optional()
|
|
43
|
+
.transform((v) => v === 'true'),
|
|
44
|
+
});
|
|
45
|
+
/** Mark specific notifications read; empty `ids` = mark all read. */
|
|
46
|
+
export const markNotificationsReadBodySchema = z.object({
|
|
47
|
+
ids: z.array(objectIdSchema).default([]),
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.js","sourceRoot":"","sources":["../src/notification.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElF,gFAAgF;AAEhF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,IAAI,CAAC;IAC/C,MAAM;IACN,WAAW;IACX,OAAO;IACP,WAAW;IACX,MAAM;IACN,MAAM;IACN,cAAc;IACd,YAAY;IACZ,SAAS;IACT,QAAQ;CACT,CAAC,CAAC;AAGH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,cAAc;IAClB,MAAM,EAAE,cAAc;IACtB,QAAQ,EAAE,0BAA0B;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,yCAAyC;IACzC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,MAAM,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IACpC,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC;AAGH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,2BAA2B,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACjE,2EAA2E;IAC3E,kEAAkE;IAClE,UAAU,EAAE,CAAC;SACV,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SACvB,QAAQ,EAAE;SACV,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC;CAClC,CAAC,CAAC;AAGH,qEAAqE;AACrE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACzC,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — In-app notifications\n * =====================================\n * The member/owner notification feed. `unread` and relative time are DERIVED at\n * the edge from `readAt` / `createdAt`.\n *\n * @module gymmonk-schema/notification\n */\n\nimport { z } from 'zod';\nimport { isoDateTimeSchema, objectIdSchema, paginationSchema } from './common.js';\n\n// ─── Category (also drives the feed icon) ────────────────────────────────────\n\nexport const notificationCategorySchema = z.enum([\n 'move',\n 'milestone',\n 'recap',\n 'challenge',\n 'rest',\n 'fuel',\n 'announcement',\n 'membership',\n 'payment',\n 'system',\n]);\nexport type NotificationCategory = z.infer<typeof notificationCategorySchema>;\n\n// ─── Entity ──────────────────────────────────────────────────────────────────\n\nexport const notificationSchema = z.object({\n id: objectIdSchema,\n userId: objectIdSchema,\n category: notificationCategorySchema,\n title: z.string(),\n body: z.string(),\n /** Optional deep-link the card opens. */\n actionUrl: z.string().nullable(),\n readAt: isoDateTimeSchema.nullable(),\n createdAt: isoDateTimeSchema,\n});\nexport type AppNotification = z.infer<typeof notificationSchema>;\n\n// ─── Query ───────────────────────────────────────────────────────────────────\n\nexport const notificationListQuerySchema = paginationSchema.extend({\n // Query booleans arrive as strings — `z.coerce.boolean(\"false\")` is `true`\n // (any non-empty string is truthy), so parse the literal instead.\n unreadOnly: z\n .enum(['true', 'false'])\n .optional()\n .transform((v) => v === 'true'),\n});\nexport type NotificationListQuery = z.infer<typeof notificationListQuerySchema>;\n\n/** Mark specific notifications read; empty `ids` = mark all read. */\nexport const markNotificationsReadBodySchema = z.object({\n ids: z.array(objectIdSchema).default([]),\n});\nexport type MarkNotificationsReadBody = z.infer<typeof markNotificationsReadBodySchema>;\n"]}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Onboarding submit payloads
|
|
3
|
+
* ============================================
|
|
4
|
+
* The end-of-flow POST bodies. The frontend forms stay flat (three-part DOB,
|
|
5
|
+
* etc.); at submit they map to these structured payloads, which compose the
|
|
6
|
+
* canonical create schemas so the backend can fan out to the right collections.
|
|
7
|
+
*
|
|
8
|
+
* member → member-profile + a pending membership (join a gym by code)
|
|
9
|
+
* owner → organisation + first center + SaaS subscription selection
|
|
10
|
+
*
|
|
11
|
+
* @module gymmonk-schema/onboarding
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
export declare const onboardingRoleSchema: z.ZodEnum<{
|
|
15
|
+
owner: "owner";
|
|
16
|
+
member: "member";
|
|
17
|
+
}>;
|
|
18
|
+
export type OnboardingRole = z.infer<typeof onboardingRoleSchema>;
|
|
19
|
+
export declare const memberOnboardingBodySchema: z.ZodObject<{
|
|
20
|
+
gymCode: z.ZodString;
|
|
21
|
+
firstName: z.ZodString;
|
|
22
|
+
lastName: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
23
|
+
gender: z.ZodEnum<{
|
|
24
|
+
male: "male";
|
|
25
|
+
female: "female";
|
|
26
|
+
other: "other";
|
|
27
|
+
}>;
|
|
28
|
+
dob: z.ZodString;
|
|
29
|
+
phone: z.ZodString;
|
|
30
|
+
body: z.ZodObject<{
|
|
31
|
+
heightCm: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
weightKg: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
neckCm: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
waistCm: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
hipsCm: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
forearmCm: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
armsCm: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
chestCm: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
thighCm: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
calfCm: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
emergencyContact: z.ZodObject<{
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
phone: z.ZodString;
|
|
45
|
+
relationship: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
bloodGroup: z.ZodEnum<{
|
|
48
|
+
"A+": "A+";
|
|
49
|
+
"A-": "A-";
|
|
50
|
+
"B+": "B+";
|
|
51
|
+
"B-": "B-";
|
|
52
|
+
"O+": "O+";
|
|
53
|
+
"O-": "O-";
|
|
54
|
+
"AB+": "AB+";
|
|
55
|
+
"AB-": "AB-";
|
|
56
|
+
}>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
export type MemberOnboardingBody = z.infer<typeof memberOnboardingBodySchema>;
|
|
59
|
+
/** The owner's personal basics captured before the organisation/center. */
|
|
60
|
+
export declare const ownerBasicsSchema: z.ZodObject<{
|
|
61
|
+
firstName: z.ZodString;
|
|
62
|
+
lastName: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
63
|
+
gender: z.ZodEnum<{
|
|
64
|
+
male: "male";
|
|
65
|
+
female: "female";
|
|
66
|
+
other: "other";
|
|
67
|
+
}>;
|
|
68
|
+
dob: z.ZodOptional<z.ZodString>;
|
|
69
|
+
phone: z.ZodString;
|
|
70
|
+
altEmail: z.ZodPreprocess<z.ZodOptional<z.ZodEmail>>;
|
|
71
|
+
website: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
72
|
+
socials: z.ZodObject<{
|
|
73
|
+
jansathi: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
74
|
+
youtube: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
75
|
+
instagram: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
76
|
+
facebook: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
79
|
+
street: z.ZodString;
|
|
80
|
+
city: z.ZodString;
|
|
81
|
+
state: z.ZodEnum<{
|
|
82
|
+
"Andhra Pradesh": "Andhra Pradesh";
|
|
83
|
+
"Arunachal Pradesh": "Arunachal Pradesh";
|
|
84
|
+
Assam: "Assam";
|
|
85
|
+
Bihar: "Bihar";
|
|
86
|
+
Chhattisgarh: "Chhattisgarh";
|
|
87
|
+
Goa: "Goa";
|
|
88
|
+
Gujarat: "Gujarat";
|
|
89
|
+
Haryana: "Haryana";
|
|
90
|
+
"Himachal Pradesh": "Himachal Pradesh";
|
|
91
|
+
Jharkhand: "Jharkhand";
|
|
92
|
+
Karnataka: "Karnataka";
|
|
93
|
+
Kerala: "Kerala";
|
|
94
|
+
"Madhya Pradesh": "Madhya Pradesh";
|
|
95
|
+
Maharashtra: "Maharashtra";
|
|
96
|
+
Manipur: "Manipur";
|
|
97
|
+
Meghalaya: "Meghalaya";
|
|
98
|
+
Mizoram: "Mizoram";
|
|
99
|
+
Nagaland: "Nagaland";
|
|
100
|
+
Odisha: "Odisha";
|
|
101
|
+
Punjab: "Punjab";
|
|
102
|
+
Rajasthan: "Rajasthan";
|
|
103
|
+
Sikkim: "Sikkim";
|
|
104
|
+
"Tamil Nadu": "Tamil Nadu";
|
|
105
|
+
Telangana: "Telangana";
|
|
106
|
+
Tripura: "Tripura";
|
|
107
|
+
"Uttar Pradesh": "Uttar Pradesh";
|
|
108
|
+
Uttarakhand: "Uttarakhand";
|
|
109
|
+
"West Bengal": "West Bengal";
|
|
110
|
+
"Andaman and Nicobar Islands": "Andaman and Nicobar Islands";
|
|
111
|
+
Chandigarh: "Chandigarh";
|
|
112
|
+
"Dadra and Nagar Haveli and Daman and Diu": "Dadra and Nagar Haveli and Daman and Diu";
|
|
113
|
+
Delhi: "Delhi";
|
|
114
|
+
"Jammu and Kashmir": "Jammu and Kashmir";
|
|
115
|
+
Ladakh: "Ladakh";
|
|
116
|
+
Lakshadweep: "Lakshadweep";
|
|
117
|
+
Puducherry: "Puducherry";
|
|
118
|
+
}>;
|
|
119
|
+
pincode: z.ZodString;
|
|
120
|
+
}, z.core.$strip>>;
|
|
121
|
+
avatarUrl: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export type OwnerBasics = z.infer<typeof ownerBasicsSchema>;
|
|
124
|
+
/** The SaaS plan an owner selects at the final onboarding step. */
|
|
125
|
+
export declare const onboardingPlanSelectionSchema: z.ZodObject<{
|
|
126
|
+
planId: z.ZodString;
|
|
127
|
+
tenureId: z.ZodNullable<z.ZodString>;
|
|
128
|
+
}, z.core.$strip>;
|
|
129
|
+
export type OnboardingPlanSelection = z.infer<typeof onboardingPlanSelectionSchema>;
|
|
130
|
+
export declare const ownerOnboardingBodySchema: z.ZodObject<{
|
|
131
|
+
owner: z.ZodObject<{
|
|
132
|
+
firstName: z.ZodString;
|
|
133
|
+
lastName: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
134
|
+
gender: z.ZodEnum<{
|
|
135
|
+
male: "male";
|
|
136
|
+
female: "female";
|
|
137
|
+
other: "other";
|
|
138
|
+
}>;
|
|
139
|
+
dob: z.ZodOptional<z.ZodString>;
|
|
140
|
+
phone: z.ZodString;
|
|
141
|
+
altEmail: z.ZodPreprocess<z.ZodOptional<z.ZodEmail>>;
|
|
142
|
+
website: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
143
|
+
socials: z.ZodObject<{
|
|
144
|
+
jansathi: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
145
|
+
youtube: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
146
|
+
instagram: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
147
|
+
facebook: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
150
|
+
street: z.ZodString;
|
|
151
|
+
city: z.ZodString;
|
|
152
|
+
state: z.ZodEnum<{
|
|
153
|
+
"Andhra Pradesh": "Andhra Pradesh";
|
|
154
|
+
"Arunachal Pradesh": "Arunachal Pradesh";
|
|
155
|
+
Assam: "Assam";
|
|
156
|
+
Bihar: "Bihar";
|
|
157
|
+
Chhattisgarh: "Chhattisgarh";
|
|
158
|
+
Goa: "Goa";
|
|
159
|
+
Gujarat: "Gujarat";
|
|
160
|
+
Haryana: "Haryana";
|
|
161
|
+
"Himachal Pradesh": "Himachal Pradesh";
|
|
162
|
+
Jharkhand: "Jharkhand";
|
|
163
|
+
Karnataka: "Karnataka";
|
|
164
|
+
Kerala: "Kerala";
|
|
165
|
+
"Madhya Pradesh": "Madhya Pradesh";
|
|
166
|
+
Maharashtra: "Maharashtra";
|
|
167
|
+
Manipur: "Manipur";
|
|
168
|
+
Meghalaya: "Meghalaya";
|
|
169
|
+
Mizoram: "Mizoram";
|
|
170
|
+
Nagaland: "Nagaland";
|
|
171
|
+
Odisha: "Odisha";
|
|
172
|
+
Punjab: "Punjab";
|
|
173
|
+
Rajasthan: "Rajasthan";
|
|
174
|
+
Sikkim: "Sikkim";
|
|
175
|
+
"Tamil Nadu": "Tamil Nadu";
|
|
176
|
+
Telangana: "Telangana";
|
|
177
|
+
Tripura: "Tripura";
|
|
178
|
+
"Uttar Pradesh": "Uttar Pradesh";
|
|
179
|
+
Uttarakhand: "Uttarakhand";
|
|
180
|
+
"West Bengal": "West Bengal";
|
|
181
|
+
"Andaman and Nicobar Islands": "Andaman and Nicobar Islands";
|
|
182
|
+
Chandigarh: "Chandigarh";
|
|
183
|
+
"Dadra and Nagar Haveli and Daman and Diu": "Dadra and Nagar Haveli and Daman and Diu";
|
|
184
|
+
Delhi: "Delhi";
|
|
185
|
+
"Jammu and Kashmir": "Jammu and Kashmir";
|
|
186
|
+
Ladakh: "Ladakh";
|
|
187
|
+
Lakshadweep: "Lakshadweep";
|
|
188
|
+
Puducherry: "Puducherry";
|
|
189
|
+
}>;
|
|
190
|
+
pincode: z.ZodString;
|
|
191
|
+
}, z.core.$strip>>;
|
|
192
|
+
avatarUrl: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
193
|
+
}, z.core.$strip>;
|
|
194
|
+
organisation: z.ZodObject<{
|
|
195
|
+
name: z.ZodString;
|
|
196
|
+
description: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
197
|
+
address: z.ZodObject<{
|
|
198
|
+
street: z.ZodString;
|
|
199
|
+
city: z.ZodString;
|
|
200
|
+
state: z.ZodEnum<{
|
|
201
|
+
"Andhra Pradesh": "Andhra Pradesh";
|
|
202
|
+
"Arunachal Pradesh": "Arunachal Pradesh";
|
|
203
|
+
Assam: "Assam";
|
|
204
|
+
Bihar: "Bihar";
|
|
205
|
+
Chhattisgarh: "Chhattisgarh";
|
|
206
|
+
Goa: "Goa";
|
|
207
|
+
Gujarat: "Gujarat";
|
|
208
|
+
Haryana: "Haryana";
|
|
209
|
+
"Himachal Pradesh": "Himachal Pradesh";
|
|
210
|
+
Jharkhand: "Jharkhand";
|
|
211
|
+
Karnataka: "Karnataka";
|
|
212
|
+
Kerala: "Kerala";
|
|
213
|
+
"Madhya Pradesh": "Madhya Pradesh";
|
|
214
|
+
Maharashtra: "Maharashtra";
|
|
215
|
+
Manipur: "Manipur";
|
|
216
|
+
Meghalaya: "Meghalaya";
|
|
217
|
+
Mizoram: "Mizoram";
|
|
218
|
+
Nagaland: "Nagaland";
|
|
219
|
+
Odisha: "Odisha";
|
|
220
|
+
Punjab: "Punjab";
|
|
221
|
+
Rajasthan: "Rajasthan";
|
|
222
|
+
Sikkim: "Sikkim";
|
|
223
|
+
"Tamil Nadu": "Tamil Nadu";
|
|
224
|
+
Telangana: "Telangana";
|
|
225
|
+
Tripura: "Tripura";
|
|
226
|
+
"Uttar Pradesh": "Uttar Pradesh";
|
|
227
|
+
Uttarakhand: "Uttarakhand";
|
|
228
|
+
"West Bengal": "West Bengal";
|
|
229
|
+
"Andaman and Nicobar Islands": "Andaman and Nicobar Islands";
|
|
230
|
+
Chandigarh: "Chandigarh";
|
|
231
|
+
"Dadra and Nagar Haveli and Daman and Diu": "Dadra and Nagar Haveli and Daman and Diu";
|
|
232
|
+
Delhi: "Delhi";
|
|
233
|
+
"Jammu and Kashmir": "Jammu and Kashmir";
|
|
234
|
+
Ladakh: "Ladakh";
|
|
235
|
+
Lakshadweep: "Lakshadweep";
|
|
236
|
+
Puducherry: "Puducherry";
|
|
237
|
+
}>;
|
|
238
|
+
pincode: z.ZodString;
|
|
239
|
+
}, z.core.$strip>;
|
|
240
|
+
gstNumber: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
241
|
+
registrationNumber: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
242
|
+
website: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
243
|
+
socials: z.ZodObject<{
|
|
244
|
+
jansathi: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
245
|
+
youtube: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
246
|
+
instagram: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
247
|
+
facebook: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
numberOfCenters: z.ZodNumber;
|
|
250
|
+
}, z.core.$strip>;
|
|
251
|
+
center: z.ZodObject<{
|
|
252
|
+
name: z.ZodString;
|
|
253
|
+
description: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
254
|
+
types: z.ZodArray<z.ZodEnum<{
|
|
255
|
+
gym: "gym";
|
|
256
|
+
crossfit: "crossfit";
|
|
257
|
+
yoga: "yoga";
|
|
258
|
+
pilates: "pilates";
|
|
259
|
+
zumba: "zumba";
|
|
260
|
+
cardio: "cardio";
|
|
261
|
+
strength: "strength";
|
|
262
|
+
mma: "mma";
|
|
263
|
+
boxing: "boxing";
|
|
264
|
+
swimming: "swimming";
|
|
265
|
+
aerobics: "aerobics";
|
|
266
|
+
"personal-training": "personal-training";
|
|
267
|
+
}>>;
|
|
268
|
+
address: z.ZodObject<{
|
|
269
|
+
street: z.ZodString;
|
|
270
|
+
city: z.ZodString;
|
|
271
|
+
state: z.ZodEnum<{
|
|
272
|
+
"Andhra Pradesh": "Andhra Pradesh";
|
|
273
|
+
"Arunachal Pradesh": "Arunachal Pradesh";
|
|
274
|
+
Assam: "Assam";
|
|
275
|
+
Bihar: "Bihar";
|
|
276
|
+
Chhattisgarh: "Chhattisgarh";
|
|
277
|
+
Goa: "Goa";
|
|
278
|
+
Gujarat: "Gujarat";
|
|
279
|
+
Haryana: "Haryana";
|
|
280
|
+
"Himachal Pradesh": "Himachal Pradesh";
|
|
281
|
+
Jharkhand: "Jharkhand";
|
|
282
|
+
Karnataka: "Karnataka";
|
|
283
|
+
Kerala: "Kerala";
|
|
284
|
+
"Madhya Pradesh": "Madhya Pradesh";
|
|
285
|
+
Maharashtra: "Maharashtra";
|
|
286
|
+
Manipur: "Manipur";
|
|
287
|
+
Meghalaya: "Meghalaya";
|
|
288
|
+
Mizoram: "Mizoram";
|
|
289
|
+
Nagaland: "Nagaland";
|
|
290
|
+
Odisha: "Odisha";
|
|
291
|
+
Punjab: "Punjab";
|
|
292
|
+
Rajasthan: "Rajasthan";
|
|
293
|
+
Sikkim: "Sikkim";
|
|
294
|
+
"Tamil Nadu": "Tamil Nadu";
|
|
295
|
+
Telangana: "Telangana";
|
|
296
|
+
Tripura: "Tripura";
|
|
297
|
+
"Uttar Pradesh": "Uttar Pradesh";
|
|
298
|
+
Uttarakhand: "Uttarakhand";
|
|
299
|
+
"West Bengal": "West Bengal";
|
|
300
|
+
"Andaman and Nicobar Islands": "Andaman and Nicobar Islands";
|
|
301
|
+
Chandigarh: "Chandigarh";
|
|
302
|
+
"Dadra and Nagar Haveli and Daman and Diu": "Dadra and Nagar Haveli and Daman and Diu";
|
|
303
|
+
Delhi: "Delhi";
|
|
304
|
+
"Jammu and Kashmir": "Jammu and Kashmir";
|
|
305
|
+
Ladakh: "Ladakh";
|
|
306
|
+
Lakshadweep: "Lakshadweep";
|
|
307
|
+
Puducherry: "Puducherry";
|
|
308
|
+
}>;
|
|
309
|
+
pincode: z.ZodString;
|
|
310
|
+
}, z.core.$strip>;
|
|
311
|
+
floorAreaSqft: z.ZodOptional<z.ZodNumber>;
|
|
312
|
+
primaryPhone: z.ZodString;
|
|
313
|
+
secondaryPhone: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
314
|
+
email: z.ZodPreprocess<z.ZodOptional<z.ZodEmail>>;
|
|
315
|
+
website: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
316
|
+
hours: z.ZodObject<{
|
|
317
|
+
mon: z.ZodObject<{
|
|
318
|
+
open: z.ZodBoolean;
|
|
319
|
+
from: z.ZodString;
|
|
320
|
+
to: z.ZodString;
|
|
321
|
+
}, z.core.$strip>;
|
|
322
|
+
tue: z.ZodObject<{
|
|
323
|
+
open: z.ZodBoolean;
|
|
324
|
+
from: z.ZodString;
|
|
325
|
+
to: z.ZodString;
|
|
326
|
+
}, z.core.$strip>;
|
|
327
|
+
wed: z.ZodObject<{
|
|
328
|
+
open: z.ZodBoolean;
|
|
329
|
+
from: z.ZodString;
|
|
330
|
+
to: z.ZodString;
|
|
331
|
+
}, z.core.$strip>;
|
|
332
|
+
thu: z.ZodObject<{
|
|
333
|
+
open: z.ZodBoolean;
|
|
334
|
+
from: z.ZodString;
|
|
335
|
+
to: z.ZodString;
|
|
336
|
+
}, z.core.$strip>;
|
|
337
|
+
fri: z.ZodObject<{
|
|
338
|
+
open: z.ZodBoolean;
|
|
339
|
+
from: z.ZodString;
|
|
340
|
+
to: z.ZodString;
|
|
341
|
+
}, z.core.$strip>;
|
|
342
|
+
sat: z.ZodObject<{
|
|
343
|
+
open: z.ZodBoolean;
|
|
344
|
+
from: z.ZodString;
|
|
345
|
+
to: z.ZodString;
|
|
346
|
+
}, z.core.$strip>;
|
|
347
|
+
sun: z.ZodObject<{
|
|
348
|
+
open: z.ZodBoolean;
|
|
349
|
+
from: z.ZodString;
|
|
350
|
+
to: z.ZodString;
|
|
351
|
+
}, z.core.$strip>;
|
|
352
|
+
}, z.core.$strip>;
|
|
353
|
+
photos: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
354
|
+
}, z.core.$strip>;
|
|
355
|
+
subscription: z.ZodObject<{
|
|
356
|
+
planId: z.ZodString;
|
|
357
|
+
tenureId: z.ZodNullable<z.ZodString>;
|
|
358
|
+
}, z.core.$strip>;
|
|
359
|
+
}, z.core.$strip>;
|
|
360
|
+
export type OwnerOnboardingBody = z.infer<typeof ownerOnboardingBodySchema>;
|
|
361
|
+
//# sourceMappingURL=onboarding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../src/onboarding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,oBAAoB;;;EAA8B,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwBnC,CAAC;AACL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAI9E,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAa5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,mEAAmE;AACnE,eAAO,MAAM,6BAA6B;;;iBAGxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Onboarding submit payloads
|
|
3
|
+
* ============================================
|
|
4
|
+
* The end-of-flow POST bodies. The frontend forms stay flat (three-part DOB,
|
|
5
|
+
* etc.); at submit they map to these structured payloads, which compose the
|
|
6
|
+
* canonical create schemas so the backend can fan out to the right collections.
|
|
7
|
+
*
|
|
8
|
+
* member → member-profile + a pending membership (join a gym by code)
|
|
9
|
+
* owner → organisation + first center + SaaS subscription selection
|
|
10
|
+
*
|
|
11
|
+
* @module gymmonk-schema/onboarding
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import { createCenterBodySchema, gymCodeSchema } from './center.js';
|
|
15
|
+
import { isoDateSchema, optionalEmailSchema, optionalTrimmedString, phoneSchema, } from './common.js';
|
|
16
|
+
import { bodyMetricsSchema, emergencyContactSchema } from './member-profile.js';
|
|
17
|
+
import { createOrganisationBodySchema } from './organisation.js';
|
|
18
|
+
import { addressSchema, bloodGroupSchema, genderSchema, socialLinksSchema } from './shared.js';
|
|
19
|
+
// ─── Role ────────────────────────────────────────────────────────────────────
|
|
20
|
+
export const onboardingRoleSchema = z.enum(['owner', 'member']);
|
|
21
|
+
// ─── Member onboarding ───────────────────────────────────────────────────────
|
|
22
|
+
export const memberOnboardingBodySchema = z
|
|
23
|
+
.object({
|
|
24
|
+
/** The gym code the member picked at the "find your gym" step. */
|
|
25
|
+
gymCode: gymCodeSchema,
|
|
26
|
+
firstName: z.string().trim().min(1, 'First name is required').max(80),
|
|
27
|
+
lastName: optionalTrimmedString(80),
|
|
28
|
+
gender: genderSchema,
|
|
29
|
+
dob: isoDateSchema,
|
|
30
|
+
phone: phoneSchema,
|
|
31
|
+
body: bodyMetricsSchema,
|
|
32
|
+
emergencyContact: emergencyContactSchema,
|
|
33
|
+
bloodGroup: bloodGroupSchema,
|
|
34
|
+
})
|
|
35
|
+
.refine((v) => v.body.heightCm != null && v.body.weightKg != null, {
|
|
36
|
+
message: 'Height and weight are required',
|
|
37
|
+
path: ['body'],
|
|
38
|
+
})
|
|
39
|
+
.refine((v) => v.body.neckCm != null && v.body.waistCm != null, {
|
|
40
|
+
message: 'Neck and waist are required',
|
|
41
|
+
path: ['body'],
|
|
42
|
+
})
|
|
43
|
+
.refine((v) => v.gender !== 'female' || v.body.hipsCm != null, {
|
|
44
|
+
message: 'Hips measurement is required',
|
|
45
|
+
path: ['body', 'hipsCm'],
|
|
46
|
+
});
|
|
47
|
+
// ─── Owner onboarding ────────────────────────────────────────────────────────
|
|
48
|
+
/** The owner's personal basics captured before the organisation/center. */
|
|
49
|
+
export const ownerBasicsSchema = z.object({
|
|
50
|
+
firstName: z.string().trim().min(1, 'First name is required').max(80),
|
|
51
|
+
lastName: optionalTrimmedString(80),
|
|
52
|
+
gender: genderSchema,
|
|
53
|
+
dob: isoDateSchema.optional(),
|
|
54
|
+
phone: phoneSchema,
|
|
55
|
+
altEmail: optionalEmailSchema,
|
|
56
|
+
website: optionalTrimmedString(200),
|
|
57
|
+
socials: socialLinksSchema,
|
|
58
|
+
/** The owner's personal contact address (step-2 of owner onboarding). */
|
|
59
|
+
address: addressSchema.optional(),
|
|
60
|
+
/** Uploaded profile photo → stored on the shared `User.avatar`. */
|
|
61
|
+
avatarUrl: optionalTrimmedString(2000),
|
|
62
|
+
});
|
|
63
|
+
/** The SaaS plan an owner selects at the final onboarding step. */
|
|
64
|
+
export const onboardingPlanSelectionSchema = z.object({
|
|
65
|
+
planId: z.string().trim().min(1),
|
|
66
|
+
tenureId: z.string().trim().min(1).nullable(),
|
|
67
|
+
});
|
|
68
|
+
export const ownerOnboardingBodySchema = z.object({
|
|
69
|
+
owner: ownerBasicsSchema,
|
|
70
|
+
organisation: createOrganisationBodySchema,
|
|
71
|
+
center: createCenterBodySchema,
|
|
72
|
+
subscription: onboardingPlanSelectionSchema,
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=onboarding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../src/onboarding.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * gymmonk-schema — Onboarding submit payloads\n * ============================================\n * The end-of-flow POST bodies. The frontend forms stay flat (three-part DOB,\n * etc.); at submit they map to these structured payloads, which compose the\n * canonical create schemas so the backend can fan out to the right collections.\n *\n * member → member-profile + a pending membership (join a gym by code)\n * owner → organisation + first center + SaaS subscription selection\n *\n * @module gymmonk-schema/onboarding\n */\n\nimport { z } from 'zod';\nimport { createCenterBodySchema, gymCodeSchema } from './center.js';\nimport {\n isoDateSchema,\n optionalEmailSchema,\n optionalTrimmedString,\n phoneSchema,\n} from './common.js';\nimport { bodyMetricsSchema, emergencyContactSchema } from './member-profile.js';\nimport { createOrganisationBodySchema } from './organisation.js';\nimport { addressSchema, bloodGroupSchema, genderSchema, socialLinksSchema } from './shared.js';\n\n// ─── Role ────────────────────────────────────────────────────────────────────\n\nexport const onboardingRoleSchema = z.enum(['owner', 'member']);\nexport type OnboardingRole = z.infer<typeof onboardingRoleSchema>;\n\n// ─── Member onboarding ───────────────────────────────────────────────────────\n\nexport const memberOnboardingBodySchema = z\n .object({\n /** The gym code the member picked at the \"find your gym\" step. */\n gymCode: gymCodeSchema,\n firstName: z.string().trim().min(1, 'First name is required').max(80),\n lastName: optionalTrimmedString(80),\n gender: genderSchema,\n dob: isoDateSchema,\n phone: phoneSchema,\n body: bodyMetricsSchema,\n emergencyContact: emergencyContactSchema,\n bloodGroup: bloodGroupSchema,\n })\n .refine((v) => v.body.heightCm != null && v.body.weightKg != null, {\n message: 'Height and weight are required',\n path: ['body'],\n })\n .refine((v) => v.body.neckCm != null && v.body.waistCm != null, {\n message: 'Neck and waist are required',\n path: ['body'],\n })\n .refine((v) => v.gender !== 'female' || v.body.hipsCm != null, {\n message: 'Hips measurement is required',\n path: ['body', 'hipsCm'],\n });\nexport type MemberOnboardingBody = z.infer<typeof memberOnboardingBodySchema>;\n\n// ─── Owner onboarding ────────────────────────────────────────────────────────\n\n/** The owner's personal basics captured before the organisation/center. */\nexport const ownerBasicsSchema = z.object({\n firstName: z.string().trim().min(1, 'First name is required').max(80),\n lastName: optionalTrimmedString(80),\n gender: genderSchema,\n dob: isoDateSchema.optional(),\n phone: phoneSchema,\n altEmail: optionalEmailSchema,\n website: optionalTrimmedString(200),\n socials: socialLinksSchema,\n /** The owner's personal contact address (step-2 of owner onboarding). */\n address: addressSchema.optional(),\n /** Uploaded profile photo → stored on the shared `User.avatar`. */\n avatarUrl: optionalTrimmedString(2000),\n});\nexport type OwnerBasics = z.infer<typeof ownerBasicsSchema>;\n\n/** The SaaS plan an owner selects at the final onboarding step. */\nexport const onboardingPlanSelectionSchema = z.object({\n planId: z.string().trim().min(1),\n tenureId: z.string().trim().min(1).nullable(),\n});\nexport type OnboardingPlanSelection = z.infer<typeof onboardingPlanSelectionSchema>;\n\nexport const ownerOnboardingBodySchema = z.object({\n owner: ownerBasicsSchema,\n organisation: createOrganisationBodySchema,\n center: createCenterBodySchema,\n subscription: onboardingPlanSelectionSchema,\n});\nexport type OwnerOnboardingBody = z.infer<typeof ownerOnboardingBodySchema>;\n"]}
|