实现使用系统中所有可用的原料一键生成配方

This commit is contained in:
2025-11-26 20:44:41 +08:00
parent ba60ed541c
commit 34311889e8
12 changed files with 301 additions and 30 deletions

View File

@@ -280,3 +280,15 @@ func ConvertUpdateRecipeRequestToModel(req *UpdateRecipeRequest) *models.Recipe
RecipeIngredients: ingredients,
}
}
// ToGenerateRecipeResponse 将 models.Recipe 转换为 GenerateRecipeResponse DTO
func ToGenerateRecipeResponse(recipe *models.Recipe) *GenerateRecipeResponse {
if recipe == nil {
return nil
}
return &GenerateRecipeResponse{
ID: recipe.ID,
Name: recipe.Name,
Description: recipe.Description,
}
}

View File

@@ -325,3 +325,10 @@ type ListRecipeResponse struct {
List []RecipeResponse `json:"list"`
Pagination PaginationDTO `json:"pagination"`
}
// GenerateRecipeResponse 是一键生成配方的响应体
type GenerateRecipeResponse struct {
ID uint32 `json:"id"` // 新生成的配方ID
Name string `json:"name"` // 新生成的配方名称
Description string `json:"description"` // 新生成的配方描述
}