From 504fe04896c98fdde6f2a81f4423a56c287e624e Mon Sep 17 00:00:00 2001 From: Jiwon Date: Fri, 15 Mar 2024 02:09:05 +0900 Subject: [PATCH] fix: Add required block response in recipe api (#141) --- backend/app/Savor22b/GraphTypes/Query/Query.cs | 1 + .../GraphTypes/Types/RecipeGraphType.cs | 6 ++++++ .../Savor22b/GraphTypes/Types/RecipeResponse.cs | 17 ++++++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/backend/app/Savor22b/GraphTypes/Query/Query.cs b/backend/app/Savor22b/GraphTypes/Query/Query.cs index cb919bf8..b8c478f1 100644 --- a/backend/app/Savor22b/GraphTypes/Query/Query.cs +++ b/backend/app/Savor22b/GraphTypes/Query/Query.cs @@ -555,6 +555,7 @@ private List combineRecipeData() new RecipeResponse( recipe.ID, recipe.Name, + recipe.RequiredBlock, recipeIngredientComponents, recipeFoodComponents ) diff --git a/backend/app/Savor22b/GraphTypes/Types/RecipeGraphType.cs b/backend/app/Savor22b/GraphTypes/Types/RecipeGraphType.cs index bdd3dec2..b13f70b7 100644 --- a/backend/app/Savor22b/GraphTypes/Types/RecipeGraphType.cs +++ b/backend/app/Savor22b/GraphTypes/Types/RecipeGraphType.cs @@ -23,6 +23,12 @@ public RecipeResponseType() resolve: context => context.Source.Name ); + Field( + name: "required", + description: "The RequiredBlock of the recipe.", + resolve: context => context.Source.RequiredBlock + ); + Field>( name: "ingredientIDList", description: "The list of ingredients in the recipe.", diff --git a/backend/app/Savor22b/GraphTypes/Types/RecipeResponse.cs b/backend/app/Savor22b/GraphTypes/Types/RecipeResponse.cs index 57126581..2a004fd2 100644 --- a/backend/app/Savor22b/GraphTypes/Types/RecipeResponse.cs +++ b/backend/app/Savor22b/GraphTypes/Types/RecipeResponse.cs @@ -2,21 +2,28 @@ namespace Savor22b.GraphTypes.Types; public class RecipeResponse { - public int Id { get; set; } - public string Name { get; set; } - public List IngredientList { get; set; } - public List FoodList { get; set; } - public RecipeResponse( int id, string name, + int requiredBlock, List ingredientList, List foodList ) { Id = id; Name = name; + RequiredBlock = requiredBlock; IngredientList = ingredientList; FoodList = foodList; } + + public int Id { get; set; } + + public string Name { get; set; } + + public int RequiredBlock { get; set; } + + public List IngredientList { get; set; } + + public List FoodList { get; set; } }