@tbs-fitness/contract 0.5.0 → 0.7.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 +33 -9
- package/dist/cjs/auth/auth.dto.js +5 -0
- package/dist/cjs/enums/index.d.ts +80 -0
- package/dist/cjs/enums/index.js +97 -1
- package/dist/cjs/feature-flags/feature-flag.dto.d.ts +9 -0
- package/dist/cjs/feature-flags/feature-flag.dto.js +9 -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.js +5 -0
- package/dist/esm/enums/index.d.ts +80 -0
- package/dist/esm/enums/index.js +96 -0
- package/dist/esm/feature-flags/feature-flag.dto.d.ts +9 -0
- package/dist/esm/feature-flags/feature-flag.dto.js +8 -0
- 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 +11 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** The file limits the API enforces, shared so the upload screen can say them up front. */
|
|
3
|
+
export declare const FOOD_IMPORT_LIMITS: {
|
|
4
|
+
readonly maxFileBytes: number;
|
|
5
|
+
readonly maxRows: 5000;
|
|
6
|
+
readonly extensions: readonly [".csv", ".xlsx"];
|
|
7
|
+
};
|
|
8
|
+
export declare const importIdParamSchema: z.ZodUUID;
|
|
9
|
+
/**
|
|
10
|
+
* One spreadsheet row after its cells are read. Values per 100 g (or per 100 ml
|
|
11
|
+
* for a serving in ml). Metadata are keys such as `protein` or `high-protein`,
|
|
12
|
+
* matched to the library's values. Has no defaults, so it also serves as the
|
|
13
|
+
* preview response.
|
|
14
|
+
*/
|
|
15
|
+
export declare const foodImportRowSchema: z.ZodObject<{
|
|
16
|
+
name: z.ZodString;
|
|
17
|
+
nameHi: z.ZodNullable<z.ZodString>;
|
|
18
|
+
namePa: z.ZodNullable<z.ZodString>;
|
|
19
|
+
englishAlias: z.ZodNullable<z.ZodString>;
|
|
20
|
+
category: z.ZodString;
|
|
21
|
+
subcategory: z.ZodNullable<z.ZodString>;
|
|
22
|
+
servingLabel: z.ZodString;
|
|
23
|
+
servingQuantity: z.ZodNumber;
|
|
24
|
+
servingUnit: z.ZodEnum<{
|
|
25
|
+
g: "g";
|
|
26
|
+
ml: "ml";
|
|
27
|
+
}>;
|
|
28
|
+
calories: z.ZodNumber;
|
|
29
|
+
protein: z.ZodNumber;
|
|
30
|
+
carbs: z.ZodNumber;
|
|
31
|
+
fat: z.ZodNumber;
|
|
32
|
+
sugar: z.ZodNullable<z.ZodNumber>;
|
|
33
|
+
fiber: z.ZodNullable<z.ZodNumber>;
|
|
34
|
+
solubleFiber: z.ZodNullable<z.ZodNumber>;
|
|
35
|
+
insolubleFiber: z.ZodNullable<z.ZodNumber>;
|
|
36
|
+
tags: z.ZodArray<z.ZodString>;
|
|
37
|
+
mealTimings: z.ZodArray<z.ZodString>;
|
|
38
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
39
|
+
}, z.core.$strict>;
|
|
40
|
+
export type FoodImportRow = z.output<typeof foodImportRowSchema>;
|
|
41
|
+
export declare const commitFoodImportSchema: z.ZodObject<{
|
|
42
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
43
|
+
SKIP_DUPLICATES: "SKIP_DUPLICATES";
|
|
44
|
+
UPDATE_EXISTING: "UPDATE_EXISTING";
|
|
45
|
+
}>>;
|
|
46
|
+
createMissingMetadata: z.ZodDefault<z.ZodBoolean>;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
export type CommitFoodImportInput = z.input<typeof commitFoodImportSchema>;
|
|
49
|
+
export type CommitFoodImportBody = z.output<typeof commitFoodImportSchema>;
|
|
50
|
+
export declare const foodImportListQuerySchema: z.ZodObject<{
|
|
51
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
52
|
+
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export declare const foodImportRowsQuerySchema: z.ZodObject<{
|
|
55
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
56
|
+
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
57
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
58
|
+
valid: "valid";
|
|
59
|
+
invalid: "invalid";
|
|
60
|
+
duplicate_in_file: "duplicate_in_file";
|
|
61
|
+
duplicate_existing: "duplicate_existing";
|
|
62
|
+
}>>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type FoodImportRowsQuery = z.output<typeof foodImportRowsQuerySchema>;
|
|
65
|
+
export declare const foodImportIssueSchema: z.ZodObject<{
|
|
66
|
+
column: z.ZodNullable<z.ZodString>;
|
|
67
|
+
code: z.ZodString;
|
|
68
|
+
message: z.ZodString;
|
|
69
|
+
severity: z.ZodEnum<{
|
|
70
|
+
error: "error";
|
|
71
|
+
warning: "warning";
|
|
72
|
+
}>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export type FoodImportIssue = z.output<typeof foodImportIssueSchema>;
|
|
75
|
+
export declare const foodImportBatchResponseSchema: z.ZodObject<{
|
|
76
|
+
id: z.ZodUUID;
|
|
77
|
+
fileName: z.ZodString;
|
|
78
|
+
fileType: z.ZodEnum<{
|
|
79
|
+
csv: "csv";
|
|
80
|
+
xlsx: "xlsx";
|
|
81
|
+
}>;
|
|
82
|
+
sheetName: z.ZodNullable<z.ZodString>;
|
|
83
|
+
status: z.ZodEnum<{
|
|
84
|
+
previewed: "previewed";
|
|
85
|
+
completed: "completed";
|
|
86
|
+
expired: "expired";
|
|
87
|
+
}>;
|
|
88
|
+
mode: z.ZodNullable<z.ZodEnum<{
|
|
89
|
+
SKIP_DUPLICATES: "SKIP_DUPLICATES";
|
|
90
|
+
UPDATE_EXISTING: "UPDATE_EXISTING";
|
|
91
|
+
}>>;
|
|
92
|
+
createMissingMetadata: z.ZodBoolean;
|
|
93
|
+
totalRows: z.ZodNumber;
|
|
94
|
+
validRows: z.ZodNumber;
|
|
95
|
+
invalidRows: z.ZodNumber;
|
|
96
|
+
duplicateRows: z.ZodNumber;
|
|
97
|
+
emptyRows: z.ZodNumber;
|
|
98
|
+
createdCount: z.ZodNumber;
|
|
99
|
+
updatedCount: z.ZodNumber;
|
|
100
|
+
skippedCount: z.ZodNumber;
|
|
101
|
+
unknownMetadata: z.ZodArray<z.ZodObject<{
|
|
102
|
+
typeKey: z.ZodString;
|
|
103
|
+
values: z.ZodArray<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>>;
|
|
105
|
+
ignoredColumns: z.ZodArray<z.ZodString>;
|
|
106
|
+
ignoredSheets: z.ZodArray<z.ZodString>;
|
|
107
|
+
uploadedBy: z.ZodUUID;
|
|
108
|
+
expiresAt: z.ZodISODateTime;
|
|
109
|
+
committedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
110
|
+
createdAt: z.ZodISODateTime;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
export type FoodImportBatchResponse = z.output<typeof foodImportBatchResponseSchema>;
|
|
113
|
+
export declare const foodImportRowResponseSchema: z.ZodObject<{
|
|
114
|
+
id: z.ZodUUID;
|
|
115
|
+
rowNumber: z.ZodNumber;
|
|
116
|
+
status: z.ZodEnum<{
|
|
117
|
+
valid: "valid";
|
|
118
|
+
invalid: "invalid";
|
|
119
|
+
duplicate_in_file: "duplicate_in_file";
|
|
120
|
+
duplicate_existing: "duplicate_existing";
|
|
121
|
+
}>;
|
|
122
|
+
raw: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
123
|
+
parsed: z.ZodNullable<z.ZodObject<{
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
nameHi: z.ZodNullable<z.ZodString>;
|
|
126
|
+
namePa: z.ZodNullable<z.ZodString>;
|
|
127
|
+
englishAlias: z.ZodNullable<z.ZodString>;
|
|
128
|
+
category: z.ZodString;
|
|
129
|
+
subcategory: z.ZodNullable<z.ZodString>;
|
|
130
|
+
servingLabel: z.ZodString;
|
|
131
|
+
servingQuantity: z.ZodNumber;
|
|
132
|
+
servingUnit: z.ZodEnum<{
|
|
133
|
+
g: "g";
|
|
134
|
+
ml: "ml";
|
|
135
|
+
}>;
|
|
136
|
+
calories: z.ZodNumber;
|
|
137
|
+
protein: z.ZodNumber;
|
|
138
|
+
carbs: z.ZodNumber;
|
|
139
|
+
fat: z.ZodNumber;
|
|
140
|
+
sugar: z.ZodNullable<z.ZodNumber>;
|
|
141
|
+
fiber: z.ZodNullable<z.ZodNumber>;
|
|
142
|
+
solubleFiber: z.ZodNullable<z.ZodNumber>;
|
|
143
|
+
insolubleFiber: z.ZodNullable<z.ZodNumber>;
|
|
144
|
+
tags: z.ZodArray<z.ZodString>;
|
|
145
|
+
mealTimings: z.ZodArray<z.ZodString>;
|
|
146
|
+
notes: z.ZodNullable<z.ZodString>;
|
|
147
|
+
}, z.core.$strict>>;
|
|
148
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
149
|
+
column: z.ZodNullable<z.ZodString>;
|
|
150
|
+
code: z.ZodString;
|
|
151
|
+
message: z.ZodString;
|
|
152
|
+
severity: z.ZodEnum<{
|
|
153
|
+
error: "error";
|
|
154
|
+
warning: "warning";
|
|
155
|
+
}>;
|
|
156
|
+
}, z.core.$strip>>;
|
|
157
|
+
matchedFoodId: z.ZodNullable<z.ZodUUID>;
|
|
158
|
+
resultFoodId: z.ZodNullable<z.ZodUUID>;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
export type FoodImportRowResponse = z.output<typeof foodImportRowResponseSchema>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { utcTimestampSchema } from '../common/date-time.schema.js';
|
|
3
|
+
import { paginationQuerySchema } from '../common/pagination.schema.js';
|
|
4
|
+
import { safeTextSchema } from '../common/safe-text.schema.js';
|
|
5
|
+
import { FOOD_IMPORT_FILE_TYPES, FOOD_IMPORT_ISSUE_SEVERITIES, FOOD_IMPORT_MODES, FOOD_IMPORT_ROW_STATUSES, FOOD_IMPORT_STATUSES, SERVING_UNITS, } from '../enums/index.js';
|
|
6
|
+
import { MAX_FOOD_NAME_LENGTH, MAX_FOOD_NOTES_LENGTH } from './food.dto.js';
|
|
7
|
+
import { nutrientAmountSchema, nutritionIssues, quantitySchema, } from './nutrition.js';
|
|
8
|
+
/** The file limits the API enforces, shared so the upload screen can say them up front. */
|
|
9
|
+
export const FOOD_IMPORT_LIMITS = {
|
|
10
|
+
maxFileBytes: 2 * 1024 * 1024,
|
|
11
|
+
maxRows: 5000,
|
|
12
|
+
extensions: ['.csv', '.xlsx'],
|
|
13
|
+
};
|
|
14
|
+
export const importIdParamSchema = z.uuid();
|
|
15
|
+
const metadataKeyListSchema = z.array(z.string().min(1).max(60)).max(50);
|
|
16
|
+
/**
|
|
17
|
+
* One spreadsheet row after its cells are read. Values per 100 g (or per 100 ml
|
|
18
|
+
* for a serving in ml). Metadata are keys such as `protein` or `high-protein`,
|
|
19
|
+
* matched to the library's values. Has no defaults, so it also serves as the
|
|
20
|
+
* preview response.
|
|
21
|
+
*/
|
|
22
|
+
export const foodImportRowSchema = z
|
|
23
|
+
.strictObject({
|
|
24
|
+
name: safeTextSchema(MAX_FOOD_NAME_LENGTH),
|
|
25
|
+
nameHi: safeTextSchema(MAX_FOOD_NAME_LENGTH).nullable(),
|
|
26
|
+
namePa: safeTextSchema(MAX_FOOD_NAME_LENGTH).nullable(),
|
|
27
|
+
englishAlias: safeTextSchema(200).nullable(),
|
|
28
|
+
category: z.string().min(1).max(60),
|
|
29
|
+
subcategory: z.string().min(1).max(60).nullable(),
|
|
30
|
+
servingLabel: safeTextSchema(MAX_FOOD_NAME_LENGTH),
|
|
31
|
+
servingQuantity: quantitySchema(),
|
|
32
|
+
servingUnit: z.enum(SERVING_UNITS),
|
|
33
|
+
calories: nutrientAmountSchema(),
|
|
34
|
+
protein: nutrientAmountSchema(),
|
|
35
|
+
carbs: nutrientAmountSchema(),
|
|
36
|
+
fat: nutrientAmountSchema(),
|
|
37
|
+
sugar: nutrientAmountSchema().nullable(),
|
|
38
|
+
fiber: nutrientAmountSchema().nullable(),
|
|
39
|
+
solubleFiber: nutrientAmountSchema().nullable(),
|
|
40
|
+
insolubleFiber: nutrientAmountSchema().nullable(),
|
|
41
|
+
tags: metadataKeyListSchema,
|
|
42
|
+
mealTimings: metadataKeyListSchema,
|
|
43
|
+
notes: safeTextSchema(MAX_FOOD_NOTES_LENGTH).nullable(),
|
|
44
|
+
})
|
|
45
|
+
.superRefine((row, ctx) => {
|
|
46
|
+
for (const issue of nutritionIssues(row)) {
|
|
47
|
+
ctx.addIssue({
|
|
48
|
+
code: 'custom',
|
|
49
|
+
message: issue.message,
|
|
50
|
+
path: [issue.path],
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
export const commitFoodImportSchema = z.strictObject({
|
|
55
|
+
mode: z.enum(FOOD_IMPORT_MODES).default('SKIP_DUPLICATES'),
|
|
56
|
+
/** Create categories, tags and other values the file uses but the library lacks. */
|
|
57
|
+
createMissingMetadata: z.boolean().default(false),
|
|
58
|
+
});
|
|
59
|
+
export const foodImportListQuerySchema = paginationQuerySchema;
|
|
60
|
+
export const foodImportRowsQuerySchema = paginationQuerySchema.extend({
|
|
61
|
+
status: z.enum(FOOD_IMPORT_ROW_STATUSES).optional(),
|
|
62
|
+
});
|
|
63
|
+
// Responses
|
|
64
|
+
export const foodImportIssueSchema = z.object({
|
|
65
|
+
/** The spreadsheet column, or null for a problem with the whole row. */
|
|
66
|
+
column: z.string().nullable(),
|
|
67
|
+
code: z.string(),
|
|
68
|
+
message: z.string(),
|
|
69
|
+
severity: z.enum(FOOD_IMPORT_ISSUE_SEVERITIES),
|
|
70
|
+
});
|
|
71
|
+
export const foodImportBatchResponseSchema = z.object({
|
|
72
|
+
id: z.uuid(),
|
|
73
|
+
fileName: z.string(),
|
|
74
|
+
fileType: z.enum(FOOD_IMPORT_FILE_TYPES),
|
|
75
|
+
sheetName: z.string().nullable(),
|
|
76
|
+
status: z.enum(FOOD_IMPORT_STATUSES),
|
|
77
|
+
mode: z.enum(FOOD_IMPORT_MODES).nullable(),
|
|
78
|
+
createMissingMetadata: z.boolean(),
|
|
79
|
+
totalRows: z.number().int(),
|
|
80
|
+
validRows: z.number().int(),
|
|
81
|
+
invalidRows: z.number().int(),
|
|
82
|
+
duplicateRows: z.number().int(),
|
|
83
|
+
emptyRows: z.number().int(),
|
|
84
|
+
createdCount: z.number().int(),
|
|
85
|
+
updatedCount: z.number().int(),
|
|
86
|
+
skippedCount: z.number().int(),
|
|
87
|
+
/** Values the file uses that the library does not have yet, by type key. */
|
|
88
|
+
unknownMetadata: z.array(z.object({ typeKey: z.string(), values: z.array(z.string()) })),
|
|
89
|
+
ignoredColumns: z.array(z.string()),
|
|
90
|
+
ignoredSheets: z.array(z.string()),
|
|
91
|
+
uploadedBy: z.uuid(),
|
|
92
|
+
expiresAt: utcTimestampSchema,
|
|
93
|
+
committedAt: utcTimestampSchema.nullable(),
|
|
94
|
+
createdAt: utcTimestampSchema,
|
|
95
|
+
});
|
|
96
|
+
export const foodImportRowResponseSchema = z.object({
|
|
97
|
+
id: z.uuid(),
|
|
98
|
+
/** The row number as the spreadsheet shows it, counting the header as row 1. */
|
|
99
|
+
rowNumber: z.number().int(),
|
|
100
|
+
status: z.enum(FOOD_IMPORT_ROW_STATUSES),
|
|
101
|
+
/** The cells as read, by header. */
|
|
102
|
+
raw: z.record(z.string(), z.string()),
|
|
103
|
+
parsed: foodImportRowSchema.nullable(),
|
|
104
|
+
issues: z.array(foodImportIssueSchema),
|
|
105
|
+
matchedFoodId: z.uuid().nullable(),
|
|
106
|
+
resultFoodId: z.uuid().nullable(),
|
|
107
|
+
});
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Limits on what a client sends, shared so the app can check them before sending. */
|
|
3
|
+
export declare const FOOD_SUGGESTION_LIMITS: {
|
|
4
|
+
readonly maxPortionQuantity: 10000;
|
|
5
|
+
readonly maxCalories: 5000;
|
|
6
|
+
readonly maxMacroGrams: 1000;
|
|
7
|
+
readonly maxNoteLength: 300;
|
|
8
|
+
readonly maxPhotoBytes: number;
|
|
9
|
+
readonly photoContentTypes: readonly ["image/jpeg", "image/png", "image/webp"];
|
|
10
|
+
};
|
|
11
|
+
export declare const MAX_REVIEW_NOTE_LENGTH = 300;
|
|
12
|
+
export declare const MAX_REJECTION_REASON_LENGTH = 500;
|
|
13
|
+
export declare const suggestionIdParamSchema: z.ZodUUID;
|
|
14
|
+
/**
|
|
15
|
+
* A food a client could not find in the library. Values are the client's best
|
|
16
|
+
* guess for the portion they ate, not per 100 g.
|
|
17
|
+
*/
|
|
18
|
+
export declare const submitFoodSuggestionSchema: z.ZodObject<{
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
quantity: z.ZodNumber;
|
|
21
|
+
unit: z.ZodEnum<{
|
|
22
|
+
BOWL: "BOWL";
|
|
23
|
+
GRAM: "GRAM";
|
|
24
|
+
PIECE: "PIECE";
|
|
25
|
+
CUP: "CUP";
|
|
26
|
+
}>;
|
|
27
|
+
calories: z.ZodNumber;
|
|
28
|
+
protein: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
carbs: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
fat: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
note: z.ZodOptional<z.ZodString>;
|
|
32
|
+
photoKey: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
export type SubmitFoodSuggestionInput = z.input<typeof submitFoodSuggestionSchema>;
|
|
35
|
+
export type SubmitFoodSuggestionBody = z.output<typeof submitFoodSuggestionSchema>;
|
|
36
|
+
export declare const suggestionPhotoUploadSchema: z.ZodObject<{
|
|
37
|
+
contentType: z.ZodEnum<{
|
|
38
|
+
"image/jpeg": "image/jpeg";
|
|
39
|
+
"image/png": "image/png";
|
|
40
|
+
"image/webp": "image/webp";
|
|
41
|
+
}>;
|
|
42
|
+
sizeBytes: z.ZodNumber;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
export type SuggestionPhotoUploadInput = z.input<typeof suggestionPhotoUploadSchema>;
|
|
45
|
+
export type SuggestionPhotoUploadBody = z.output<typeof suggestionPhotoUploadSchema>;
|
|
46
|
+
/** Where to upload the photo. The headers are signed and must be sent exactly. */
|
|
47
|
+
export declare const presignedUploadResponseSchema: z.ZodObject<{
|
|
48
|
+
key: z.ZodString;
|
|
49
|
+
url: z.ZodURL;
|
|
50
|
+
method: z.ZodLiteral<"PUT">;
|
|
51
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
52
|
+
expiresAt: z.ZodISODateTime;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
export type PresignedUploadResponse = z.output<typeof presignedUploadResponseSchema>;
|
|
55
|
+
/** The coach's corrected values for the portion the client logged. */
|
|
56
|
+
export declare const reviewedPortionSchema: z.ZodObject<{
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
quantity: z.ZodNumber;
|
|
59
|
+
unit: z.ZodEnum<{
|
|
60
|
+
BOWL: "BOWL";
|
|
61
|
+
GRAM: "GRAM";
|
|
62
|
+
PIECE: "PIECE";
|
|
63
|
+
CUP: "CUP";
|
|
64
|
+
}>;
|
|
65
|
+
grams: z.ZodNullable<z.ZodNumber>;
|
|
66
|
+
calories: z.ZodNumber;
|
|
67
|
+
protein: z.ZodNullable<z.ZodNumber>;
|
|
68
|
+
carbs: z.ZodNullable<z.ZodNumber>;
|
|
69
|
+
fat: z.ZodNullable<z.ZodNumber>;
|
|
70
|
+
}, z.core.$strict>;
|
|
71
|
+
export type ReviewedPortion = z.output<typeof reviewedPortionSchema>;
|
|
72
|
+
/**
|
|
73
|
+
* Approves a pending suggestion in one of three ways: add a new library food,
|
|
74
|
+
* link it to a food already in the library, or approve the portion without
|
|
75
|
+
* adding anything to the library.
|
|
76
|
+
*/
|
|
77
|
+
export declare const approveFoodSuggestionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
78
|
+
resolution: z.ZodLiteral<"ADDED_TO_LIBRARY">;
|
|
79
|
+
version: z.ZodNumber;
|
|
80
|
+
reviewed: z.ZodObject<{
|
|
81
|
+
name: z.ZodString;
|
|
82
|
+
quantity: z.ZodNumber;
|
|
83
|
+
unit: z.ZodEnum<{
|
|
84
|
+
BOWL: "BOWL";
|
|
85
|
+
GRAM: "GRAM";
|
|
86
|
+
PIECE: "PIECE";
|
|
87
|
+
CUP: "CUP";
|
|
88
|
+
}>;
|
|
89
|
+
grams: z.ZodNullable<z.ZodNumber>;
|
|
90
|
+
calories: z.ZodNumber;
|
|
91
|
+
protein: z.ZodNullable<z.ZodNumber>;
|
|
92
|
+
carbs: z.ZodNullable<z.ZodNumber>;
|
|
93
|
+
fat: z.ZodNullable<z.ZodNumber>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
food: z.ZodObject<{
|
|
96
|
+
name: z.ZodString;
|
|
97
|
+
nameHi: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
namePa: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
|
+
englishAlias: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
+
serving: z.ZodObject<{
|
|
101
|
+
label: z.ZodString;
|
|
102
|
+
quantity: z.ZodNumber;
|
|
103
|
+
unit: z.ZodEnum<{
|
|
104
|
+
g: "g";
|
|
105
|
+
ml: "ml";
|
|
106
|
+
}>;
|
|
107
|
+
}, z.core.$strict>;
|
|
108
|
+
nutrition: z.ZodObject<{
|
|
109
|
+
basis: z.ZodDefault<z.ZodEnum<{
|
|
110
|
+
PER_100: "PER_100";
|
|
111
|
+
PER_SERVING: "PER_SERVING";
|
|
112
|
+
}>>;
|
|
113
|
+
calories: z.ZodNumber;
|
|
114
|
+
protein: z.ZodNumber;
|
|
115
|
+
carbs: z.ZodNumber;
|
|
116
|
+
fat: z.ZodNumber;
|
|
117
|
+
sugar: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
118
|
+
fiber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
119
|
+
solubleFiber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
120
|
+
insolubleFiber: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
121
|
+
}, z.core.$strict>;
|
|
122
|
+
metadataValueIds: z.ZodDefault<z.ZodArray<z.ZodUUID>>;
|
|
123
|
+
notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
}, z.core.$strict>;
|
|
125
|
+
reviewNote: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
127
|
+
resolution: z.ZodLiteral<"LINKED_TO_EXISTING">;
|
|
128
|
+
version: z.ZodNumber;
|
|
129
|
+
foodId: z.ZodUUID;
|
|
130
|
+
reviewed: z.ZodOptional<z.ZodObject<{
|
|
131
|
+
name: z.ZodString;
|
|
132
|
+
quantity: z.ZodNumber;
|
|
133
|
+
unit: z.ZodEnum<{
|
|
134
|
+
BOWL: "BOWL";
|
|
135
|
+
GRAM: "GRAM";
|
|
136
|
+
PIECE: "PIECE";
|
|
137
|
+
CUP: "CUP";
|
|
138
|
+
}>;
|
|
139
|
+
grams: z.ZodNullable<z.ZodNumber>;
|
|
140
|
+
calories: z.ZodNumber;
|
|
141
|
+
protein: z.ZodNullable<z.ZodNumber>;
|
|
142
|
+
carbs: z.ZodNullable<z.ZodNumber>;
|
|
143
|
+
fat: z.ZodNullable<z.ZodNumber>;
|
|
144
|
+
}, z.core.$strict>>;
|
|
145
|
+
reviewNote: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
147
|
+
resolution: z.ZodLiteral<"APPROVED_WITHOUT_LIBRARY">;
|
|
148
|
+
version: z.ZodNumber;
|
|
149
|
+
reviewed: z.ZodObject<{
|
|
150
|
+
name: z.ZodString;
|
|
151
|
+
quantity: z.ZodNumber;
|
|
152
|
+
unit: z.ZodEnum<{
|
|
153
|
+
BOWL: "BOWL";
|
|
154
|
+
GRAM: "GRAM";
|
|
155
|
+
PIECE: "PIECE";
|
|
156
|
+
CUP: "CUP";
|
|
157
|
+
}>;
|
|
158
|
+
grams: z.ZodNullable<z.ZodNumber>;
|
|
159
|
+
calories: z.ZodNumber;
|
|
160
|
+
protein: z.ZodNullable<z.ZodNumber>;
|
|
161
|
+
carbs: z.ZodNullable<z.ZodNumber>;
|
|
162
|
+
fat: z.ZodNullable<z.ZodNumber>;
|
|
163
|
+
}, z.core.$strict>;
|
|
164
|
+
reviewNote: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$strict>], "resolution">;
|
|
166
|
+
export type ApproveFoodSuggestionInput = z.input<typeof approveFoodSuggestionSchema>;
|
|
167
|
+
export type ApproveFoodSuggestionBody = z.output<typeof approveFoodSuggestionSchema>;
|
|
168
|
+
/** The reason is shown to the client. */
|
|
169
|
+
export declare const rejectFoodSuggestionSchema: z.ZodObject<{
|
|
170
|
+
version: z.ZodNumber;
|
|
171
|
+
reason: z.ZodString;
|
|
172
|
+
}, z.core.$strict>;
|
|
173
|
+
export type RejectFoodSuggestionInput = z.input<typeof rejectFoodSuggestionSchema>;
|
|
174
|
+
export type RejectFoodSuggestionBody = z.output<typeof rejectFoodSuggestionSchema>;
|
|
175
|
+
export declare const foodSuggestionListQuerySchema: z.ZodObject<{
|
|
176
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
177
|
+
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
178
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
179
|
+
pending: "pending";
|
|
180
|
+
approved: "approved";
|
|
181
|
+
rejected: "rejected";
|
|
182
|
+
withdrawn: "withdrawn";
|
|
183
|
+
}>>;
|
|
184
|
+
search: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
export type FoodSuggestionListQuery = z.output<typeof foodSuggestionListQuerySchema>;
|
|
187
|
+
export declare const clientFoodSuggestionListQuerySchema: z.ZodObject<{
|
|
188
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
189
|
+
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
190
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
191
|
+
pending: "pending";
|
|
192
|
+
approved: "approved";
|
|
193
|
+
rejected: "rejected";
|
|
194
|
+
withdrawn: "withdrawn";
|
|
195
|
+
}>>;
|
|
196
|
+
}, z.core.$strip>;
|
|
197
|
+
export type ClientFoodSuggestionListQuery = z.output<typeof clientFoodSuggestionListQuerySchema>;
|
|
198
|
+
/** What the client sent. Never changes after submission. */
|
|
199
|
+
export declare const submittedFoodSchema: z.ZodObject<{
|
|
200
|
+
name: z.ZodString;
|
|
201
|
+
quantity: z.ZodNumber;
|
|
202
|
+
unit: z.ZodEnum<{
|
|
203
|
+
BOWL: "BOWL";
|
|
204
|
+
GRAM: "GRAM";
|
|
205
|
+
PIECE: "PIECE";
|
|
206
|
+
CUP: "CUP";
|
|
207
|
+
}>;
|
|
208
|
+
calories: z.ZodNumber;
|
|
209
|
+
protein: z.ZodNullable<z.ZodNumber>;
|
|
210
|
+
carbs: z.ZodNullable<z.ZodNumber>;
|
|
211
|
+
fat: z.ZodNullable<z.ZodNumber>;
|
|
212
|
+
note: z.ZodNullable<z.ZodString>;
|
|
213
|
+
hasPhoto: z.ZodBoolean;
|
|
214
|
+
}, z.core.$strip>;
|
|
215
|
+
export type SubmittedFood = z.output<typeof submittedFoodSchema>;
|
|
216
|
+
export declare const reviewedPortionResponseSchema: z.ZodObject<{
|
|
217
|
+
name: z.ZodString;
|
|
218
|
+
quantity: z.ZodNumber;
|
|
219
|
+
unit: z.ZodEnum<{
|
|
220
|
+
BOWL: "BOWL";
|
|
221
|
+
GRAM: "GRAM";
|
|
222
|
+
PIECE: "PIECE";
|
|
223
|
+
CUP: "CUP";
|
|
224
|
+
}>;
|
|
225
|
+
grams: z.ZodNullable<z.ZodNumber>;
|
|
226
|
+
calories: z.ZodNumber;
|
|
227
|
+
protein: z.ZodNullable<z.ZodNumber>;
|
|
228
|
+
carbs: z.ZodNullable<z.ZodNumber>;
|
|
229
|
+
fat: z.ZodNullable<z.ZodNumber>;
|
|
230
|
+
}, z.core.$strip>;
|
|
231
|
+
/** A suggestion as a coach reviews it. */
|
|
232
|
+
export declare const foodSuggestionResponseSchema: z.ZodObject<{
|
|
233
|
+
id: z.ZodUUID;
|
|
234
|
+
status: z.ZodEnum<{
|
|
235
|
+
pending: "pending";
|
|
236
|
+
approved: "approved";
|
|
237
|
+
rejected: "rejected";
|
|
238
|
+
withdrawn: "withdrawn";
|
|
239
|
+
}>;
|
|
240
|
+
client: z.ZodObject<{
|
|
241
|
+
id: z.ZodUUID;
|
|
242
|
+
fullName: z.ZodNullable<z.ZodString>;
|
|
243
|
+
}, z.core.$strip>;
|
|
244
|
+
submitted: z.ZodObject<{
|
|
245
|
+
name: z.ZodString;
|
|
246
|
+
quantity: z.ZodNumber;
|
|
247
|
+
unit: z.ZodEnum<{
|
|
248
|
+
BOWL: "BOWL";
|
|
249
|
+
GRAM: "GRAM";
|
|
250
|
+
PIECE: "PIECE";
|
|
251
|
+
CUP: "CUP";
|
|
252
|
+
}>;
|
|
253
|
+
calories: z.ZodNumber;
|
|
254
|
+
protein: z.ZodNullable<z.ZodNumber>;
|
|
255
|
+
carbs: z.ZodNullable<z.ZodNumber>;
|
|
256
|
+
fat: z.ZodNullable<z.ZodNumber>;
|
|
257
|
+
note: z.ZodNullable<z.ZodString>;
|
|
258
|
+
hasPhoto: z.ZodBoolean;
|
|
259
|
+
}, z.core.$strip>;
|
|
260
|
+
submittedAt: z.ZodISODateTime;
|
|
261
|
+
photoUrl: z.ZodNullable<z.ZodURL>;
|
|
262
|
+
resolution: z.ZodNullable<z.ZodEnum<{
|
|
263
|
+
ADDED_TO_LIBRARY: "ADDED_TO_LIBRARY";
|
|
264
|
+
LINKED_TO_EXISTING: "LINKED_TO_EXISTING";
|
|
265
|
+
APPROVED_WITHOUT_LIBRARY: "APPROVED_WITHOUT_LIBRARY";
|
|
266
|
+
}>>;
|
|
267
|
+
food: z.ZodNullable<z.ZodObject<{
|
|
268
|
+
id: z.ZodUUID;
|
|
269
|
+
name: z.ZodString;
|
|
270
|
+
deleted: z.ZodBoolean;
|
|
271
|
+
}, z.core.$strip>>;
|
|
272
|
+
reviewed: z.ZodNullable<z.ZodObject<{
|
|
273
|
+
name: z.ZodString;
|
|
274
|
+
quantity: z.ZodNumber;
|
|
275
|
+
unit: z.ZodEnum<{
|
|
276
|
+
BOWL: "BOWL";
|
|
277
|
+
GRAM: "GRAM";
|
|
278
|
+
PIECE: "PIECE";
|
|
279
|
+
CUP: "CUP";
|
|
280
|
+
}>;
|
|
281
|
+
grams: z.ZodNullable<z.ZodNumber>;
|
|
282
|
+
calories: z.ZodNumber;
|
|
283
|
+
protein: z.ZodNullable<z.ZodNumber>;
|
|
284
|
+
carbs: z.ZodNullable<z.ZodNumber>;
|
|
285
|
+
fat: z.ZodNullable<z.ZodNumber>;
|
|
286
|
+
}, z.core.$strip>>;
|
|
287
|
+
reviewNote: z.ZodNullable<z.ZodString>;
|
|
288
|
+
reviewedBy: z.ZodNullable<z.ZodObject<{
|
|
289
|
+
id: z.ZodUUID;
|
|
290
|
+
fullName: z.ZodNullable<z.ZodString>;
|
|
291
|
+
}, z.core.$strip>>;
|
|
292
|
+
reviewedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
293
|
+
matchesLibraryFoodId: z.ZodNullable<z.ZodUUID>;
|
|
294
|
+
similarPendingCount: z.ZodNumber;
|
|
295
|
+
similarFoods: z.ZodArray<z.ZodObject<{
|
|
296
|
+
id: z.ZodUUID;
|
|
297
|
+
name: z.ZodString;
|
|
298
|
+
serving: z.ZodObject<{
|
|
299
|
+
label: z.ZodString;
|
|
300
|
+
quantity: z.ZodNumber;
|
|
301
|
+
unit: z.ZodEnum<{
|
|
302
|
+
g: "g";
|
|
303
|
+
ml: "ml";
|
|
304
|
+
}>;
|
|
305
|
+
}, z.core.$strip>;
|
|
306
|
+
per100: z.ZodObject<{
|
|
307
|
+
calories: z.ZodNumber;
|
|
308
|
+
protein: z.ZodNumber;
|
|
309
|
+
carbs: z.ZodNumber;
|
|
310
|
+
fat: z.ZodNumber;
|
|
311
|
+
sugar: z.ZodNullable<z.ZodNumber>;
|
|
312
|
+
fiber: z.ZodNullable<z.ZodNumber>;
|
|
313
|
+
solubleFiber: z.ZodNullable<z.ZodNumber>;
|
|
314
|
+
insolubleFiber: z.ZodNullable<z.ZodNumber>;
|
|
315
|
+
}, z.core.$strip>;
|
|
316
|
+
similarity: z.ZodNumber;
|
|
317
|
+
}, z.core.$strip>>;
|
|
318
|
+
version: z.ZodNumber;
|
|
319
|
+
}, z.core.$strip>;
|
|
320
|
+
export type FoodSuggestionResponse = z.output<typeof foodSuggestionResponseSchema>;
|
|
321
|
+
/** A suggestion as the client who sent it sees it. */
|
|
322
|
+
export declare const clientFoodSuggestionResponseSchema: z.ZodObject<{
|
|
323
|
+
id: z.ZodUUID;
|
|
324
|
+
status: z.ZodEnum<{
|
|
325
|
+
pending: "pending";
|
|
326
|
+
approved: "approved";
|
|
327
|
+
rejected: "rejected";
|
|
328
|
+
withdrawn: "withdrawn";
|
|
329
|
+
}>;
|
|
330
|
+
submitted: z.ZodObject<{
|
|
331
|
+
name: z.ZodString;
|
|
332
|
+
quantity: z.ZodNumber;
|
|
333
|
+
unit: z.ZodEnum<{
|
|
334
|
+
BOWL: "BOWL";
|
|
335
|
+
GRAM: "GRAM";
|
|
336
|
+
PIECE: "PIECE";
|
|
337
|
+
CUP: "CUP";
|
|
338
|
+
}>;
|
|
339
|
+
calories: z.ZodNumber;
|
|
340
|
+
protein: z.ZodNullable<z.ZodNumber>;
|
|
341
|
+
carbs: z.ZodNullable<z.ZodNumber>;
|
|
342
|
+
fat: z.ZodNullable<z.ZodNumber>;
|
|
343
|
+
note: z.ZodNullable<z.ZodString>;
|
|
344
|
+
hasPhoto: z.ZodBoolean;
|
|
345
|
+
}, z.core.$strip>;
|
|
346
|
+
submittedAt: z.ZodISODateTime;
|
|
347
|
+
resolution: z.ZodNullable<z.ZodEnum<{
|
|
348
|
+
ADDED_TO_LIBRARY: "ADDED_TO_LIBRARY";
|
|
349
|
+
LINKED_TO_EXISTING: "LINKED_TO_EXISTING";
|
|
350
|
+
APPROVED_WITHOUT_LIBRARY: "APPROVED_WITHOUT_LIBRARY";
|
|
351
|
+
}>>;
|
|
352
|
+
reviewed: z.ZodNullable<z.ZodObject<{
|
|
353
|
+
name: z.ZodString;
|
|
354
|
+
quantity: z.ZodNumber;
|
|
355
|
+
unit: z.ZodEnum<{
|
|
356
|
+
BOWL: "BOWL";
|
|
357
|
+
GRAM: "GRAM";
|
|
358
|
+
PIECE: "PIECE";
|
|
359
|
+
CUP: "CUP";
|
|
360
|
+
}>;
|
|
361
|
+
grams: z.ZodNullable<z.ZodNumber>;
|
|
362
|
+
calories: z.ZodNumber;
|
|
363
|
+
protein: z.ZodNullable<z.ZodNumber>;
|
|
364
|
+
carbs: z.ZodNullable<z.ZodNumber>;
|
|
365
|
+
fat: z.ZodNullable<z.ZodNumber>;
|
|
366
|
+
}, z.core.$strip>>;
|
|
367
|
+
reviewNote: z.ZodNullable<z.ZodString>;
|
|
368
|
+
reviewedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
369
|
+
food: z.ZodNullable<z.ZodObject<{
|
|
370
|
+
id: z.ZodUUID;
|
|
371
|
+
name: z.ZodString;
|
|
372
|
+
}, z.core.$strip>>;
|
|
373
|
+
}, z.core.$strip>;
|
|
374
|
+
export type ClientFoodSuggestionResponse = z.output<typeof clientFoodSuggestionResponseSchema>;
|