From d0c5320275127d2392bcdfb6207c56eb865d6429 Mon Sep 17 00:00:00 2001 From: LuckMeelo Date: Fri, 13 Dec 2024 12:44:25 +0100 Subject: [PATCH] fix: ingredient generation body key not specified --- src/services/recipe/recipes.controller.ts | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/services/recipe/recipes.controller.ts b/src/services/recipe/recipes.controller.ts index 877a1bc..179a57d 100644 --- a/src/services/recipe/recipes.controller.ts +++ b/src/services/recipe/recipes.controller.ts @@ -23,14 +23,30 @@ import { ApiBody, ApiOperation, ApiParam, ApiTags } from '@nestjs/swagger'; export class RecipesController { constructor(private readonly recipesService: RecipesService) {} - @ApiBody({ type: [String] }) + @ApiBody({ + description: 'Provide a list of recipes', + required: true, + schema: { + type: 'object', + properties: { + recipes: { + type: 'array', + items: { + type: 'string', + }, + example: ['string1', 'string2'], + description: 'Array of recipe names', + }, + }, + }, + }) @ApiOperation({ summary: 'Find all ingredients based on many recipes' }) @Get('generate-ingredients') async generateIngredientsList( - @Body() recipeIds: string[], + @Body('recipes') recipes: string[], ): Promise { try { - return await this.recipesService.generateIngredientsList(recipeIds); + return await this.recipesService.generateIngredientsList(recipes); } catch (err) { throw new HttpException( {