拓展接口响应

This commit is contained in:
2025-11-21 16:37:09 +08:00
parent 534891309c
commit 4224be8567
5 changed files with 115 additions and 30 deletions

View File

@@ -20,13 +20,21 @@ type UpdateNutrientRequest struct {
Description string `json:"description" validate:"max=255"` // 描述
}
// NutrientRawMaterialDTO 用于在营养素信息中展示关联的原料及其含量
type NutrientRawMaterialDTO struct {
ID uint32 `json:"id"` // 原料ID
Name string `json:"name"` // 原料名称
Value float32 `json:"value"` // 该原料中此营养素的含量
}
// NutrientResponse 营养种类响应体
type NutrientResponse struct {
ID uint32 `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `json:"name"`
Description string `json:"description"`
ID uint32 `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `json:"name"`
Description string `json:"description"`
RawMaterials []NutrientRawMaterialDTO `json:"raw_materials"` // 包含此营养的原料列表
}
// ListNutrientRequest 定义了获取营养种类列表的请求参数