renaming and docs

This commit is contained in:
Anika Raemer 2025-10-04 18:16:49 +02:00
parent b1b714f44e
commit 7e831cfb64
14 changed files with 86 additions and 32 deletions

View file

@ -1,7 +1,7 @@
import { Router } from "express";
import { RecipeRepository } from "../repositories/RecipeRepository.js";
import { RecipeDtoEntityMapper } from "../mappers/RecipeDtoEntityMapper.js";
import { RecipeController } from "../controllers/RecipeController.js";
import { RecipeHandler } from "../handlers/RecipeHandler.js";
import { asyncHandler } from "../utils/asyncHandler.js";
import { RecipeDto } from "../dtos/RecipeDto.js";
import { RecipeIngredientDtoEntityMapper } from "../mappers/RecipeIngredientDtoEntityMapper.js";
@ -20,10 +20,12 @@ const recipeIngredientMapper = new RecipeIngredientDtoEntityMapper();
const recipeIngredientGroupMapper = new RecipeIngredientGroupDtoEntityMapper(recipeIngredientMapper);
const recipeInstructionStepMapper = new RecipeInstructionStepDtoEntityMapper();
const recipeMapper = new RecipeDtoEntityMapper(recipeInstructionStepMapper, recipeIngredientGroupMapper);
const recipeController = new RecipeController(recipeRepository, recipeMapper);
const recipeController = new RecipeHandler(recipeRepository, recipeMapper);
/**
* Create new recipe
* Consumes: RecipeDto
* Responds with RecipeDto
*/
router.post(
"/",
@ -34,6 +36,10 @@ router.post(
})
);
/**
* Load recipe by id
* Responds with RecipeDto
*/
router.get(
"/:id",
asyncHandler(async(req, res) => {
@ -43,6 +49,12 @@ router.get(
})
);
/**
* Saves existing recipe
* Also handles changes to instructions steps and ingredient (groups)
* Consumes: RecipeDto
* Responds with RecipeDto
*/
router.put(
"/:id",
asyncHandler(async(req, res) =>{