-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor : 게시글 이모지와 댓글 좋아요 누르기/취소하기 API 응답 DTO 반환하도록 수정 #635
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9cd74b5
refactor(BoardEmojiToggleResponseDto): 게시글 이모지 누르기/취소하기 응답 dto로 필요한 정…
mingmingmon 6a40241
refactor(CommnetLikeToggleResponseDto): 댓글 좋아요 누르기/취소하기 API 응답에서 필요한 …
mingmingmon 5c93444
refactor(BoardEmojiDtoMapper): 불필요한 어노테이션 삭제
mingmingmon 7ac34ff
refactor(CommentLikeDtoMapper): dto 변환 메소드명 of로 수정
mingmingmon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...java/page/clab/api/domain/community/board/application/dto/mapper/BoardEmojiDtoMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package page.clab.api.domain.community.board.application.dto.mapper; | ||
|
||
import org.springframework.stereotype.Component; | ||
import page.clab.api.domain.community.board.application.dto.response.BoardEmojiToggleResponseDto; | ||
import page.clab.api.domain.community.board.domain.BoardEmoji; | ||
|
||
@Component | ||
public class BoardEmojiDtoMapper { | ||
|
||
public BoardEmojiToggleResponseDto toDto(BoardEmoji boardEmoji) { | ||
return BoardEmojiToggleResponseDto.builder() | ||
.boardId(boardEmoji.getBoardId()) | ||
.emoji(boardEmoji.getEmoji()) | ||
.isDeleted(boardEmoji.getIsDeleted()) | ||
.build(); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...clab/api/domain/community/board/application/dto/response/BoardEmojiToggleResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package page.clab.api.domain.community.board.application.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
public class BoardEmojiToggleResponseDto { | ||
|
||
private Long boardId; | ||
private String emoji; | ||
private Boolean isDeleted; | ||
} |
4 changes: 3 additions & 1 deletion
4
...ava/page/clab/api/domain/community/board/application/port/in/ToggleBoardEmojiUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package page.clab.api.domain.community.board.application.port.in; | ||
|
||
import page.clab.api.domain.community.board.application.dto.response.BoardEmojiToggleResponseDto; | ||
|
||
public interface ToggleBoardEmojiUseCase { | ||
String toggleEmojiStatus(Long boardId, String emoji); | ||
BoardEmojiToggleResponseDto toggleEmojiStatus(Long boardId, String emoji); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...a/page/clab/api/domain/community/comment/application/dto/mapper/CommentLikeDtoMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package page.clab.api.domain.community.comment.application.dto.mapper; | ||
|
||
import org.springframework.stereotype.Component; | ||
import page.clab.api.domain.community.comment.application.dto.response.CommentLikeToggleResponseDto; | ||
|
||
@Component | ||
public class CommentLikeDtoMapper { | ||
|
||
public CommentLikeToggleResponseDto toDto(Long boardId, Long commentLikes, Boolean isDeleted) { | ||
return CommentLikeToggleResponseDto.builder() | ||
.boardId(boardId) | ||
.likes(commentLikes) | ||
.isDeleted(isDeleted) | ||
.build(); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...b/api/domain/community/comment/application/dto/response/CommentLikeToggleResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package page.clab.api.domain.community.comment.application.dto.response; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
@Builder | ||
public class CommentLikeToggleResponseDto { | ||
|
||
private Long boardId; | ||
private Long likes; | ||
private Boolean isDeleted; | ||
} |
4 changes: 3 additions & 1 deletion
4
.../page/clab/api/domain/community/comment/application/port/in/ToggleCommentLikeUseCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package page.clab.api.domain.community.comment.application.port.in; | ||
|
||
import page.clab.api.domain.community.comment.application.dto.response.CommentLikeToggleResponseDto; | ||
|
||
public interface ToggleCommentLikeUseCase { | ||
Long toggleLikeStatus(Long commentId); | ||
CommentLikeToggleResponseDto toggleLikeStatus(Long commentId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
도메인 객체를 DTO로 바꾸는 변환이 아니라 각 파라미터를 대입하는 것이기 때문에 메서드 이름을
of
로 하는건 어떠신가요?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
명명규칙이 도메인 객체를 DTO로 바꾼다면
toDto
이고 다른 파라미터들로 DTO를 생성하면of
로 되는걸까요?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
네네 DTO 생성의 개념에서
of
를 사용해주시면 될 것 같아요There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 수정하도록 하겠습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 부분에 대한 컨벤션은 아래 링크의
5. 생성자명 변경
코멘트 참고해주시면 도움되실 것 같아요.도메인 유효성 검사 추가 및 코드베이스 리팩토링 작업
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 확인하도록 하겠습니다!