diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerCreateRequest.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerCreateRequest.java index aedbd8ce..c20ddac7 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerCreateRequest.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerCreateRequest.java @@ -20,12 +20,11 @@ public class AnswerCreateRequest { - public AnswerCreateRequest(Long questionId, String content, String nickname, + public AnswerCreateRequest(Long questionId, String content, Boolean profileOnOff, String linkAttachments, String musicName, String musicSinger, String musicAudioUrl, String imageUrl, boolean updateImage) { this.questionId = questionId; this.content = content; - this.nickname = nickname; this.profileOnOff = profileOnOff; this.linkAttachments = linkAttachments; this.musicName = musicName; @@ -36,10 +35,10 @@ public AnswerCreateRequest(Long questionId, String content, String nickname, } - public static AnswerCreateRequest of(Long questionId, String content, String nickname, + public static AnswerCreateRequest of(Long questionId, String content, Boolean profileOnOff, String linkAttachments, String musicName, String musicSinger, String musicAudioUrl, String imageUrl, boolean updateImage) { - return new AnswerCreateRequest(questionId, content, nickname, profileOnOff, linkAttachments, + return new AnswerCreateRequest(questionId, content, profileOnOff, linkAttachments, musicName, musicSinger, musicAudioUrl, imageUrl, updateImage); } } \ No newline at end of file diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerDetailResponse.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerDetailResponse.java index 6d190474..209f8350 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerDetailResponse.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/dto/AnswerDetailResponse.java @@ -14,7 +14,6 @@ public class AnswerDetailResponse { private Long memberId; private String content; private String nickname; - private String memberNickname; private Boolean profileOnOff; private String linkAttachments; private String musicName; @@ -25,7 +24,7 @@ public class AnswerDetailResponse { public AnswerDetailResponse(Long answerId, Long questionId, String questionContent, Long memberId, - String nickname, String content, String memberNickname, Boolean profileOnOff, + String content, String nickname, Boolean profileOnOff, String linkAttachments, String musicName, String musicSinger, String musicAudioUrl, String imageUrl, LocalDateTime createdDate) { @@ -36,7 +35,6 @@ public AnswerDetailResponse(Long answerId, Long questionId, String questionConte this.memberId = memberId; this.content = content; this.nickname = nickname; - this.memberNickname = memberNickname; this.profileOnOff = profileOnOff; this.linkAttachments = linkAttachments; this.musicName = musicName; @@ -47,10 +45,10 @@ public AnswerDetailResponse(Long answerId, Long questionId, String questionConte } public static AnswerDetailResponse of(Long answerId, Long questionId, String questionContent, Long memberId, - String content, String nickname, String memberNickname, Boolean profileOnOff, + String content, String nickname, Boolean profileOnOff, String linkAttachments, String musicName, String musicSinger, String musicAudioUrl, String imageUrl, LocalDateTime createdDate) { - return new AnswerDetailResponse(answerId, questionId, questionContent, memberId, content, nickname, memberNickname, + return new AnswerDetailResponse(answerId, questionId, questionContent, memberId, content, nickname, profileOnOff, linkAttachments, musicName, musicSinger, musicAudioUrl, imageUrl, createdDate); diff --git a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/repository/AnswerMapper.java b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/repository/AnswerMapper.java index b8b9ac10..69960cc8 100644 --- a/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/repository/AnswerMapper.java +++ b/baebae-BE/src/main/java/com/web/baebaeBE/domain/answer/repository/AnswerMapper.java @@ -24,12 +24,14 @@ public Answer toEntity(AnswerCreateRequest request, Question question, Member me .musicAudioUrl(request.getMusicAudioUrl()) .build(); + String senderNickname = question.getSender().getNickname(); + // Answer 엔티티 생성 및 Music 설정 Answer answer = Answer.builder() .question(question) .member(member) .content(request.getContent()) - .nickname(request.getNickname()) + .nickname(senderNickname) .linkAttachments(request.getLinkAttachments()) .profileOnOff(request.getProfileOnOff()) .createdDate(LocalDateTime.now()) @@ -47,6 +49,7 @@ public AnswerDetailResponse toDomain(Answer answer) { Member member = answer.getMember(); Question question = answer.getQuestion(); + return AnswerDetailResponse.of( answer.getId(), question.getId(), @@ -54,7 +57,6 @@ public AnswerDetailResponse toDomain(Answer answer) { member.getId(), answer.getContent(), answer.getNickname(), - member.getNickname(), answer.isProfileOnOff(), answer.getLinkAttachments(), music != null ? music.getMusicName() : null,