added incomplete recipe point, controller and mapper implementation

This commit is contained in:
Anika Raemer 2025-09-27 21:00:21 +02:00
parent d94251dea4
commit 3a887d8dbb
5 changed files with 134 additions and 2 deletions

View file

@ -0,0 +1,31 @@
import { RecipeDto } from "../dtos/RecipeDto.js";
import { RecipeEntity } from "../entities/RecipeEntity.js";
import { ValidationError } from "../errors/httpErrors.js";
import { AbstractDtoEntityMapper } from "./AbstractDtoEntityMapper.js";
export class RecipeDtoEntityMapper extends AbstractDtoEntityMapper<RecipeEntity,RecipeDto>{
toDto(entity: RecipeEntity): RecipeDto {
const dto = new RecipeDto();
this.mapBaseEntityToDto(entity, dto);
dto.title = entity.title;
dto.amount = entity.amount
dto.amountDescription = dto.amountDescription;
return dto;
}
toEntity(dto: RecipeDto): RecipeEntity {
const entity = new RecipeEntity();
this.mapBaseDtoToEntity(dto, entity);
entity.title = dto.title;
entity.amount = dto.amount
entity.amountDescription = dto.amountDescription;
return entity;
}
}