Skip to content

Commit

Permalink
feat: add QnaMapper [#311]
Browse files Browse the repository at this point in the history
  • Loading branch information
kho903 committed Feb 13, 2022
1 parent d446ed5 commit a39d537
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.mapstruct.factory.Mappers;

import com.bancow.bancowback.domain.main.qna.dto.QnaRequestDto;
import com.bancow.bancowback.domain.main.qna.dto.QnaResponseDto;
import com.bancow.bancowback.domain.main.qna.entity.Qna;

@Mapper(componentModel = "spring")
Expand All @@ -25,4 +26,17 @@ default public Qna toEntity(QnaRequestDto qnaInputDto) {
.createDate(LocalDateTime.now())
.build();
}

default QnaResponseDto toResponse(Qna qna) {
return QnaResponseDto.builder()
.id(qna.getId())
.qnaName(qna.getQnaName())
.phoneNumber(qna.getPhoneNumber())
.email(qna.getEmail())
.title(qna.getTitle())
.message(qna.getMessage())
.checked(qna.isChecked())
.createDate(qna.getCreateDate())
.build();
}
}

0 comments on commit a39d537

Please sign in to comment.