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/staff.d.ts
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Staff (trainers, managers, support)
|
|
3
|
+
* ====================================================
|
|
4
|
+
* A center's employees. Like members, adding a staff member provisions a real
|
|
5
|
+
* central-auth account (returns login email + temp password). Trainers can have
|
|
6
|
+
* members assigned to them.
|
|
7
|
+
*
|
|
8
|
+
* @module gymmonk-schema/staff
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
export declare const staffRoleSchema: z.ZodEnum<{
|
|
12
|
+
trainer: "trainer";
|
|
13
|
+
manager: "manager";
|
|
14
|
+
cleaning: "cleaning";
|
|
15
|
+
reception: "reception";
|
|
16
|
+
}>;
|
|
17
|
+
export type StaffRole = z.infer<typeof staffRoleSchema>;
|
|
18
|
+
export declare const staffStatusSchema: z.ZodEnum<{
|
|
19
|
+
active: "active";
|
|
20
|
+
inactive: "inactive";
|
|
21
|
+
}>;
|
|
22
|
+
export type StaffStatus = z.infer<typeof staffStatusSchema>;
|
|
23
|
+
export declare const staffListItemSchema: z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
26
|
+
staffCode: z.ZodString;
|
|
27
|
+
name: z.ZodString;
|
|
28
|
+
role: z.ZodEnum<{
|
|
29
|
+
trainer: "trainer";
|
|
30
|
+
manager: "manager";
|
|
31
|
+
cleaning: "cleaning";
|
|
32
|
+
reception: "reception";
|
|
33
|
+
}>;
|
|
34
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
35
|
+
verified: z.ZodBoolean;
|
|
36
|
+
status: z.ZodEnum<{
|
|
37
|
+
active: "active";
|
|
38
|
+
inactive: "inactive";
|
|
39
|
+
}>;
|
|
40
|
+
onDuty: z.ZodBoolean;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
export type StaffListItem = z.infer<typeof staffListItemSchema>;
|
|
43
|
+
export declare const staffListSummarySchema: z.ZodObject<{
|
|
44
|
+
total: z.ZodNumber;
|
|
45
|
+
active: z.ZodNumber;
|
|
46
|
+
onDuty: z.ZodNumber;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export type StaffListSummary = z.infer<typeof staffListSummarySchema>;
|
|
49
|
+
/** A member assigned to a trainer, shown on the trainer detail. */
|
|
50
|
+
export declare const assignedMemberRefSchema: z.ZodObject<{
|
|
51
|
+
memberProfileId: z.ZodString;
|
|
52
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
53
|
+
name: z.ZodString;
|
|
54
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
55
|
+
note: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export type AssignedMemberRef = z.infer<typeof assignedMemberRefSchema>;
|
|
58
|
+
export declare const staffDetailSchema: z.ZodObject<{
|
|
59
|
+
id: z.ZodString;
|
|
60
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
61
|
+
staffCode: z.ZodString;
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
email: z.ZodString;
|
|
64
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
65
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
66
|
+
role: z.ZodEnum<{
|
|
67
|
+
trainer: "trainer";
|
|
68
|
+
manager: "manager";
|
|
69
|
+
cleaning: "cleaning";
|
|
70
|
+
reception: "reception";
|
|
71
|
+
}>;
|
|
72
|
+
status: z.ZodEnum<{
|
|
73
|
+
active: "active";
|
|
74
|
+
inactive: "inactive";
|
|
75
|
+
}>;
|
|
76
|
+
onDuty: z.ZodBoolean;
|
|
77
|
+
verified: z.ZodBoolean;
|
|
78
|
+
gender: z.ZodNullable<z.ZodEnum<{
|
|
79
|
+
male: "male";
|
|
80
|
+
female: "female";
|
|
81
|
+
other: "other";
|
|
82
|
+
}>>;
|
|
83
|
+
dob: z.ZodNullable<z.ZodString>;
|
|
84
|
+
bloodGroup: z.ZodNullable<z.ZodEnum<{
|
|
85
|
+
"A+": "A+";
|
|
86
|
+
"A-": "A-";
|
|
87
|
+
"B+": "B+";
|
|
88
|
+
"B-": "B-";
|
|
89
|
+
"O+": "O+";
|
|
90
|
+
"O-": "O-";
|
|
91
|
+
"AB+": "AB+";
|
|
92
|
+
"AB-": "AB-";
|
|
93
|
+
}>>;
|
|
94
|
+
address: z.ZodNullable<z.ZodObject<{
|
|
95
|
+
street: z.ZodString;
|
|
96
|
+
city: z.ZodString;
|
|
97
|
+
state: z.ZodEnum<{
|
|
98
|
+
"Andhra Pradesh": "Andhra Pradesh";
|
|
99
|
+
"Arunachal Pradesh": "Arunachal Pradesh";
|
|
100
|
+
Assam: "Assam";
|
|
101
|
+
Bihar: "Bihar";
|
|
102
|
+
Chhattisgarh: "Chhattisgarh";
|
|
103
|
+
Goa: "Goa";
|
|
104
|
+
Gujarat: "Gujarat";
|
|
105
|
+
Haryana: "Haryana";
|
|
106
|
+
"Himachal Pradesh": "Himachal Pradesh";
|
|
107
|
+
Jharkhand: "Jharkhand";
|
|
108
|
+
Karnataka: "Karnataka";
|
|
109
|
+
Kerala: "Kerala";
|
|
110
|
+
"Madhya Pradesh": "Madhya Pradesh";
|
|
111
|
+
Maharashtra: "Maharashtra";
|
|
112
|
+
Manipur: "Manipur";
|
|
113
|
+
Meghalaya: "Meghalaya";
|
|
114
|
+
Mizoram: "Mizoram";
|
|
115
|
+
Nagaland: "Nagaland";
|
|
116
|
+
Odisha: "Odisha";
|
|
117
|
+
Punjab: "Punjab";
|
|
118
|
+
Rajasthan: "Rajasthan";
|
|
119
|
+
Sikkim: "Sikkim";
|
|
120
|
+
"Tamil Nadu": "Tamil Nadu";
|
|
121
|
+
Telangana: "Telangana";
|
|
122
|
+
Tripura: "Tripura";
|
|
123
|
+
"Uttar Pradesh": "Uttar Pradesh";
|
|
124
|
+
Uttarakhand: "Uttarakhand";
|
|
125
|
+
"West Bengal": "West Bengal";
|
|
126
|
+
"Andaman and Nicobar Islands": "Andaman and Nicobar Islands";
|
|
127
|
+
Chandigarh: "Chandigarh";
|
|
128
|
+
"Dadra and Nagar Haveli and Daman and Diu": "Dadra and Nagar Haveli and Daman and Diu";
|
|
129
|
+
Delhi: "Delhi";
|
|
130
|
+
"Jammu and Kashmir": "Jammu and Kashmir";
|
|
131
|
+
Ladakh: "Ladakh";
|
|
132
|
+
Lakshadweep: "Lakshadweep";
|
|
133
|
+
Puducherry: "Puducherry";
|
|
134
|
+
}>;
|
|
135
|
+
pincode: z.ZodString;
|
|
136
|
+
}, z.core.$strip>>;
|
|
137
|
+
emergencyContacts: z.ZodArray<z.ZodObject<{
|
|
138
|
+
name: z.ZodString;
|
|
139
|
+
phone: z.ZodString;
|
|
140
|
+
relationship: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
141
|
+
}, z.core.$strip>>;
|
|
142
|
+
joinedAt: z.ZodISODateTime;
|
|
143
|
+
balancePaid: z.ZodBoolean;
|
|
144
|
+
nextPaymentDate: z.ZodNullable<z.ZodString>;
|
|
145
|
+
assignedMembers: z.ZodArray<z.ZodObject<{
|
|
146
|
+
memberProfileId: z.ZodString;
|
|
147
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
148
|
+
name: z.ZodString;
|
|
149
|
+
avatarUrl: z.ZodNullable<z.ZodString>;
|
|
150
|
+
note: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
151
|
+
}, z.core.$strip>>;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
export type StaffDetail = z.infer<typeof staffDetailSchema>;
|
|
154
|
+
export declare const staffPaymentStatusSchema: z.ZodEnum<{
|
|
155
|
+
success: "success";
|
|
156
|
+
failed: "failed";
|
|
157
|
+
pending: "pending";
|
|
158
|
+
}>;
|
|
159
|
+
export type StaffPaymentStatus = z.infer<typeof staffPaymentStatusSchema>;
|
|
160
|
+
/** A salary / payout entry against a staff member. */
|
|
161
|
+
export declare const staffPaymentSchema: z.ZodObject<{
|
|
162
|
+
id: z.ZodString;
|
|
163
|
+
staffUserId: z.ZodString;
|
|
164
|
+
amountInr: z.ZodNumber;
|
|
165
|
+
status: z.ZodEnum<{
|
|
166
|
+
success: "success";
|
|
167
|
+
failed: "failed";
|
|
168
|
+
pending: "pending";
|
|
169
|
+
}>;
|
|
170
|
+
paidAt: z.ZodISODateTime;
|
|
171
|
+
note: z.ZodNullable<z.ZodString>;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
export type StaffPayment = z.infer<typeof staffPaymentSchema>;
|
|
174
|
+
export declare const recordStaffPaymentBodySchema: z.ZodObject<{
|
|
175
|
+
amountInr: z.ZodNumber;
|
|
176
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
177
|
+
success: "success";
|
|
178
|
+
failed: "failed";
|
|
179
|
+
pending: "pending";
|
|
180
|
+
}>>;
|
|
181
|
+
note: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export type RecordStaffPaymentBody = z.infer<typeof recordStaffPaymentBodySchema>;
|
|
184
|
+
export declare const createStaffBodySchema: z.ZodObject<{
|
|
185
|
+
firstName: z.ZodString;
|
|
186
|
+
lastName: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
187
|
+
email: z.ZodEmail;
|
|
188
|
+
phone: z.ZodString;
|
|
189
|
+
role: z.ZodEnum<{
|
|
190
|
+
trainer: "trainer";
|
|
191
|
+
manager: "manager";
|
|
192
|
+
cleaning: "cleaning";
|
|
193
|
+
reception: "reception";
|
|
194
|
+
}>;
|
|
195
|
+
gender: z.ZodEnum<{
|
|
196
|
+
male: "male";
|
|
197
|
+
female: "female";
|
|
198
|
+
other: "other";
|
|
199
|
+
}>;
|
|
200
|
+
dob: z.ZodOptional<z.ZodString>;
|
|
201
|
+
bloodGroup: z.ZodOptional<z.ZodEnum<{
|
|
202
|
+
"A+": "A+";
|
|
203
|
+
"A-": "A-";
|
|
204
|
+
"B+": "B+";
|
|
205
|
+
"B-": "B-";
|
|
206
|
+
"O+": "O+";
|
|
207
|
+
"O-": "O-";
|
|
208
|
+
"AB+": "AB+";
|
|
209
|
+
"AB-": "AB-";
|
|
210
|
+
}>>;
|
|
211
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
212
|
+
street: z.ZodString;
|
|
213
|
+
city: z.ZodString;
|
|
214
|
+
state: z.ZodEnum<{
|
|
215
|
+
"Andhra Pradesh": "Andhra Pradesh";
|
|
216
|
+
"Arunachal Pradesh": "Arunachal Pradesh";
|
|
217
|
+
Assam: "Assam";
|
|
218
|
+
Bihar: "Bihar";
|
|
219
|
+
Chhattisgarh: "Chhattisgarh";
|
|
220
|
+
Goa: "Goa";
|
|
221
|
+
Gujarat: "Gujarat";
|
|
222
|
+
Haryana: "Haryana";
|
|
223
|
+
"Himachal Pradesh": "Himachal Pradesh";
|
|
224
|
+
Jharkhand: "Jharkhand";
|
|
225
|
+
Karnataka: "Karnataka";
|
|
226
|
+
Kerala: "Kerala";
|
|
227
|
+
"Madhya Pradesh": "Madhya Pradesh";
|
|
228
|
+
Maharashtra: "Maharashtra";
|
|
229
|
+
Manipur: "Manipur";
|
|
230
|
+
Meghalaya: "Meghalaya";
|
|
231
|
+
Mizoram: "Mizoram";
|
|
232
|
+
Nagaland: "Nagaland";
|
|
233
|
+
Odisha: "Odisha";
|
|
234
|
+
Punjab: "Punjab";
|
|
235
|
+
Rajasthan: "Rajasthan";
|
|
236
|
+
Sikkim: "Sikkim";
|
|
237
|
+
"Tamil Nadu": "Tamil Nadu";
|
|
238
|
+
Telangana: "Telangana";
|
|
239
|
+
Tripura: "Tripura";
|
|
240
|
+
"Uttar Pradesh": "Uttar Pradesh";
|
|
241
|
+
Uttarakhand: "Uttarakhand";
|
|
242
|
+
"West Bengal": "West Bengal";
|
|
243
|
+
"Andaman and Nicobar Islands": "Andaman and Nicobar Islands";
|
|
244
|
+
Chandigarh: "Chandigarh";
|
|
245
|
+
"Dadra and Nagar Haveli and Daman and Diu": "Dadra and Nagar Haveli and Daman and Diu";
|
|
246
|
+
Delhi: "Delhi";
|
|
247
|
+
"Jammu and Kashmir": "Jammu and Kashmir";
|
|
248
|
+
Ladakh: "Ladakh";
|
|
249
|
+
Lakshadweep: "Lakshadweep";
|
|
250
|
+
Puducherry: "Puducherry";
|
|
251
|
+
}>;
|
|
252
|
+
pincode: z.ZodString;
|
|
253
|
+
}, z.core.$strip>>;
|
|
254
|
+
emergencyContacts: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
255
|
+
name: z.ZodString;
|
|
256
|
+
phone: z.ZodString;
|
|
257
|
+
relationship: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
258
|
+
}, z.core.$strip>>>;
|
|
259
|
+
idProofUrl: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
260
|
+
avatarUrl: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
261
|
+
}, z.core.$strip>;
|
|
262
|
+
export type CreateStaffBody = z.infer<typeof createStaffBodySchema>;
|
|
263
|
+
/**
|
|
264
|
+
* Adding staff creates a gym record + an invite, exactly like members — the gym
|
|
265
|
+
* never mints central-auth credentials. The gym ROLE (trainer / manager / …) is
|
|
266
|
+
* product data enforced by gymmonk-backend, never a platform-wide auth role.
|
|
267
|
+
*/
|
|
268
|
+
export declare const staffProvisionResultSchema: z.ZodObject<{
|
|
269
|
+
staffId: z.ZodString;
|
|
270
|
+
code: z.ZodString;
|
|
271
|
+
invite: z.ZodObject<{
|
|
272
|
+
code: z.ZodString;
|
|
273
|
+
url: z.ZodString;
|
|
274
|
+
email: z.ZodString;
|
|
275
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
276
|
+
expiresAt: z.ZodISODateTime;
|
|
277
|
+
}, z.core.$strip>;
|
|
278
|
+
}, z.core.$strip>;
|
|
279
|
+
export type StaffProvisionResult = z.infer<typeof staffProvisionResultSchema>;
|
|
280
|
+
export declare const setStaffDutyBodySchema: z.ZodObject<{
|
|
281
|
+
onDuty: z.ZodBoolean;
|
|
282
|
+
}, z.core.$strip>;
|
|
283
|
+
export type SetStaffDutyBody = z.infer<typeof setStaffDutyBodySchema>;
|
|
284
|
+
export declare const setStaffStatusBodySchema: z.ZodObject<{
|
|
285
|
+
active: z.ZodBoolean;
|
|
286
|
+
}, z.core.$strip>;
|
|
287
|
+
export type SetStaffStatusBody = z.infer<typeof setStaffStatusBodySchema>;
|
|
288
|
+
//# sourceMappingURL=staff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staff.d.ts","sourceRoot":"","sources":["../src/staff.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,eAAO,MAAM,eAAe;;;;;EAA0D,CAAC;AACvF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,iBAAiB;;;EAAiC,CAAC;AAChE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAI5D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;iBAY9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAItE,mEAAmE;AACnE,eAAO,MAAM,uBAAuB;;;;;;iBAOlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuB5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAI5D,eAAO,MAAM,wBAAwB;;;;EAA2C,CAAC;AACjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,sDAAsD;AACtD,eAAO,MAAM,kBAAkB;;;;;;;;;;;iBAO7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,4BAA4B;;;;;;;;iBAIvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAIlF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAahC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;iBAIrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAI9E,eAAO,MAAM,sBAAsB;;iBAAoC,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,wBAAwB;;iBAAoC,CAAC;AAC1E,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
package/dist/staff.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Staff (trainers, managers, support)
|
|
3
|
+
* ====================================================
|
|
4
|
+
* A center's employees. Like members, adding a staff member provisions a real
|
|
5
|
+
* central-auth account (returns login email + temp password). Trainers can have
|
|
6
|
+
* members assigned to them.
|
|
7
|
+
*
|
|
8
|
+
* @module gymmonk-schema/staff
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { isoDateSchema, isoDateTimeSchema, objectIdSchema, optionalTrimmedString, phoneSchema, priceInrSchema, } from './common.js';
|
|
12
|
+
import { memberInviteSchema } from './member.js';
|
|
13
|
+
import { emergencyContactSchema } from './member-profile.js';
|
|
14
|
+
import { addressSchema, bloodGroupSchema, genderSchema } from './shared.js';
|
|
15
|
+
// ─── Role & status ───────────────────────────────────────────────────────────
|
|
16
|
+
export const staffRoleSchema = z.enum(['trainer', 'manager', 'cleaning', 'reception']);
|
|
17
|
+
export const staffStatusSchema = z.enum(['active', 'inactive']);
|
|
18
|
+
// ─── List projection ─────────────────────────────────────────────────────────
|
|
19
|
+
export const staffListItemSchema = z.object({
|
|
20
|
+
/** The staff record id — always present, and what every `/staff/:id` route keys on. */
|
|
21
|
+
id: objectIdSchema,
|
|
22
|
+
/** Null until the staff member claims their invite (same model as members). */
|
|
23
|
+
userId: objectIdSchema.nullable(),
|
|
24
|
+
staffCode: z.string(),
|
|
25
|
+
name: z.string(),
|
|
26
|
+
role: staffRoleSchema,
|
|
27
|
+
avatarUrl: z.string().nullable(),
|
|
28
|
+
verified: z.boolean(),
|
|
29
|
+
status: staffStatusSchema,
|
|
30
|
+
onDuty: z.boolean(),
|
|
31
|
+
});
|
|
32
|
+
export const staffListSummarySchema = z.object({
|
|
33
|
+
total: z.number().int().nonnegative(),
|
|
34
|
+
active: z.number().int().nonnegative(),
|
|
35
|
+
onDuty: z.number().int().nonnegative(),
|
|
36
|
+
});
|
|
37
|
+
// ─── Detail projection ───────────────────────────────────────────────────────
|
|
38
|
+
/** A member assigned to a trainer, shown on the trainer detail. */
|
|
39
|
+
export const assignedMemberRefSchema = z.object({
|
|
40
|
+
/** The member RECORD id — what `/members/:id` keys on, so the row can link. */
|
|
41
|
+
memberProfileId: objectIdSchema,
|
|
42
|
+
userId: objectIdSchema.nullable(),
|
|
43
|
+
name: z.string(),
|
|
44
|
+
avatarUrl: z.string().nullable(),
|
|
45
|
+
note: optionalTrimmedString(160),
|
|
46
|
+
});
|
|
47
|
+
export const staffDetailSchema = z.object({
|
|
48
|
+
id: objectIdSchema,
|
|
49
|
+
userId: objectIdSchema.nullable(),
|
|
50
|
+
staffCode: z.string(),
|
|
51
|
+
name: z.string(),
|
|
52
|
+
email: z.string(),
|
|
53
|
+
phone: z.string().nullable(),
|
|
54
|
+
avatarUrl: z.string().nullable(),
|
|
55
|
+
role: staffRoleSchema,
|
|
56
|
+
status: staffStatusSchema,
|
|
57
|
+
onDuty: z.boolean(),
|
|
58
|
+
verified: z.boolean(),
|
|
59
|
+
gender: genderSchema.nullable(),
|
|
60
|
+
dob: isoDateSchema.nullable(),
|
|
61
|
+
bloodGroup: bloodGroupSchema.nullable(),
|
|
62
|
+
address: addressSchema.nullable(),
|
|
63
|
+
emergencyContacts: z.array(emergencyContactSchema),
|
|
64
|
+
joinedAt: isoDateTimeSchema,
|
|
65
|
+
/** Whether the latest salary/dues are settled. */
|
|
66
|
+
balancePaid: z.boolean(),
|
|
67
|
+
nextPaymentDate: isoDateSchema.nullable(),
|
|
68
|
+
/** Populated for trainers only. */
|
|
69
|
+
assignedMembers: z.array(assignedMemberRefSchema),
|
|
70
|
+
});
|
|
71
|
+
// ─── Payroll ─────────────────────────────────────────────────────────────────
|
|
72
|
+
export const staffPaymentStatusSchema = z.enum(['success', 'failed', 'pending']);
|
|
73
|
+
/** A salary / payout entry against a staff member. */
|
|
74
|
+
export const staffPaymentSchema = z.object({
|
|
75
|
+
id: objectIdSchema,
|
|
76
|
+
staffUserId: objectIdSchema,
|
|
77
|
+
amountInr: priceInrSchema,
|
|
78
|
+
status: staffPaymentStatusSchema,
|
|
79
|
+
paidAt: isoDateTimeSchema,
|
|
80
|
+
note: z.string().nullable(),
|
|
81
|
+
});
|
|
82
|
+
export const recordStaffPaymentBodySchema = z.object({
|
|
83
|
+
amountInr: priceInrSchema,
|
|
84
|
+
status: staffPaymentStatusSchema.default('success'),
|
|
85
|
+
note: optionalTrimmedString(240),
|
|
86
|
+
});
|
|
87
|
+
// ─── Add staff (provisioning) ────────────────────────────────────────────────
|
|
88
|
+
export const createStaffBodySchema = z.object({
|
|
89
|
+
firstName: z.string().trim().min(1, 'First name is required').max(80),
|
|
90
|
+
lastName: optionalTrimmedString(80),
|
|
91
|
+
email: z.email('A valid email is required'),
|
|
92
|
+
phone: phoneSchema,
|
|
93
|
+
role: staffRoleSchema,
|
|
94
|
+
gender: genderSchema,
|
|
95
|
+
dob: isoDateSchema.optional(),
|
|
96
|
+
bloodGroup: bloodGroupSchema.optional(),
|
|
97
|
+
address: addressSchema.optional(),
|
|
98
|
+
emergencyContacts: z.array(emergencyContactSchema).max(5).default([]),
|
|
99
|
+
idProofUrl: optionalTrimmedString(2000),
|
|
100
|
+
avatarUrl: optionalTrimmedString(2000),
|
|
101
|
+
});
|
|
102
|
+
/**
|
|
103
|
+
* Adding staff creates a gym record + an invite, exactly like members — the gym
|
|
104
|
+
* never mints central-auth credentials. The gym ROLE (trainer / manager / …) is
|
|
105
|
+
* product data enforced by gymmonk-backend, never a platform-wide auth role.
|
|
106
|
+
*/
|
|
107
|
+
export const staffProvisionResultSchema = z.object({
|
|
108
|
+
staffId: objectIdSchema,
|
|
109
|
+
code: z.string(),
|
|
110
|
+
invite: memberInviteSchema,
|
|
111
|
+
});
|
|
112
|
+
// ─── Mutations ───────────────────────────────────────────────────────────────
|
|
113
|
+
export const setStaffDutyBodySchema = z.object({ onDuty: z.boolean() });
|
|
114
|
+
export const setStaffStatusBodySchema = z.object({ active: z.boolean() });
|
|
115
|
+
//# sourceMappingURL=staff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staff.js","sourceRoot":"","sources":["../src/staff.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,a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U,EAAE,gBAAgB,CAAC,QAAQ,EAAE;IACvC,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;IACjC,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACrE,UAAU,EAAE,qBAAqB,CAAC,IAAI,CAAC;IACvC,SAAS,EAAE,qBAAqB,CAAC,IAAI,CAAC;CACvC,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,OAAO,EAAE,cAAc;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,kBAAkB;CAC3B,CAAC,CAAC;AAGH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAGxE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Staff (trainers, managers, support)\n * ====================================================\n * A center's employees. Like members, adding a staff member provisions a real\n * central-auth account (returns login email + temp password). Trainers can have\n * members assigned to them.\n *\n * @module gymmonk-schema/staff\n */\n\nimport { z } from 'zod';\nimport {\n isoDateSchema,\n isoDateTimeSchema,\n objectIdSchema,\n optionalTrimmedString,\n phoneSchema,\n priceInrSchema,\n} from './common.js';\nimport { memberInviteSchema } from './member.js';\nimport { emergencyContactSchema } from './member-profile.js';\nimport { addressSchema, bloodGroupSchema, genderSchema } from './shared.js';\n\n// ─── Role & status ───────────────────────────────────────────────────────────\n\nexport const staffRoleSchema = z.enum(['trainer', 'manager', 'cleaning', 'reception']);\nexport type StaffRole = z.infer<typeof staffRoleSchema>;\n\nexport const staffStatusSchema = z.enum(['active', 'inactive']);\nexport type StaffStatus = z.infer<typeof staffStatusSchema>;\n\n// ─── List projection ─────────────────────────────────────────────────────────\n\nexport const staffListItemSchema = z.object({\n /** The staff record id — always present, and what every `/staff/:id` route keys on. */\n id: objectIdSchema,\n /** Null until the staff member claims their invite (same model as members). */\n userId: objectIdSchema.nullable(),\n staffCode: z.string(),\n name: z.string(),\n role: staffRoleSchema,\n avatarUrl: z.string().nullable(),\n verified: z.boolean(),\n status: staffStatusSchema,\n onDuty: z.boolean(),\n});\nexport type StaffListItem = z.infer<typeof staffListItemSchema>;\n\nexport const staffListSummarySchema = z.object({\n total: z.number().int().nonnegative(),\n active: z.number().int().nonnegative(),\n onDuty: z.number().int().nonnegative(),\n});\nexport type StaffListSummary = z.infer<typeof staffListSummarySchema>;\n\n// ─── Detail projection ───────────────────────────────────────────────────────\n\n/** A member assigned to a trainer, shown on the trainer detail. */\nexport const assignedMemberRefSchema = z.object({\n /** The member RECORD id — what `/members/:id` keys on, so the row can link. */\n memberProfileId: objectIdSchema,\n userId: objectIdSchema.nullable(),\n name: z.string(),\n avatarUrl: z.string().nullable(),\n note: optionalTrimmedString(160),\n});\nexport type AssignedMemberRef = z.infer<typeof assignedMemberRefSchema>;\n\nexport const staffDetailSchema = z.object({\n id: objectIdSchema,\n userId: objectIdSchema.nullable(),\n staffCode: z.string(),\n name: z.string(),\n email: z.string(),\n phone: z.string().nullable(),\n avatarUrl: z.string().nullable(),\n role: staffRoleSchema,\n status: staffStatusSchema,\n onDuty: z.boolean(),\n verified: z.boolean(),\n gender: genderSchema.nullable(),\n dob: isoDateSchema.nullable(),\n bloodGroup: bloodGroupSchema.nullable(),\n address: addressSchema.nullable(),\n emergencyContacts: z.array(emergencyContactSchema),\n joinedAt: isoDateTimeSchema,\n /** Whether the latest salary/dues are settled. */\n balancePaid: z.boolean(),\n nextPaymentDate: isoDateSchema.nullable(),\n /** Populated for trainers only. */\n assignedMembers: z.array(assignedMemberRefSchema),\n});\nexport type StaffDetail = z.infer<typeof staffDetailSchema>;\n\n// ─── Payroll ─────────────────────────────────────────────────────────────────\n\nexport const staffPaymentStatusSchema = z.enum(['success', 'failed', 'pending']);\nexport type StaffPaymentStatus = z.infer<typeof staffPaymentStatusSchema>;\n\n/** A salary / payout entry against a staff member. */\nexport const staffPaymentSchema = z.object({\n id: objectIdSchema,\n staffUserId: objectIdSchema,\n amountInr: priceInrSchema,\n status: staffPaymentStatusSchema,\n paidAt: isoDateTimeSchema,\n note: z.string().nullable(),\n});\nexport type StaffPayment = z.infer<typeof staffPaymentSchema>;\n\nexport const recordStaffPaymentBodySchema = z.object({\n amountInr: priceInrSchema,\n status: staffPaymentStatusSchema.default('success'),\n note: optionalTrimmedString(240),\n});\nexport type RecordStaffPaymentBody = z.infer<typeof recordStaffPaymentBodySchema>;\n\n// ─── Add staff (provisioning) ────────────────────────────────────────────────\n\nexport const createStaffBodySchema = z.object({\n firstName: z.string().trim().min(1, 'First name is required').max(80),\n lastName: optionalTrimmedString(80),\n email: z.email('A valid email is required'),\n phone: phoneSchema,\n role: staffRoleSchema,\n gender: genderSchema,\n dob: isoDateSchema.optional(),\n bloodGroup: bloodGroupSchema.optional(),\n address: addressSchema.optional(),\n emergencyContacts: z.array(emergencyContactSchema).max(5).default([]),\n idProofUrl: optionalTrimmedString(2000),\n avatarUrl: optionalTrimmedString(2000),\n});\nexport type CreateStaffBody = z.infer<typeof createStaffBodySchema>;\n\n/**\n * Adding staff creates a gym record + an invite, exactly like members — the gym\n * never mints central-auth credentials. The gym ROLE (trainer / manager / …) is\n * product data enforced by gymmonk-backend, never a platform-wide auth role.\n */\nexport const staffProvisionResultSchema = z.object({\n staffId: objectIdSchema,\n code: z.string(),\n invite: memberInviteSchema,\n});\nexport type StaffProvisionResult = z.infer<typeof staffProvisionResultSchema>;\n\n// ─── Mutations ───────────────────────────────────────────────────────────────\n\nexport const setStaffDutyBodySchema = z.object({ onDuty: z.boolean() });\nexport type SetStaffDutyBody = z.infer<typeof setStaffDutyBodySchema>;\n\nexport const setStaffStatusBodySchema = z.object({ active: z.boolean() });\nexport type SetStaffStatusBody = z.infer<typeof setStaffStatusBodySchema>;\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Owner SaaS subscription
|
|
3
|
+
* ========================================
|
|
4
|
+
* The GymMonk plan an owner buys to run their gym on the platform (distinct from
|
|
5
|
+
* the membership plans they sell to members). The catalog reuses the generic
|
|
6
|
+
* pricing primitives; a subscription tracks the owner's current plan + period.
|
|
7
|
+
*
|
|
8
|
+
* @module gymmonk-schema/subscription
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
/**
|
|
12
|
+
* SaaS tier ids. Superset of both frontend surfaces (onboarding owner-plans uses
|
|
13
|
+
* `growth`; the manage-subscription screen uses `elite`) — the live catalog is
|
|
14
|
+
* data-driven via `GenericPricingPlan`, this enum just bounds the stored id.
|
|
15
|
+
*/
|
|
16
|
+
export declare const saasPlanIdSchema: z.ZodEnum<{
|
|
17
|
+
free: "free";
|
|
18
|
+
starter: "starter";
|
|
19
|
+
growth: "growth";
|
|
20
|
+
pro: "pro";
|
|
21
|
+
elite: "elite";
|
|
22
|
+
}>;
|
|
23
|
+
export type SaasPlanId = z.infer<typeof saasPlanIdSchema>;
|
|
24
|
+
export declare const ownerSubscriptionStatusSchema: z.ZodEnum<{
|
|
25
|
+
active: "active";
|
|
26
|
+
expired: "expired";
|
|
27
|
+
cancelled: "cancelled";
|
|
28
|
+
trialing: "trialing";
|
|
29
|
+
past_due: "past_due";
|
|
30
|
+
}>;
|
|
31
|
+
export type OwnerSubscriptionStatus = z.infer<typeof ownerSubscriptionStatusSchema>;
|
|
32
|
+
export declare const ownerSubscriptionSchema: z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
ownerId: z.ZodString;
|
|
35
|
+
organisationId: z.ZodString;
|
|
36
|
+
planId: z.ZodEnum<{
|
|
37
|
+
free: "free";
|
|
38
|
+
starter: "starter";
|
|
39
|
+
growth: "growth";
|
|
40
|
+
pro: "pro";
|
|
41
|
+
elite: "elite";
|
|
42
|
+
}>;
|
|
43
|
+
tenureId: z.ZodString;
|
|
44
|
+
status: z.ZodEnum<{
|
|
45
|
+
active: "active";
|
|
46
|
+
expired: "expired";
|
|
47
|
+
cancelled: "cancelled";
|
|
48
|
+
trialing: "trialing";
|
|
49
|
+
past_due: "past_due";
|
|
50
|
+
}>;
|
|
51
|
+
currentPeriodEnd: z.ZodNullable<z.ZodString>;
|
|
52
|
+
razorpaySubscriptionId: z.ZodNullable<z.ZodString>;
|
|
53
|
+
createdAt: z.ZodISODateTime;
|
|
54
|
+
updatedAt: z.ZodISODateTime;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type OwnerSubscription = z.infer<typeof ownerSubscriptionSchema>;
|
|
57
|
+
export declare const subscribeBodySchema: z.ZodObject<{
|
|
58
|
+
planId: z.ZodEnum<{
|
|
59
|
+
free: "free";
|
|
60
|
+
starter: "starter";
|
|
61
|
+
growth: "growth";
|
|
62
|
+
pro: "pro";
|
|
63
|
+
elite: "elite";
|
|
64
|
+
}>;
|
|
65
|
+
tenureId: z.ZodNullable<z.ZodString>;
|
|
66
|
+
paymentReference: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
export type SubscribeBody = z.infer<typeof subscribeBodySchema>;
|
|
69
|
+
//# sourceMappingURL=subscription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../src/subscription.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;EAAwD,CAAC;AACtF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,6BAA6B;;;;;;EAMxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAIpF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;iBAWlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAIxE,eAAO,MAAM,mBAAmB;;;;;;;;;;iBAM9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gymmonk-schema — Owner SaaS subscription
|
|
3
|
+
* ========================================
|
|
4
|
+
* The GymMonk plan an owner buys to run their gym on the platform (distinct from
|
|
5
|
+
* the membership plans they sell to members). The catalog reuses the generic
|
|
6
|
+
* pricing primitives; a subscription tracks the owner's current plan + period.
|
|
7
|
+
*
|
|
8
|
+
* @module gymmonk-schema/subscription
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { isoDateSchema, isoDateTimeSchema, objectIdSchema, optionalTrimmedString, } from './common.js';
|
|
12
|
+
// ─── Plan ids & status ───────────────────────────────────────────────────────
|
|
13
|
+
/**
|
|
14
|
+
* SaaS tier ids. Superset of both frontend surfaces (onboarding owner-plans uses
|
|
15
|
+
* `growth`; the manage-subscription screen uses `elite`) — the live catalog is
|
|
16
|
+
* data-driven via `GenericPricingPlan`, this enum just bounds the stored id.
|
|
17
|
+
*/
|
|
18
|
+
export const saasPlanIdSchema = z.enum(['free', 'starter', 'growth', 'pro', 'elite']);
|
|
19
|
+
export const ownerSubscriptionStatusSchema = z.enum([
|
|
20
|
+
'active',
|
|
21
|
+
'trialing',
|
|
22
|
+
'past_due',
|
|
23
|
+
'cancelled',
|
|
24
|
+
'expired',
|
|
25
|
+
]);
|
|
26
|
+
// ─── Entity ──────────────────────────────────────────────────────────────────
|
|
27
|
+
export const ownerSubscriptionSchema = z.object({
|
|
28
|
+
id: objectIdSchema,
|
|
29
|
+
ownerId: objectIdSchema,
|
|
30
|
+
organisationId: objectIdSchema,
|
|
31
|
+
planId: saasPlanIdSchema,
|
|
32
|
+
tenureId: z.string(),
|
|
33
|
+
status: ownerSubscriptionStatusSchema,
|
|
34
|
+
currentPeriodEnd: isoDateSchema.nullable(),
|
|
35
|
+
razorpaySubscriptionId: z.string().nullable(),
|
|
36
|
+
createdAt: isoDateTimeSchema,
|
|
37
|
+
updatedAt: isoDateTimeSchema,
|
|
38
|
+
});
|
|
39
|
+
// ─── Subscribe / change body ─────────────────────────────────────────────────
|
|
40
|
+
export const subscribeBodySchema = z.object({
|
|
41
|
+
planId: saasPlanIdSchema,
|
|
42
|
+
/** Free plan carries no tenure. */
|
|
43
|
+
tenureId: z.string().trim().min(1).nullable(),
|
|
44
|
+
/** Razorpay payment reference for paid plans (verified server-side). */
|
|
45
|
+
paymentReference: optionalTrimmedString(200),
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../src/subscription.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAGtF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,IAAI,CAAC;IAClD,QAAQ;IACR,UAAU;IACV,UAAU;IACV,WAAW;IACX,SAAS;CACV,CAAC,CAAC;AAGH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,EAAE,EAAE,cAAc;IAClB,OAAO,EAAE,cAAc;IACvB,cAAc,EAAE,cAAc;IAC9B,MAAM,EAAE,gBAAgB;IACxB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,MAAM,EAAE,6BAA6B;IACrC,gBAAgB,EAAE,aAAa,CAAC,QAAQ,EAAE;IAC1C,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7C,SAAS,EAAE,iBAAiB;IAC5B,SAAS,EAAE,iBAAiB;CAC7B,CAAC,CAAC;AAGH,gFAAgF;AAEhF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,gBAAgB;IACxB,mCAAmC;IACnC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC7C,wEAAwE;IACxE,gBAAgB,EAAE,qBAAqB,CAAC,GAAG,CAAC;CAC7C,CAAC,CAAC","sourcesContent":["/**\n * gymmonk-schema — Owner SaaS subscription\n * ========================================\n * The GymMonk plan an owner buys to run their gym on the platform (distinct from\n * the membership plans they sell to members). The catalog reuses the generic\n * pricing primitives; a subscription tracks the owner's current plan + period.\n *\n * @module gymmonk-schema/subscription\n */\n\nimport { z } from 'zod';\nimport {\n isoDateSchema,\n isoDateTimeSchema,\n objectIdSchema,\n optionalTrimmedString,\n} from './common.js';\n\n// ─── Plan ids & status ───────────────────────────────────────────────────────\n\n/**\n * SaaS tier ids. Superset of both frontend surfaces (onboarding owner-plans uses\n * `growth`; the manage-subscription screen uses `elite`) — the live catalog is\n * data-driven via `GenericPricingPlan`, this enum just bounds the stored id.\n */\nexport const saasPlanIdSchema = z.enum(['free', 'starter', 'growth', 'pro', 'elite']);\nexport type SaasPlanId = z.infer<typeof saasPlanIdSchema>;\n\nexport const ownerSubscriptionStatusSchema = z.enum([\n 'active',\n 'trialing',\n 'past_due',\n 'cancelled',\n 'expired',\n]);\nexport type OwnerSubscriptionStatus = z.infer<typeof ownerSubscriptionStatusSchema>;\n\n// ─── Entity ──────────────────────────────────────────────────────────────────\n\nexport const ownerSubscriptionSchema = z.object({\n id: objectIdSchema,\n ownerId: objectIdSchema,\n organisationId: objectIdSchema,\n planId: saasPlanIdSchema,\n tenureId: z.string(),\n status: ownerSubscriptionStatusSchema,\n currentPeriodEnd: isoDateSchema.nullable(),\n razorpaySubscriptionId: z.string().nullable(),\n createdAt: isoDateTimeSchema,\n updatedAt: isoDateTimeSchema,\n});\nexport type OwnerSubscription = z.infer<typeof ownerSubscriptionSchema>;\n\n// ─── Subscribe / change body ─────────────────────────────────────────────────\n\nexport const subscribeBodySchema = z.object({\n planId: saasPlanIdSchema,\n /** Free plan carries no tenure. */\n tenureId: z.string().trim().min(1).nullable(),\n /** Razorpay payment reference for paid plans (verified server-side). */\n paymentReference: optionalTrimmedString(200),\n});\nexport type SubscribeBody = z.infer<typeof subscribeBodySchema>;\n"]}
|
package/dist/user.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
/** Platform-wide roles (empty for most users). Distinct from gym owner/member. */
|
|
13
|
+
export declare const appRoleSchema: z.ZodEnum<{
|
|
14
|
+
manager: "manager";
|
|
15
|
+
support_agent: "support_agent";
|
|
16
|
+
moderator: "moderator";
|
|
17
|
+
superadmin: "superadmin";
|
|
18
|
+
}>;
|
|
19
|
+
export type AppRole = z.infer<typeof appRoleSchema>;
|
|
20
|
+
export declare const userStatusSchema: z.ZodEnum<{
|
|
21
|
+
active: "active";
|
|
22
|
+
inactive: "inactive";
|
|
23
|
+
suspended: "suspended";
|
|
24
|
+
deleted: "deleted";
|
|
25
|
+
}>;
|
|
26
|
+
export type UserStatus = z.infer<typeof userStatusSchema>;
|
|
27
|
+
export declare const meSchema: z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
email: z.ZodString;
|
|
30
|
+
firstName: z.ZodString;
|
|
31
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
32
|
+
displayName: z.ZodNullable<z.ZodString>;
|
|
33
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
34
|
+
avatar: z.ZodNullable<z.ZodString>;
|
|
35
|
+
appRoles: z.ZodArray<z.ZodEnum<{
|
|
36
|
+
manager: "manager";
|
|
37
|
+
support_agent: "support_agent";
|
|
38
|
+
moderator: "moderator";
|
|
39
|
+
superadmin: "superadmin";
|
|
40
|
+
}>>;
|
|
41
|
+
status: z.ZodEnum<{
|
|
42
|
+
active: "active";
|
|
43
|
+
inactive: "inactive";
|
|
44
|
+
suspended: "suspended";
|
|
45
|
+
deleted: "deleted";
|
|
46
|
+
}>;
|
|
47
|
+
createdAt: z.ZodISODateTime;
|
|
48
|
+
updatedAt: z.ZodISODateTime;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type Me = z.infer<typeof meSchema>;
|
|
51
|
+
/**
|
|
52
|
+
* Patch the product-owned identity fields (name/displayName/phone/avatar).
|
|
53
|
+
* `email` is auth-owned and never updated here.
|
|
54
|
+
*/
|
|
55
|
+
export declare const updateUserBodySchema: z.ZodObject<{
|
|
56
|
+
firstName: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
57
|
+
lastName: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
58
|
+
displayName: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
59
|
+
phone: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
60
|
+
avatar: z.ZodPreprocess<z.ZodOptional<z.ZodString>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
export type UpdateUserBody = z.infer<typeof updateUserBodySchema>;
|
|
63
|
+
//# sourceMappingURL=user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../src/user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,kFAAkF;AAClF,eAAO,MAAM,aAAa;;;;;EAAkE,CAAC;AAC7F,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,gBAAgB;;;;;EAAyD,CAAC;AACvF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;iBAanB,CAAC;AACH,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAI1C;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;iBAS/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|