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{ 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; } }