added incomplete recipe point, controller and mapper implementation
This commit is contained in:
parent
d94251dea4
commit
3a887d8dbb
5 changed files with 134 additions and 2 deletions
31
src/mappers/RecipeDtoEntityMapper.ts
Normal file
31
src/mappers/RecipeDtoEntityMapper.ts
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue