Skip to content

Commit

Permalink
fix: ingredient generation body key not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckMeelo committed Dec 13, 2024
1 parent 4bbaf32 commit d0c5320
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/services/recipe/recipes.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<IngredientDetailDtoWithPrice[]> {
try {
return await this.recipesService.generateIngredientsList(recipeIds);
return await this.recipesService.generateIngredientsList(recipes);
} catch (err) {
throw new HttpException(
{
Expand Down

0 comments on commit d0c5320

Please sign in to comment.