-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from ssu-student-union/refactor/52-post
[refactor] #52 청원게시물 단건 조회 시 공식답변(댓글) 포함 및 게시물 파일 생성 경로 수정
- Loading branch information
Showing
16 changed files
with
110 additions
and
46 deletions.
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
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
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
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
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
8 changes: 8 additions & 0 deletions
8
src/main/java/ussum/homepage/domain/comment/service/PostOfficialCommentFormatter.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,8 @@ | ||
package ussum.homepage.domain.comment.service; | ||
|
||
import ussum.homepage.application.comment.service.dto.response.PostOfficialCommentResponse; | ||
import ussum.homepage.domain.comment.PostComment; | ||
|
||
public interface PostOfficialCommentFormatter { | ||
PostOfficialCommentResponse format(PostComment postComment, Long userId); | ||
} |
23 changes: 23 additions & 0 deletions
23
...in/java/ussum/homepage/domain/comment/service/formatter/PostOfficialCommentFormatter.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,23 @@ | ||
package ussum.homepage.domain.comment.service.formatter; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import ussum.homepage.application.comment.service.dto.response.PostOfficialCommentResponse; | ||
import ussum.homepage.domain.comment.PostComment; | ||
import ussum.homepage.domain.user.User; | ||
import ussum.homepage.domain.user.service.UserReader; | ||
|
||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class PostOfficialCommentFormatter implements ussum.homepage.domain.comment.service.PostOfficialCommentFormatter { | ||
private final UserReader userReader; | ||
|
||
@Override | ||
public PostOfficialCommentResponse format(PostComment postComment, Long userId) { | ||
User user = userReader.getUserWithId(postComment.getUserId()); | ||
Boolean isAuthor = userId != null && userId.equals(postComment.getUserId()); | ||
|
||
return PostOfficialCommentResponse.of(postComment, user.getName(), postComment.getCommentType(), isAuthor); | ||
} | ||
} |
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
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.