perf: 优化食物选择
This commit is contained in:
@@ -3,6 +3,27 @@ import { api } from '@/services/api';
|
||||
export type MealType = 'breakfast' | 'lunch' | 'dinner' | 'snack' | 'other';
|
||||
export type RecordSource = 'manual' | 'vision' | 'other';
|
||||
|
||||
export type CreateDietRecordDto = {
|
||||
mealType: MealType;
|
||||
foodName: string;
|
||||
foodDescription?: string;
|
||||
weightGrams?: number;
|
||||
portionDescription?: string;
|
||||
estimatedCalories?: number;
|
||||
proteinGrams?: number;
|
||||
carbohydrateGrams?: number;
|
||||
fatGrams?: number;
|
||||
fiberGrams?: number;
|
||||
sugarGrams?: number;
|
||||
sodiumMg?: number;
|
||||
additionalNutrition?: Record<string, any>;
|
||||
source?: RecordSource;
|
||||
mealTime?: string;
|
||||
imageUrl?: string;
|
||||
aiAnalysisResult?: Record<string, any>;
|
||||
notes?: string;
|
||||
};
|
||||
|
||||
export type DietRecord = {
|
||||
id: number;
|
||||
mealType: MealType;
|
||||
@@ -68,6 +89,10 @@ export async function getDietRecords({
|
||||
}>(`/diet-records${params}`);
|
||||
}
|
||||
|
||||
export async function addDietRecord(dto: CreateDietRecordDto): Promise<DietRecord> {
|
||||
return await api.post<DietRecord>('/diet-records', dto);
|
||||
}
|
||||
|
||||
export async function deleteDietRecord(recordId: number): Promise<void> {
|
||||
await api.delete(`/diet-records/${recordId}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user