Skip to content

Commit

Permalink
hotfix : 대댓글 매핑 문제 해결 및 refChildComment 칼럼 삭제 (CAUCSE#633)
Browse files Browse the repository at this point in the history
### 🚩 관련사항
관련된 이슈번호 혹은 pr번호를 기록합니다.


### 📢 전달사항

dtoMapper 매핑이 되고 있지 않던 문제를 해결하였으며 사용하지 않는 칼럼인 refChildComment에 의해 오류가
발생하는 문제가 있어 이번 PR에서 제거하였습니다.

### 📸 스크린샷

- 수정 전

<img width="1083" alt="스크린샷 2024-09-13 오후 3 33 26"
src="https://github.com/user-attachments/assets/eb4a90a2-8e18-4828-ba54-dd072fcf7f00">

- 수정 후

<img width="1083" alt="스크린샷 2024-09-13 오후 3 31 33"
src="https://github.com/user-attachments/assets/4d5d3f61-5518-4ca5-ae2e-f29137d1a206">

### 📃 진행사항
- [ ] done1
- [ ] done2 (진행되었어야 하는데 미처 하지 못한 부분 혹은 관련하여 앞으로 진행되어야 하는 부분도 전부 적어서 체크
표시로 관리해주세요.)


### ⚙️ 기타사항
기타 참고사항을 적어주세요.

개발기간:
  • Loading branch information
zestbear authored Sep 14, 2024
2 parents 8c4a66b + a5a0ff7 commit 0041297
Show file tree
Hide file tree
Showing 20 changed files with 2,243 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ bin/
out/
!**/src/main/**/out/
!**/src/test/**/out/
dump.rdb

### NetBeans ###
/nbproject/private/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
package net.causw.application.dto.util.dtoMapper;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.processing.Generated;
import net.causw.adapter.persistence.board.Board;
import net.causw.adapter.persistence.board.BoardApply;
import net.causw.adapter.persistence.post.Post;
import net.causw.adapter.persistence.user.User;
import net.causw.application.dto.board.BoardMainResponseDto;
import net.causw.application.dto.board.BoardNameCheckResponseDto;
import net.causw.application.dto.board.BoardNameCheckResponseDto.BoardNameCheckResponseDtoBuilder;
import net.causw.application.dto.board.BoardOfCircleResponseDto;
import net.causw.application.dto.board.BoardOfCircleResponseDto.BoardOfCircleResponseDtoBuilder;
import net.causw.application.dto.board.BoardResponseDto;
import net.causw.application.dto.board.BoardResponseDto.BoardResponseDtoBuilder;
import net.causw.application.dto.board.NormalBoardAppliesResponseDto;
import net.causw.application.dto.board.NormalBoardAppliesResponseDto.NormalBoardAppliesResponseDtoBuilder;
import net.causw.application.dto.board.NormalBoardApplyResponseDto;
import net.causw.application.dto.board.NormalBoardApplyResponseDto.NormalBoardApplyResponseDtoBuilder;
import net.causw.application.dto.post.PostContentDto;
import net.causw.application.dto.user.UserResponseDto;
import org.springframework.stereotype.Component;

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-09-14T04:01:11+0900",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 17.0.11 (Amazon.com Inc.)"
)
@Component
public class BoardDtoMapperImpl implements BoardDtoMapper {

@Override
public BoardResponseDto toBoardResponseDto(Board entity, List<String> createRoleList, Boolean writable, String circleId, String circleName) {
if ( entity == null && createRoleList == null && writable == null && circleId == null && circleName == null ) {
return null;
}

BoardResponseDtoBuilder boardResponseDto = BoardResponseDto.builder();

if ( entity != null ) {
boardResponseDto.id( entity.getId() );
boardResponseDto.name( entity.getName() );
boardResponseDto.description( entity.getDescription() );
boardResponseDto.category( entity.getCategory() );
boardResponseDto.isDeleted( entity.getIsDeleted() );
}
if ( createRoleList != null ) {
List<String> list = createRoleList;
if ( list != null ) {
boardResponseDto.createRoleList( new ArrayList<String>( list ) );
}
}
if ( writable != null ) {
boardResponseDto.writable( writable );
}
if ( circleId != null ) {
boardResponseDto.circleId( circleId );
}
if ( circleName != null ) {
boardResponseDto.circleName( circleName );
}

return boardResponseDto.build();
}

@Override
public BoardNameCheckResponseDto toBoardNameCheckResponseDto(Boolean isPresent) {
if ( isPresent == null ) {
return null;
}

BoardNameCheckResponseDtoBuilder boardNameCheckResponseDto = BoardNameCheckResponseDto.builder();

boardNameCheckResponseDto.isPresent( isPresent );

return boardNameCheckResponseDto.build();
}

@Override
public BoardOfCircleResponseDto toBoardOfCircleResponseDto(Board board, Post post, Long numComment, boolean writable) {
if ( board == null && post == null && numComment == null ) {
return null;
}

BoardOfCircleResponseDtoBuilder boardOfCircleResponseDto = BoardOfCircleResponseDto.builder();

if ( board != null ) {
boardOfCircleResponseDto.id( board.getId() );
boardOfCircleResponseDto.name( board.getName() );
boardOfCircleResponseDto.isDeleted( board.getIsDeleted() );
}
if ( post != null ) {
boardOfCircleResponseDto.postId( post.getId() );
boardOfCircleResponseDto.postTitle( post.getTitle() );
boardOfCircleResponseDto.postWriterName( postWriterName( post ) );
boardOfCircleResponseDto.postWriterStudentId( postWriterStudentId( post ) );
boardOfCircleResponseDto.postCreatedAt( post.getCreatedAt() );
}
if ( numComment != null ) {
boardOfCircleResponseDto.postNumComment( numComment );
}
boardOfCircleResponseDto.writable( writable );

return boardOfCircleResponseDto.build();
}

@Override
public BoardMainResponseDto toBoardMainResponseDto(Board board, List<PostContentDto> postContentDtos) {
if ( board == null && postContentDtos == null ) {
return null;
}

BoardMainResponseDto boardMainResponseDto = new BoardMainResponseDto();

if ( board != null ) {
boardMainResponseDto.setBoardId( board.getId() );
boardMainResponseDto.setBoardName( board.getName() );
boardMainResponseDto.setIsDefault( board.getIsDefault() );
}
if ( postContentDtos != null ) {
List<PostContentDto> list = postContentDtos;
if ( list != null ) {
boardMainResponseDto.setContents( new ArrayList<PostContentDto>( list ) );
}
}

return boardMainResponseDto;
}

@Override
public BoardOfCircleResponseDto toBoardOfCircleResponseDto(Board entity, Long numComment, boolean writable) {
if ( entity == null && numComment == null ) {
return null;
}

BoardOfCircleResponseDtoBuilder boardOfCircleResponseDto = BoardOfCircleResponseDto.builder();

if ( entity != null ) {
boardOfCircleResponseDto.id( entity.getId() );
boardOfCircleResponseDto.name( entity.getName() );
boardOfCircleResponseDto.isDeleted( entity.getIsDeleted() );
}
if ( numComment != null ) {
boardOfCircleResponseDto.postNumComment( numComment );
}
boardOfCircleResponseDto.writable( writable );

return boardOfCircleResponseDto.build();
}

@Override
public NormalBoardApplyResponseDto toNormalBoardApplyResponseDto(BoardApply boardApply, UserResponseDto user) {
if ( boardApply == null && user == null ) {
return null;
}

NormalBoardApplyResponseDtoBuilder normalBoardApplyResponseDto = NormalBoardApplyResponseDto.builder();

if ( boardApply != null ) {
normalBoardApplyResponseDto.id( boardApply.getId() );
normalBoardApplyResponseDto.boardName( boardApply.getBoardName() );
normalBoardApplyResponseDto.description( boardApply.getDescription() );
normalBoardApplyResponseDto.createRoles( boardApply.getCreateRoles() );
normalBoardApplyResponseDto.isAnonymousAllowed( boardApply.getIsAnonymousAllowed() );
}
if ( user != null ) {
normalBoardApplyResponseDto.user( user );
}

return normalBoardApplyResponseDto.build();
}

@Override
public NormalBoardAppliesResponseDto toNormalBoardAppliesResponseDto(BoardApply boardApply) {
if ( boardApply == null ) {
return null;
}

NormalBoardAppliesResponseDtoBuilder normalBoardAppliesResponseDto = NormalBoardAppliesResponseDto.builder();

normalBoardAppliesResponseDto.id( boardApply.getId() );
normalBoardAppliesResponseDto.boardName( boardApply.getBoardName() );

return normalBoardAppliesResponseDto.build();
}

private String postWriterName(Post post) {
if ( post == null ) {
return null;
}
User writer = post.getWriter();
if ( writer == null ) {
return null;
}
String name = writer.getName();
if ( name == null ) {
return null;
}
return name;
}

private String postWriterStudentId(Post post) {
if ( post == null ) {
return null;
}
User writer = post.getWriter();
if ( writer == null ) {
return null;
}
String studentId = writer.getStudentId();
if ( studentId == null ) {
return null;
}
return studentId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package net.causw.application.dto.util.dtoMapper;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.processing.Generated;
import net.causw.adapter.persistence.calendar.Calendar;
import net.causw.application.dto.calendar.CalendarResponseDto;
import net.causw.application.dto.calendar.CalendarResponseDto.CalendarResponseDtoBuilder;
import net.causw.application.dto.calendar.CalendarsResponseDto;
import net.causw.application.dto.calendar.CalendarsResponseDto.CalendarsResponseDtoBuilder;
import org.springframework.stereotype.Component;

@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2024-09-14T04:01:11+0900",
comments = "version: 1.4.2.Final, compiler: javac, environment: Java 17.0.11 (Amazon.com Inc.)"
)
@Component
public class CalendarDtoMapperImpl implements CalendarDtoMapper {

@Override
public CalendarResponseDto toCalendarResponseDto(Calendar calendar) {
if ( calendar == null ) {
return null;
}

CalendarResponseDtoBuilder calendarResponseDto = CalendarResponseDto.builder();

calendarResponseDto.createdAt( formatDateTime( calendar.getCreatedAt() ) );
calendarResponseDto.updatedAt( formatDateTime( calendar.getUpdatedAt() ) );
calendarResponseDto.image( mapUuidFileToFileUrl( calendar.getCalendarAttachImageUuidFile() ) );
calendarResponseDto.id( calendar.getId() );
calendarResponseDto.year( calendar.getYear() );
calendarResponseDto.month( calendar.getMonth() );

return calendarResponseDto.build();
}

@Override
public CalendarsResponseDto toCalendarsResponseDto(Integer count, List<CalendarResponseDto> calendars) {
if ( count == null && calendars == null ) {
return null;
}

CalendarsResponseDtoBuilder calendarsResponseDto = CalendarsResponseDto.builder();

if ( count != null ) {
calendarsResponseDto.count( count );
}
if ( calendars != null ) {
List<CalendarResponseDto> list = calendars;
if ( list != null ) {
calendarsResponseDto.calendars( new ArrayList<CalendarResponseDto>( list ) );
}
}

return calendarsResponseDto.build();
}
}
Loading

0 comments on commit 0041297

Please # to comment.