@tbs-fitness/contract 0.4.0 → 0.6.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/README.md +25 -0
- package/dist/cjs/auth/auth.dto.d.ts +4 -4
- package/dist/cjs/auth/index.d.ts +1 -0
- package/dist/cjs/auth/index.js +1 -0
- package/dist/cjs/auth/otp.dto.d.ts +45 -0
- package/dist/cjs/auth/otp.dto.js +39 -0
- package/dist/cjs/client/client-auth.dto.d.ts +81 -0
- package/dist/cjs/client/client-auth.dto.js +49 -0
- package/dist/cjs/client/index.d.ts +2 -0
- package/dist/cjs/client/index.js +18 -0
- package/dist/cjs/coach/coach-auth.dto.d.ts +0 -40
- package/dist/cjs/coach/coach-auth.dto.js +1 -30
- package/dist/cjs/coach/index.d.ts +1 -0
- package/dist/cjs/coach/index.js +1 -0
- package/dist/cjs/enums/index.d.ts +40 -2
- package/dist/cjs/enums/index.js +58 -3
- package/dist/cjs/feature-flags/feature-flag.dto.d.ts +4 -4
- package/dist/cjs/feature-flags/feature-flag.dto.js +1 -1
- package/dist/cjs/food/client-food.dto.d.ts +49 -0
- package/dist/cjs/food/client-food.dto.js +26 -0
- package/dist/cjs/food/food-import.dto.d.ts +160 -0
- package/dist/cjs/food/food-import.dto.js +110 -0
- package/dist/cjs/food/food-suggestion.dto.d.ts +374 -0
- package/dist/cjs/food/food-suggestion.dto.js +170 -0
- package/dist/cjs/food/food.dto.d.ts +339 -0
- package/dist/cjs/food/food.dto.js +256 -0
- package/dist/cjs/food/index.d.ts +5 -0
- package/dist/cjs/food/index.js +21 -0
- package/dist/cjs/food/nutrition.d.ts +75 -0
- package/dist/cjs/food/nutrition.js +158 -0
- package/dist/esm/auth/auth.dto.d.ts +4 -4
- package/dist/esm/auth/index.d.ts +1 -0
- package/dist/esm/auth/index.js +1 -0
- package/dist/esm/auth/otp.dto.d.ts +45 -0
- package/dist/esm/auth/otp.dto.js +36 -0
- package/dist/esm/client/client-auth.dto.d.ts +81 -0
- package/dist/esm/client/client-auth.dto.js +46 -0
- package/dist/esm/client/index.d.ts +2 -0
- package/dist/esm/client/index.js +2 -0
- package/dist/esm/coach/coach-auth.dto.d.ts +0 -40
- package/dist/esm/coach/coach-auth.dto.js +1 -30
- package/dist/esm/coach/index.d.ts +1 -0
- package/dist/esm/coach/index.js +1 -0
- package/dist/esm/enums/index.d.ts +40 -2
- package/dist/esm/enums/index.js +57 -2
- package/dist/esm/feature-flags/feature-flag.dto.d.ts +4 -4
- package/dist/esm/feature-flags/feature-flag.dto.js +1 -1
- package/dist/esm/food/client-food.dto.d.ts +49 -0
- package/dist/esm/food/client-food.dto.js +23 -0
- package/dist/esm/food/food-import.dto.d.ts +160 -0
- package/dist/esm/food/food-import.dto.js +107 -0
- package/dist/esm/food/food-suggestion.dto.d.ts +374 -0
- package/dist/esm/food/food-suggestion.dto.js +167 -0
- package/dist/esm/food/food.dto.d.ts +339 -0
- package/dist/esm/food/food.dto.js +253 -0
- package/dist/esm/food/index.d.ts +5 -0
- package/dist/esm/food/index.js +5 -0
- package/dist/esm/food/nutrition.d.ts +75 -0
- package/dist/esm/food/nutrition.js +144 -0
- package/package.json +21 -1
package/README.md
CHANGED
|
@@ -11,9 +11,11 @@ It is published as `@tbs-fitness/contract`. The package holds definitions only:
|
|
|
11
11
|
| `@tbs-fitness/contract/enums` | `ROLES`, `ACCOUNT_STATUSES`, `TOKEN_TRANSPORTS`, `AUDIT_OUTCOMES`, `APP_ENVIRONMENTS`, `FEATURE_FLAG_RULE_TYPES` and their types |
|
|
12
12
|
| `@tbs-fitness/contract/common` | Pagination, response envelopes (`{ data }`, `{ data, meta }`, `{ error }`), `emailSchema`, `phoneSchema`, `safeTextSchema` |
|
|
13
13
|
| `@tbs-fitness/contract/auth` | Login, sessions, password changes and resets, account administration |
|
|
14
|
+
| `@tbs-fitness/contract/client` | Client sign-up, one-time code verification and resend, client sign-in and profile, password recovery |
|
|
14
15
|
| `@tbs-fitness/contract/coach` | Coach sign-up, one-time code verification and resend, coach sign-in and profile, password recovery |
|
|
15
16
|
| `@tbs-fitness/contract/audit` | The audit log query and response |
|
|
16
17
|
| `@tbs-fitness/contract/feature-flags` | Feature flag requests and responses |
|
|
18
|
+
| `@tbs-fitness/contract/food` | Food library, metadata, CSV/XLSX import, client food suggestions and their review, and the shared nutrition helpers |
|
|
17
19
|
|
|
18
20
|
Each domain has its own entry point, so names only need to be unique within a domain. `auditLogResponseSchema`, for example, exists in both `/audit` and `/feature-flags`.
|
|
19
21
|
|
|
@@ -41,6 +43,29 @@ const result = createFlagSchema.safeParse(input); // The same rules as the API.
|
|
|
41
43
|
|
|
42
44
|
Requests have two types. Clients use `*Input`, where fields with a default are optional. The backend uses `*Body`, which is the result after validation. List queries come from the URL as strings, so they have no `*Input`: use `Partial<PaginationQuery>` or `Partial<AuditLogQuery>`.
|
|
43
45
|
|
|
46
|
+
## Version 0.6.0
|
|
47
|
+
|
|
48
|
+
The food library. Additive; consumers install `^0.6.0` explicitly.
|
|
49
|
+
|
|
50
|
+
- `/enums`: `FOOD_SOURCES`, `SERVING_UNITS` (`g`, `ml`), `PORTION_UNITS`, `NUTRITION_BASES`, `FOOD_SUGGESTION_STATUSES`, `FOOD_SUGGESTION_RESOLUTIONS`, `FOOD_IMPORT_MODES`, `FOOD_IMPORT_STATUSES`, `FOOD_IMPORT_ROW_STATUSES`, `FOOD_IMPORT_FILE_TYPES`, `FOOD_IMPORT_ISSUE_SEVERITIES`, `FOOD_METADATA_SELECTIONS`, `FOOD_SORT_FIELDS` and `SORT_ORDERS`.
|
|
51
|
+
- New `/food`:
|
|
52
|
+
- Library: `createFoodSchema`, `updateFoodSchema` (with `version`), `foodListQuerySchema`, `foodResponseSchema` (values per 100 and per serving, plus `formulaCalories`), `similarFoodResponseSchema`, `foodStatsResponseSchema`.
|
|
53
|
+
- Metadata: `metadataTypeResponseSchema`, `metadataValueResponseSchema`, `createMetadataValueSchema`, `updateMetadataValueSchema`.
|
|
54
|
+
- Import: `foodImportRowSchema` (one spreadsheet row, shared by the API and the preview), `commitFoodImportSchema`, `foodImportBatchResponseSchema`, `foodImportRowResponseSchema`, `FOOD_IMPORT_LIMITS`.
|
|
55
|
+
- Suggestions: `submitFoodSuggestionSchema`, `suggestionPhotoUploadSchema`, `presignedUploadResponseSchema`, `approveFoodSuggestionSchema` (one shape per resolution), `rejectFoodSuggestionSchema`, `foodSuggestionResponseSchema` (coach view), `clientFoodSuggestionResponseSchema` (client view), `FOOD_SUGGESTION_LIMITS`.
|
|
56
|
+
- Client search: `clientFoodSearchQuerySchema`, `clientFoodResponseSchema`.
|
|
57
|
+
- Helpers: `toPer100`, `perServing`, `formulaCalories` (Biki's formula, (protein + carbs) × 4 + fat × 9), `nutritionIssues`, `normalizeFoodName`, `slugifyMetadataKey`, `parseServingLabel`, `roundNutrient`.
|
|
58
|
+
- Library nutrients are per 100 of the serving unit: per 100 g, or per 100 ml for a serving in ml. Values have at most 2 decimals.
|
|
59
|
+
|
|
60
|
+
## Version 0.5.0 (breaking)
|
|
61
|
+
|
|
62
|
+
- `ROLES` is now `ADMIN`, `COACH` and `CLIENT`: `CUSTOMER` is renamed to `CLIENT`. The backend migrates stored roles in step.
|
|
63
|
+
- `FEATURE_FLAG_RULE_TYPES` renames `customer` to `client`, and `createRuleSchema` accepts `ruleType: 'client'`.
|
|
64
|
+
- New `/client`: `clientSignupSchema` (`fullName`, `email`, `password`, optional detected `timezone`), `clientLoginSchema` (body transport by default, for the mobile app), `clientProfileSchema` and `clientLoginResponseSchema`.
|
|
65
|
+
- The one-time code and recovery schemas (`otpEmailSchema`, `verifyOtpSchema`, `resetPasswordSchema`, `otpDispatchResponseSchema`, `signupVerifiedResponseSchema`, `resetTokenResponseSchema`) now live in `/auth`. `/coach` and `/client` re-export them, so existing imports keep working.
|
|
66
|
+
|
|
67
|
+
Consumers install `^0.5.0` explicitly, and deploy the backend first.
|
|
68
|
+
|
|
44
69
|
## Version 0.4.0
|
|
45
70
|
|
|
46
71
|
Communication and runtime settings. Additive; consumers install `^0.4.0` explicitly.
|
|
@@ -45,7 +45,7 @@ export declare const setRoleSchema: z.ZodObject<{
|
|
|
45
45
|
role: z.ZodEnum<{
|
|
46
46
|
ADMIN: "ADMIN";
|
|
47
47
|
COACH: "COACH";
|
|
48
|
-
|
|
48
|
+
CLIENT: "CLIENT";
|
|
49
49
|
}>;
|
|
50
50
|
}, z.core.$strict>;
|
|
51
51
|
export type SetRoleInput = z.input<typeof setRoleSchema>;
|
|
@@ -100,7 +100,7 @@ export declare const accountResponseSchema: z.ZodObject<{
|
|
|
100
100
|
role: z.ZodEnum<{
|
|
101
101
|
ADMIN: "ADMIN";
|
|
102
102
|
COACH: "COACH";
|
|
103
|
-
|
|
103
|
+
CLIENT: "CLIENT";
|
|
104
104
|
}>;
|
|
105
105
|
roles: z.ZodArray<z.ZodString>;
|
|
106
106
|
permissions: z.ZodArray<z.ZodString>;
|
|
@@ -125,7 +125,7 @@ export declare const loginResponseSchema: z.ZodObject<{
|
|
|
125
125
|
role: z.ZodEnum<{
|
|
126
126
|
ADMIN: "ADMIN";
|
|
127
127
|
COACH: "COACH";
|
|
128
|
-
|
|
128
|
+
CLIENT: "CLIENT";
|
|
129
129
|
}>;
|
|
130
130
|
roles: z.ZodArray<z.ZodString>;
|
|
131
131
|
permissions: z.ZodArray<z.ZodString>;
|
|
@@ -162,7 +162,7 @@ export declare const adminAccountResponseSchema: z.ZodObject<{
|
|
|
162
162
|
role: z.ZodEnum<{
|
|
163
163
|
ADMIN: "ADMIN";
|
|
164
164
|
COACH: "COACH";
|
|
165
|
-
|
|
165
|
+
CLIENT: "CLIENT";
|
|
166
166
|
}>;
|
|
167
167
|
status: z.ZodEnum<{
|
|
168
168
|
pending_verification: "pending_verification";
|
package/dist/cjs/auth/index.d.ts
CHANGED
package/dist/cjs/auth/index.js
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* One-time code and password recovery shapes shared by every role's sign-up
|
|
4
|
+
* and recovery routes. `/coach` and `/client` re-export them.
|
|
5
|
+
*/
|
|
6
|
+
/** Used by both resend endpoints and by forgot-password. */
|
|
7
|
+
export declare const otpEmailSchema: z.ZodObject<{
|
|
8
|
+
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
9
|
+
}, z.core.$strict>;
|
|
10
|
+
export type OtpEmailInput = z.input<typeof otpEmailSchema>;
|
|
11
|
+
export type OtpEmailBody = z.output<typeof otpEmailSchema>;
|
|
12
|
+
export declare const verifyOtpSchema: z.ZodObject<{
|
|
13
|
+
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
14
|
+
code: z.ZodString;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
export type VerifyOtpInput = z.input<typeof verifyOtpSchema>;
|
|
17
|
+
export type VerifyOtpBody = z.output<typeof verifyOtpSchema>;
|
|
18
|
+
export declare const resetPasswordSchema: z.ZodObject<{
|
|
19
|
+
resetToken: z.ZodString;
|
|
20
|
+
newPassword: z.ZodString;
|
|
21
|
+
}, z.core.$strict>;
|
|
22
|
+
export type ResetPasswordInput = z.input<typeof resetPasswordSchema>;
|
|
23
|
+
export type ResetPasswordBody = z.output<typeof resetPasswordSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Says what the client needs to drive the code screen, and nothing about
|
|
26
|
+
* whether the email belongs to an account: the same values are returned either
|
|
27
|
+
* way.
|
|
28
|
+
*/
|
|
29
|
+
export declare const otpDispatchResponseSchema: z.ZodObject<{
|
|
30
|
+
message: z.ZodString;
|
|
31
|
+
otpLength: z.ZodNumber;
|
|
32
|
+
expiresInSeconds: z.ZodNumber;
|
|
33
|
+
resendAvailableInSeconds: z.ZodNumber;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type OtpDispatchResponse = z.output<typeof otpDispatchResponseSchema>;
|
|
36
|
+
export declare const signupVerifiedResponseSchema: z.ZodObject<{
|
|
37
|
+
message: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export type SignupVerifiedResponse = z.output<typeof signupVerifiedResponseSchema>;
|
|
40
|
+
/** Issued only after a recovery code is verified. It can reset a password once. */
|
|
41
|
+
export declare const resetTokenResponseSchema: z.ZodObject<{
|
|
42
|
+
resetToken: z.ZodString;
|
|
43
|
+
expiresInSeconds: z.ZodNumber;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export type ResetTokenResponse = z.output<typeof resetTokenResponseSchema>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resetTokenResponseSchema = exports.signupVerifiedResponseSchema = exports.otpDispatchResponseSchema = exports.resetPasswordSchema = exports.verifyOtpSchema = exports.otpEmailSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const contact_schema_js_1 = require("../common/contact.schema.js");
|
|
6
|
+
const auth_dto_js_1 = require("./auth.dto.js");
|
|
7
|
+
/**
|
|
8
|
+
* One-time code and password recovery shapes shared by every role's sign-up
|
|
9
|
+
* and recovery routes. `/coach` and `/client` re-export them.
|
|
10
|
+
*/
|
|
11
|
+
/** Used by both resend endpoints and by forgot-password. */
|
|
12
|
+
exports.otpEmailSchema = zod_1.z.strictObject({ email: contact_schema_js_1.emailSchema });
|
|
13
|
+
exports.verifyOtpSchema = zod_1.z.strictObject({
|
|
14
|
+
email: contact_schema_js_1.emailSchema,
|
|
15
|
+
code: auth_dto_js_1.otpCodeSchema,
|
|
16
|
+
});
|
|
17
|
+
exports.resetPasswordSchema = zod_1.z.strictObject({
|
|
18
|
+
resetToken: auth_dto_js_1.opaqueTokenSchema,
|
|
19
|
+
newPassword: auth_dto_js_1.newPasswordSchema,
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Says what the client needs to drive the code screen, and nothing about
|
|
23
|
+
* whether the email belongs to an account: the same values are returned either
|
|
24
|
+
* way.
|
|
25
|
+
*/
|
|
26
|
+
exports.otpDispatchResponseSchema = zod_1.z.object({
|
|
27
|
+
message: zod_1.z.string(),
|
|
28
|
+
otpLength: zod_1.z.number().int(),
|
|
29
|
+
expiresInSeconds: zod_1.z.number().int(),
|
|
30
|
+
resendAvailableInSeconds: zod_1.z.number().int(),
|
|
31
|
+
});
|
|
32
|
+
exports.signupVerifiedResponseSchema = zod_1.z.object({
|
|
33
|
+
message: zod_1.z.string(),
|
|
34
|
+
});
|
|
35
|
+
/** Issued only after a recovery code is verified. It can reset a password once. */
|
|
36
|
+
exports.resetTokenResponseSchema = zod_1.z.object({
|
|
37
|
+
resetToken: zod_1.z.string(),
|
|
38
|
+
expiresInSeconds: zod_1.z.number().int(),
|
|
39
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Client self sign-up: a name, an email address and a password. The account
|
|
4
|
+
* cannot sign in until the emailed code is verified.
|
|
5
|
+
*/
|
|
6
|
+
export declare const clientSignupSchema: z.ZodObject<{
|
|
7
|
+
fullName: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
8
|
+
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
9
|
+
password: z.ZodString;
|
|
10
|
+
timezone: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<string | undefined, unknown>>>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export type ClientSignupInput = z.input<typeof clientSignupSchema>;
|
|
13
|
+
export type ClientSignupBody = z.output<typeof clientSignupSchema>;
|
|
14
|
+
/**
|
|
15
|
+
* Clients sign in from the mobile app, so the refresh token comes back in the
|
|
16
|
+
* body by default. A browser sends `tokenTransport: "cookie"` instead, and
|
|
17
|
+
* `rememberMe: false` then makes the cookie end with the browser session.
|
|
18
|
+
*/
|
|
19
|
+
export declare const clientLoginSchema: z.ZodObject<{
|
|
20
|
+
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
21
|
+
password: z.ZodString;
|
|
22
|
+
deviceName: z.ZodOptional<z.ZodString>;
|
|
23
|
+
tokenTransport: z.ZodDefault<z.ZodEnum<{
|
|
24
|
+
body: "body";
|
|
25
|
+
cookie: "cookie";
|
|
26
|
+
}>>;
|
|
27
|
+
rememberMe: z.ZodDefault<z.ZodBoolean>;
|
|
28
|
+
timezone: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<string | undefined, unknown>>>;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
export type ClientLoginInput = z.input<typeof clientLoginSchema>;
|
|
31
|
+
export type ClientLoginBody = z.output<typeof clientLoginSchema>;
|
|
32
|
+
export declare const clientProfileSchema: z.ZodObject<{
|
|
33
|
+
id: z.ZodUUID;
|
|
34
|
+
email: z.ZodString;
|
|
35
|
+
fullName: z.ZodNullable<z.ZodString>;
|
|
36
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
37
|
+
role: z.ZodLiteral<"CLIENT">;
|
|
38
|
+
status: z.ZodEnum<{
|
|
39
|
+
pending_verification: "pending_verification";
|
|
40
|
+
active: "active";
|
|
41
|
+
disabled: "disabled";
|
|
42
|
+
}>;
|
|
43
|
+
emailVerifiedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
44
|
+
lastLoginAt: z.ZodNullable<z.ZodISODateTime>;
|
|
45
|
+
createdAt: z.ZodISODateTime;
|
|
46
|
+
timezone: z.ZodString;
|
|
47
|
+
timezoneSource: z.ZodEnum<{
|
|
48
|
+
AUTO: "AUTO";
|
|
49
|
+
MANUAL: "MANUAL";
|
|
50
|
+
}>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type ClientProfile = z.output<typeof clientProfileSchema>;
|
|
53
|
+
export declare const clientLoginResponseSchema: z.ZodObject<{
|
|
54
|
+
accessToken: z.ZodString;
|
|
55
|
+
tokenType: z.ZodLiteral<"Bearer">;
|
|
56
|
+
expiresInSeconds: z.ZodNumber;
|
|
57
|
+
refreshToken: z.ZodOptional<z.ZodString>;
|
|
58
|
+
csrfToken: z.ZodOptional<z.ZodString>;
|
|
59
|
+
sessionId: z.ZodUUID;
|
|
60
|
+
client: z.ZodObject<{
|
|
61
|
+
id: z.ZodUUID;
|
|
62
|
+
email: z.ZodString;
|
|
63
|
+
fullName: z.ZodNullable<z.ZodString>;
|
|
64
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
65
|
+
role: z.ZodLiteral<"CLIENT">;
|
|
66
|
+
status: z.ZodEnum<{
|
|
67
|
+
pending_verification: "pending_verification";
|
|
68
|
+
active: "active";
|
|
69
|
+
disabled: "disabled";
|
|
70
|
+
}>;
|
|
71
|
+
emailVerifiedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
72
|
+
lastLoginAt: z.ZodNullable<z.ZodISODateTime>;
|
|
73
|
+
createdAt: z.ZodISODateTime;
|
|
74
|
+
timezone: z.ZodString;
|
|
75
|
+
timezoneSource: z.ZodEnum<{
|
|
76
|
+
AUTO: "AUTO";
|
|
77
|
+
MANUAL: "MANUAL";
|
|
78
|
+
}>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
export type ClientLoginResponse = z.output<typeof clientLoginResponseSchema>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clientLoginResponseSchema = exports.clientProfileSchema = exports.clientLoginSchema = exports.clientSignupSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const auth_dto_js_1 = require("../auth/auth.dto.js");
|
|
6
|
+
const contact_schema_js_1 = require("../common/contact.schema.js");
|
|
7
|
+
const date_time_schema_js_1 = require("../common/date-time.schema.js");
|
|
8
|
+
const safe_text_schema_js_1 = require("../common/safe-text.schema.js");
|
|
9
|
+
const index_js_1 = require("../enums/index.js");
|
|
10
|
+
/**
|
|
11
|
+
* Client self sign-up: a name, an email address and a password. The account
|
|
12
|
+
* cannot sign in until the emailed code is verified.
|
|
13
|
+
*/
|
|
14
|
+
exports.clientSignupSchema = zod_1.z.strictObject({
|
|
15
|
+
fullName: (0, safe_text_schema_js_1.safeTextSchema)(100).pipe(zod_1.z.string().min(2, { error: 'Enter your full name' })),
|
|
16
|
+
email: contact_schema_js_1.emailSchema,
|
|
17
|
+
password: auth_dto_js_1.newPasswordSchema,
|
|
18
|
+
/** The device's time zone. Missing or unusable becomes UTC on the server. */
|
|
19
|
+
timezone: date_time_schema_js_1.detectedTimezoneSchema,
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* Clients sign in from the mobile app, so the refresh token comes back in the
|
|
23
|
+
* body by default. A browser sends `tokenTransport: "cookie"` instead, and
|
|
24
|
+
* `rememberMe: false` then makes the cookie end with the browser session.
|
|
25
|
+
*/
|
|
26
|
+
exports.clientLoginSchema = auth_dto_js_1.loginSchema.extend({
|
|
27
|
+
rememberMe: zod_1.z.boolean().default(true),
|
|
28
|
+
/**
|
|
29
|
+
* The device's time zone. It replaces the saved one only while the client's
|
|
30
|
+
* preference is `AUTO`; a manual choice is never overwritten.
|
|
31
|
+
*/
|
|
32
|
+
timezone: date_time_schema_js_1.detectedTimezoneSchema,
|
|
33
|
+
});
|
|
34
|
+
exports.clientProfileSchema = zod_1.z
|
|
35
|
+
.object({
|
|
36
|
+
id: zod_1.z.uuid(),
|
|
37
|
+
email: zod_1.z.string(),
|
|
38
|
+
fullName: zod_1.z.string().nullable(),
|
|
39
|
+
phone: zod_1.z.string().nullable(),
|
|
40
|
+
role: zod_1.z.literal('CLIENT'),
|
|
41
|
+
status: zod_1.z.enum(index_js_1.ACCOUNT_STATUSES),
|
|
42
|
+
emailVerifiedAt: date_time_schema_js_1.utcTimestampSchema.nullable(),
|
|
43
|
+
lastLoginAt: date_time_schema_js_1.utcTimestampSchema.nullable(),
|
|
44
|
+
createdAt: date_time_schema_js_1.utcTimestampSchema,
|
|
45
|
+
})
|
|
46
|
+
.extend(auth_dto_js_1.timezonePreferenceSchema.shape);
|
|
47
|
+
exports.clientLoginResponseSchema = auth_dto_js_1.tokenResponseSchema.extend({
|
|
48
|
+
client: exports.clientProfileSchema,
|
|
49
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../auth/otp.dto.js"), exports);
|
|
18
|
+
__exportStar(require("./client-auth.dto.js"), exports);
|
|
@@ -8,18 +8,6 @@ export declare const coachSignupSchema: z.ZodObject<{
|
|
|
8
8
|
}, z.core.$strict>;
|
|
9
9
|
export type CoachSignupInput = z.input<typeof coachSignupSchema>;
|
|
10
10
|
export type CoachSignupBody = z.output<typeof coachSignupSchema>;
|
|
11
|
-
/** Used by both resend endpoints and by forgot-password. */
|
|
12
|
-
export declare const otpEmailSchema: z.ZodObject<{
|
|
13
|
-
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
14
|
-
}, z.core.$strict>;
|
|
15
|
-
export type OtpEmailInput = z.input<typeof otpEmailSchema>;
|
|
16
|
-
export type OtpEmailBody = z.output<typeof otpEmailSchema>;
|
|
17
|
-
export declare const verifyOtpSchema: z.ZodObject<{
|
|
18
|
-
email: z.ZodPipe<z.ZodString, z.ZodEmail>;
|
|
19
|
-
code: z.ZodString;
|
|
20
|
-
}, z.core.$strict>;
|
|
21
|
-
export type VerifyOtpInput = z.input<typeof verifyOtpSchema>;
|
|
22
|
-
export type VerifyOtpBody = z.output<typeof verifyOtpSchema>;
|
|
23
11
|
/**
|
|
24
12
|
* Coaches sign in from the browser, so the refresh token always travels in an
|
|
25
13
|
* HttpOnly cookie. `rememberMe: false` makes that cookie end with the browser
|
|
@@ -34,34 +22,6 @@ export declare const coachLoginSchema: z.ZodObject<{
|
|
|
34
22
|
}, z.core.$strict>;
|
|
35
23
|
export type CoachLoginInput = z.input<typeof coachLoginSchema>;
|
|
36
24
|
export type CoachLoginBody = z.output<typeof coachLoginSchema>;
|
|
37
|
-
export declare const resetPasswordSchema: z.ZodObject<{
|
|
38
|
-
resetToken: z.ZodString;
|
|
39
|
-
newPassword: z.ZodString;
|
|
40
|
-
}, z.core.$strict>;
|
|
41
|
-
export type ResetPasswordInput = z.input<typeof resetPasswordSchema>;
|
|
42
|
-
export type ResetPasswordBody = z.output<typeof resetPasswordSchema>;
|
|
43
|
-
/**
|
|
44
|
-
* Says what the client needs to drive the code screen, and nothing about
|
|
45
|
-
* whether the email belongs to an account: the same values are returned either
|
|
46
|
-
* way.
|
|
47
|
-
*/
|
|
48
|
-
export declare const otpDispatchResponseSchema: z.ZodObject<{
|
|
49
|
-
message: z.ZodString;
|
|
50
|
-
otpLength: z.ZodNumber;
|
|
51
|
-
expiresInSeconds: z.ZodNumber;
|
|
52
|
-
resendAvailableInSeconds: z.ZodNumber;
|
|
53
|
-
}, z.core.$strip>;
|
|
54
|
-
export type OtpDispatchResponse = z.output<typeof otpDispatchResponseSchema>;
|
|
55
|
-
export declare const signupVerifiedResponseSchema: z.ZodObject<{
|
|
56
|
-
message: z.ZodString;
|
|
57
|
-
}, z.core.$strip>;
|
|
58
|
-
export type SignupVerifiedResponse = z.output<typeof signupVerifiedResponseSchema>;
|
|
59
|
-
/** Issued only after a recovery code is verified. It can reset a password once. */
|
|
60
|
-
export declare const resetTokenResponseSchema: z.ZodObject<{
|
|
61
|
-
resetToken: z.ZodString;
|
|
62
|
-
expiresInSeconds: z.ZodNumber;
|
|
63
|
-
}, z.core.$strip>;
|
|
64
|
-
export type ResetTokenResponse = z.output<typeof resetTokenResponseSchema>;
|
|
65
25
|
export declare const coachProfileSchema: z.ZodObject<{
|
|
66
26
|
id: z.ZodUUID;
|
|
67
27
|
email: z.ZodString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.coachLoginResponseSchema = exports.coachProfileSchema = exports.
|
|
3
|
+
exports.coachLoginResponseSchema = exports.coachProfileSchema = exports.coachLoginSchema = exports.coachSignupSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const auth_dto_js_1 = require("../auth/auth.dto.js");
|
|
6
6
|
const contact_schema_js_1 = require("../common/contact.schema.js");
|
|
@@ -15,12 +15,6 @@ exports.coachSignupSchema = zod_1.z.strictObject({
|
|
|
15
15
|
/** The browser's time zone. Missing or unusable becomes UTC on the server. */
|
|
16
16
|
timezone: date_time_schema_js_1.detectedTimezoneSchema,
|
|
17
17
|
});
|
|
18
|
-
/** Used by both resend endpoints and by forgot-password. */
|
|
19
|
-
exports.otpEmailSchema = zod_1.z.strictObject({ email: contact_schema_js_1.emailSchema });
|
|
20
|
-
exports.verifyOtpSchema = zod_1.z.strictObject({
|
|
21
|
-
email: contact_schema_js_1.emailSchema,
|
|
22
|
-
code: auth_dto_js_1.otpCodeSchema,
|
|
23
|
-
});
|
|
24
18
|
/**
|
|
25
19
|
* Coaches sign in from the browser, so the refresh token always travels in an
|
|
26
20
|
* HttpOnly cookie. `rememberMe: false` makes that cookie end with the browser
|
|
@@ -36,29 +30,6 @@ exports.coachLoginSchema = auth_dto_js_1.loginSchema
|
|
|
36
30
|
*/
|
|
37
31
|
timezone: date_time_schema_js_1.detectedTimezoneSchema,
|
|
38
32
|
});
|
|
39
|
-
exports.resetPasswordSchema = zod_1.z.strictObject({
|
|
40
|
-
resetToken: auth_dto_js_1.opaqueTokenSchema,
|
|
41
|
-
newPassword: auth_dto_js_1.newPasswordSchema,
|
|
42
|
-
});
|
|
43
|
-
/**
|
|
44
|
-
* Says what the client needs to drive the code screen, and nothing about
|
|
45
|
-
* whether the email belongs to an account: the same values are returned either
|
|
46
|
-
* way.
|
|
47
|
-
*/
|
|
48
|
-
exports.otpDispatchResponseSchema = zod_1.z.object({
|
|
49
|
-
message: zod_1.z.string(),
|
|
50
|
-
otpLength: zod_1.z.number().int(),
|
|
51
|
-
expiresInSeconds: zod_1.z.number().int(),
|
|
52
|
-
resendAvailableInSeconds: zod_1.z.number().int(),
|
|
53
|
-
});
|
|
54
|
-
exports.signupVerifiedResponseSchema = zod_1.z.object({
|
|
55
|
-
message: zod_1.z.string(),
|
|
56
|
-
});
|
|
57
|
-
/** Issued only after a recovery code is verified. It can reset a password once. */
|
|
58
|
-
exports.resetTokenResponseSchema = zod_1.z.object({
|
|
59
|
-
resetToken: zod_1.z.string(),
|
|
60
|
-
expiresInSeconds: zod_1.z.number().int(),
|
|
61
|
-
});
|
|
62
33
|
exports.coachProfileSchema = zod_1.z
|
|
63
34
|
.object({
|
|
64
35
|
id: zod_1.z.uuid(),
|
package/dist/cjs/coach/index.js
CHANGED
|
@@ -14,4 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("../auth/otp.dto.js"), exports);
|
|
17
18
|
__exportStar(require("./coach-auth.dto.js"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const APP_ENVIRONMENTS: readonly ["development", "staging", "production"];
|
|
2
2
|
export type AppEnvironment = (typeof APP_ENVIRONMENTS)[number];
|
|
3
3
|
/** Each user has exactly one role. A new role is added here and nowhere else. */
|
|
4
|
-
export declare const ROLES: readonly ["ADMIN", "COACH", "
|
|
4
|
+
export declare const ROLES: readonly ["ADMIN", "COACH", "CLIENT"];
|
|
5
5
|
export type Role = (typeof ROLES)[number];
|
|
6
6
|
/**
|
|
7
7
|
* `pending_verification` is a self-registered user who has not yet proved they
|
|
@@ -23,7 +23,7 @@ export declare const TOKEN_TRANSPORTS: readonly ["body", "cookie"];
|
|
|
23
23
|
export type TokenTransport = (typeof TOKEN_TRANSPORTS)[number];
|
|
24
24
|
export declare const AUDIT_OUTCOMES: readonly ["success", "failure"];
|
|
25
25
|
export type AuditOutcome = (typeof AUDIT_OUTCOMES)[number];
|
|
26
|
-
export declare const FEATURE_FLAG_RULE_TYPES: readonly ["user", "
|
|
26
|
+
export declare const FEATURE_FLAG_RULE_TYPES: readonly ["user", "client", "trainer", "role"];
|
|
27
27
|
export type FeatureFlagRuleType = (typeof FEATURE_FLAG_RULE_TYPES)[number];
|
|
28
28
|
/**
|
|
29
29
|
* The ways a message can reach someone. WhatsApp and push are added here when
|
|
@@ -44,3 +44,41 @@ export type DeliveryStatus = (typeof DELIVERY_STATUSES)[number];
|
|
|
44
44
|
/** Only one version of a template per message type and channel is active. */
|
|
45
45
|
export declare const TEMPLATE_STATUSES: readonly ["draft", "active", "archived"];
|
|
46
46
|
export type TemplateStatus = (typeof TEMPLATE_STATUSES)[number];
|
|
47
|
+
/** Who put a food into the library. */
|
|
48
|
+
export declare const FOOD_SOURCES: readonly ["ADMIN", "COACH", "CLIENT_SUGGESTION", "IMPORT"];
|
|
49
|
+
export type FoodSource = (typeof FOOD_SOURCES)[number];
|
|
50
|
+
/**
|
|
51
|
+
* The unit a library serving is measured in. Nutrients are stored per 100 of
|
|
52
|
+
* this unit, so a food in `ml` holds values per 100 ml.
|
|
53
|
+
*/
|
|
54
|
+
export declare const SERVING_UNITS: readonly ["g", "ml"];
|
|
55
|
+
export type ServingUnit = (typeof SERVING_UNITS)[number];
|
|
56
|
+
/** The portion units a client can pick when logging a food. */
|
|
57
|
+
export declare const PORTION_UNITS: readonly ["BOWL", "GRAM", "PIECE", "CUP"];
|
|
58
|
+
export type PortionUnit = (typeof PORTION_UNITS)[number];
|
|
59
|
+
/** Whether submitted nutrient values are per 100 units or per serving. */
|
|
60
|
+
export declare const NUTRITION_BASES: readonly ["PER_100", "PER_SERVING"];
|
|
61
|
+
export type NutritionBasis = (typeof NUTRITION_BASES)[number];
|
|
62
|
+
export declare const FOOD_SUGGESTION_STATUSES: readonly ["pending", "approved", "rejected", "withdrawn"];
|
|
63
|
+
export type FoodSuggestionStatus = (typeof FOOD_SUGGESTION_STATUSES)[number];
|
|
64
|
+
/** How an approved suggestion was resolved. */
|
|
65
|
+
export declare const FOOD_SUGGESTION_RESOLUTIONS: readonly ["ADDED_TO_LIBRARY", "LINKED_TO_EXISTING", "APPROVED_WITHOUT_LIBRARY"];
|
|
66
|
+
export type FoodSuggestionResolution = (typeof FOOD_SUGGESTION_RESOLUTIONS)[number];
|
|
67
|
+
/** What a bulk import does with a row whose food is already in the library. */
|
|
68
|
+
export declare const FOOD_IMPORT_MODES: readonly ["SKIP_DUPLICATES", "UPDATE_EXISTING"];
|
|
69
|
+
export type FoodImportMode = (typeof FOOD_IMPORT_MODES)[number];
|
|
70
|
+
export declare const FOOD_IMPORT_STATUSES: readonly ["previewed", "completed", "expired"];
|
|
71
|
+
export type FoodImportStatus = (typeof FOOD_IMPORT_STATUSES)[number];
|
|
72
|
+
export declare const FOOD_IMPORT_ROW_STATUSES: readonly ["valid", "invalid", "duplicate_in_file", "duplicate_existing"];
|
|
73
|
+
export type FoodImportRowStatus = (typeof FOOD_IMPORT_ROW_STATUSES)[number];
|
|
74
|
+
export declare const FOOD_IMPORT_FILE_TYPES: readonly ["csv", "xlsx"];
|
|
75
|
+
export type FoodImportFileType = (typeof FOOD_IMPORT_FILE_TYPES)[number];
|
|
76
|
+
export declare const FOOD_IMPORT_ISSUE_SEVERITIES: readonly ["error", "warning"];
|
|
77
|
+
export type FoodImportIssueSeverity = (typeof FOOD_IMPORT_ISSUE_SEVERITIES)[number];
|
|
78
|
+
/** Whether a food takes one value of a metadata type or several. */
|
|
79
|
+
export declare const FOOD_METADATA_SELECTIONS: readonly ["single", "multiple"];
|
|
80
|
+
export type FoodMetadataSelection = (typeof FOOD_METADATA_SELECTIONS)[number];
|
|
81
|
+
export declare const FOOD_SORT_FIELDS: readonly ["name", "updatedAt", "calories", "protein"];
|
|
82
|
+
export type FoodSortField = (typeof FOOD_SORT_FIELDS)[number];
|
|
83
|
+
export declare const SORT_ORDERS: readonly ["asc", "desc"];
|
|
84
|
+
export type SortOrder = (typeof SORT_ORDERS)[number];
|
package/dist/cjs/enums/index.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// These values are stored in the database and sent over the API. Renaming or
|
|
3
3
|
// removing one is a breaking change, so it needs a major version.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.TEMPLATE_STATUSES = exports.DELIVERY_STATUSES = exports.MESSAGE_TYPES = exports.COMMUNICATION_CHANNELS = exports.FEATURE_FLAG_RULE_TYPES = exports.AUDIT_OUTCOMES = exports.TOKEN_TRANSPORTS = exports.TIMEZONE_SOURCES = exports.ADMIN_SETTABLE_ACCOUNT_STATUSES = exports.ACCOUNT_STATUSES = exports.ROLES = exports.APP_ENVIRONMENTS = void 0;
|
|
5
|
+
exports.SORT_ORDERS = exports.FOOD_SORT_FIELDS = exports.FOOD_METADATA_SELECTIONS = exports.FOOD_IMPORT_ISSUE_SEVERITIES = exports.FOOD_IMPORT_FILE_TYPES = exports.FOOD_IMPORT_ROW_STATUSES = exports.FOOD_IMPORT_STATUSES = exports.FOOD_IMPORT_MODES = exports.FOOD_SUGGESTION_RESOLUTIONS = exports.FOOD_SUGGESTION_STATUSES = exports.NUTRITION_BASES = exports.PORTION_UNITS = exports.SERVING_UNITS = exports.FOOD_SOURCES = exports.TEMPLATE_STATUSES = exports.DELIVERY_STATUSES = exports.MESSAGE_TYPES = exports.COMMUNICATION_CHANNELS = exports.FEATURE_FLAG_RULE_TYPES = exports.AUDIT_OUTCOMES = exports.TOKEN_TRANSPORTS = exports.TIMEZONE_SOURCES = exports.ADMIN_SETTABLE_ACCOUNT_STATUSES = exports.ACCOUNT_STATUSES = exports.ROLES = exports.APP_ENVIRONMENTS = void 0;
|
|
6
6
|
exports.APP_ENVIRONMENTS = [
|
|
7
7
|
'development',
|
|
8
8
|
'staging',
|
|
9
9
|
'production',
|
|
10
10
|
];
|
|
11
11
|
/** Each user has exactly one role. A new role is added here and nowhere else. */
|
|
12
|
-
exports.ROLES = ['ADMIN', 'COACH', '
|
|
12
|
+
exports.ROLES = ['ADMIN', 'COACH', 'CLIENT'];
|
|
13
13
|
/**
|
|
14
14
|
* `pending_verification` is a self-registered user who has not yet proved they
|
|
15
15
|
* own their email address. Such a user cannot sign in.
|
|
@@ -31,7 +31,7 @@ exports.TOKEN_TRANSPORTS = ['body', 'cookie'];
|
|
|
31
31
|
exports.AUDIT_OUTCOMES = ['success', 'failure'];
|
|
32
32
|
exports.FEATURE_FLAG_RULE_TYPES = [
|
|
33
33
|
'user',
|
|
34
|
-
'
|
|
34
|
+
'client',
|
|
35
35
|
'trainer',
|
|
36
36
|
'role',
|
|
37
37
|
];
|
|
@@ -60,3 +60,58 @@ exports.DELIVERY_STATUSES = [
|
|
|
60
60
|
];
|
|
61
61
|
/** Only one version of a template per message type and channel is active. */
|
|
62
62
|
exports.TEMPLATE_STATUSES = ['draft', 'active', 'archived'];
|
|
63
|
+
/** Who put a food into the library. */
|
|
64
|
+
exports.FOOD_SOURCES = [
|
|
65
|
+
'ADMIN',
|
|
66
|
+
'COACH',
|
|
67
|
+
'CLIENT_SUGGESTION',
|
|
68
|
+
'IMPORT',
|
|
69
|
+
];
|
|
70
|
+
/**
|
|
71
|
+
* The unit a library serving is measured in. Nutrients are stored per 100 of
|
|
72
|
+
* this unit, so a food in `ml` holds values per 100 ml.
|
|
73
|
+
*/
|
|
74
|
+
exports.SERVING_UNITS = ['g', 'ml'];
|
|
75
|
+
/** The portion units a client can pick when logging a food. */
|
|
76
|
+
exports.PORTION_UNITS = ['BOWL', 'GRAM', 'PIECE', 'CUP'];
|
|
77
|
+
/** Whether submitted nutrient values are per 100 units or per serving. */
|
|
78
|
+
exports.NUTRITION_BASES = ['PER_100', 'PER_SERVING'];
|
|
79
|
+
exports.FOOD_SUGGESTION_STATUSES = [
|
|
80
|
+
'pending',
|
|
81
|
+
'approved',
|
|
82
|
+
'rejected',
|
|
83
|
+
'withdrawn',
|
|
84
|
+
];
|
|
85
|
+
/** How an approved suggestion was resolved. */
|
|
86
|
+
exports.FOOD_SUGGESTION_RESOLUTIONS = [
|
|
87
|
+
'ADDED_TO_LIBRARY',
|
|
88
|
+
'LINKED_TO_EXISTING',
|
|
89
|
+
'APPROVED_WITHOUT_LIBRARY',
|
|
90
|
+
];
|
|
91
|
+
/** What a bulk import does with a row whose food is already in the library. */
|
|
92
|
+
exports.FOOD_IMPORT_MODES = [
|
|
93
|
+
'SKIP_DUPLICATES',
|
|
94
|
+
'UPDATE_EXISTING',
|
|
95
|
+
];
|
|
96
|
+
exports.FOOD_IMPORT_STATUSES = [
|
|
97
|
+
'previewed',
|
|
98
|
+
'completed',
|
|
99
|
+
'expired',
|
|
100
|
+
];
|
|
101
|
+
exports.FOOD_IMPORT_ROW_STATUSES = [
|
|
102
|
+
'valid',
|
|
103
|
+
'invalid',
|
|
104
|
+
'duplicate_in_file',
|
|
105
|
+
'duplicate_existing',
|
|
106
|
+
];
|
|
107
|
+
exports.FOOD_IMPORT_FILE_TYPES = ['csv', 'xlsx'];
|
|
108
|
+
exports.FOOD_IMPORT_ISSUE_SEVERITIES = ['error', 'warning'];
|
|
109
|
+
/** Whether a food takes one value of a metadata type or several. */
|
|
110
|
+
exports.FOOD_METADATA_SELECTIONS = ['single', 'multiple'];
|
|
111
|
+
exports.FOOD_SORT_FIELDS = [
|
|
112
|
+
'name',
|
|
113
|
+
'updatedAt',
|
|
114
|
+
'calories',
|
|
115
|
+
'protein',
|
|
116
|
+
];
|
|
117
|
+
exports.SORT_ORDERS = ['asc', 'desc'];
|
|
@@ -31,7 +31,7 @@ export declare const createRuleSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
31
31
|
ruleValue: z.ZodPipe<z.ZodString, z.ZodUUID>;
|
|
32
32
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
33
33
|
}, z.core.$strict>, z.ZodObject<{
|
|
34
|
-
ruleType: z.ZodLiteral<"
|
|
34
|
+
ruleType: z.ZodLiteral<"client">;
|
|
35
35
|
ruleValue: z.ZodPipe<z.ZodString, z.ZodUUID>;
|
|
36
36
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
37
37
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -43,7 +43,7 @@ export declare const createRuleSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
43
43
|
ruleValue: z.ZodEnum<{
|
|
44
44
|
ADMIN: "ADMIN";
|
|
45
45
|
COACH: "COACH";
|
|
46
|
-
|
|
46
|
+
CLIENT: "CLIENT";
|
|
47
47
|
}>;
|
|
48
48
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
49
49
|
}, z.core.$strict>], "ruleType">;
|
|
@@ -68,7 +68,7 @@ export declare const ruleResponseSchema: z.ZodObject<{
|
|
|
68
68
|
id: z.ZodUUID;
|
|
69
69
|
ruleType: z.ZodEnum<{
|
|
70
70
|
user: "user";
|
|
71
|
-
|
|
71
|
+
client: "client";
|
|
72
72
|
trainer: "trainer";
|
|
73
73
|
role: "role";
|
|
74
74
|
}>;
|
|
@@ -101,7 +101,7 @@ export declare const flagResponseSchema: z.ZodObject<{
|
|
|
101
101
|
id: z.ZodUUID;
|
|
102
102
|
ruleType: z.ZodEnum<{
|
|
103
103
|
user: "user";
|
|
104
|
-
|
|
104
|
+
client: "client";
|
|
105
105
|
trainer: "trainer";
|
|
106
106
|
role: "role";
|
|
107
107
|
}>;
|
|
@@ -65,7 +65,7 @@ exports.createRuleSchema = zod_1.z.discriminatedUnion('ruleType', [
|
|
|
65
65
|
enabled: zod_1.z.boolean().default(true),
|
|
66
66
|
}),
|
|
67
67
|
zod_1.z.strictObject({
|
|
68
|
-
ruleType: zod_1.z.literal('
|
|
68
|
+
ruleType: zod_1.z.literal('client'),
|
|
69
69
|
ruleValue: accountIdSchema,
|
|
70
70
|
enabled: zod_1.z.boolean().default(true),
|
|
71
71
|
}),
|