-
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
[Chore] 게시글 관련 API 고도화 #31
Conversation
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.
고생하셨습니다! 컨벤션 및 간단한 의견을 남겼습니다.
그리고 pr 제목은 이슈와 같게 Feature로 변경하거나 Refactor로 바꾸는 게 좋을 거 같습니다.
chore는 로직 변경 및 코드 변경 없이 간단한 설정을 바꾸거나 할 때 사용하는 느낌이 강하다 생각합니다.
- 커밋 뒤에 해당 이슈 번호 붙여주세요 이미 푸쉬 된 건 머지할 때 메시지에 적용 부탁드립니다
깃허브 액션이 실패했었는데 제가 다시 돌리니 정상 적용됐네요! 가끔 인터넷 끊기거나 하면 이러더라구요
import project.backend.common.error.CustomException; | ||
import project.backend.common.error.ErrorCode; | ||
import project.backend.entity.post.Post; | ||
import project.backend.entity.user.User; | ||
import project.backend.repository.post.PostSpecification; | ||
|
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.
개행 1라인만 하도록 해주세요
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.
수정했습니다.
.and(PostSpecification.getSearch(postListServiceRequest.getSearch())) | ||
.and(PostSpecification.getActivated()); | ||
|
||
PageRequest pageRequest = PageRequest.of(postListServiceRequest.getPage(), 10, |
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.
수정했습니다
public CreateUpdatePostResponse updatePostDetail(Long userId, Long postId, | ||
PostDetailDto postDetailDto) { | ||
Post post = postReader.read(userId, postId); | ||
postManager.updatePost(post, postDetailDto); | ||
Long id = post.getId(); | ||
|
||
return new CreateUpdatePostResponse(id); | ||
} | ||
|
||
public void deletePostDetail(Long userId, Long postId) { |
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.
updatePost가 아닌 PostDetail인 이유가 있을까요? Post와 어떤 게 다를까요?
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입니다.
Update 뿐만 아니라 조회 시에도 사용되는 Dto입니다.
불필요한 컬럼들은 제외한 값입니다.
post.setActivated(Boolean.FALSE); | ||
postRepository.save(post); | ||
} | ||
|
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.
수정했습니다.
import project.backend.repository.post.PostRepository; | ||
import project.backend.entity.user.User; | ||
|
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.
수정했습니다.
List<Post> findAllByUserIdAndStatus(Long userId, PostStatus status); | ||
|
||
Post findPostByIdAndUserAndStatus(Long postId, User user, PostStatus status); | ||
Post findByIdAndUserIdAndActivatedTrue(Long postId, Long userId); | ||
|
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.
수정했습니다
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.
👍
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("activated"), | ||
Boolean.TRUE); | ||
} | ||
|
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.
수정했습니다.
@@ -11,17 +11,17 @@ | |||
public interface TagRepository extends JpaRepository<Tag, Long> { |
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.
따로 없습니다. 수정했습니다.
List<String> findTagNamesByPostId(Long postId); | ||
|
||
@Query("SELECT t " + | ||
"FROM Tag AS t JOIN PostTag AS pt ON t = pt.tag " + | ||
"WHERE pt.post.id = :postId ") | ||
"WHERE pt.post.id = :postId AND t.activated = true") | ||
List<Tag> findAllByPostId(Long postId); | ||
|
||
List<Tag> findAllByNameIn(List<String> names); |
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.
수정했습니다
@@ -31,21 +31,28 @@ public Long createTempPost(User user, String url, String summary) { | |||
} | |||
|
|||
@Transactional |
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.
@transactional 은 상위 PostService에서 사용해주세요
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.
수정했습니다~
💡 연관된 이슈
#26
📝 작업 내용
💬 리뷰 요구 사항
Dto관련해서 리팩토링한 코드와 충돌이 많이 일어나서 수정하느라 업데이트 된 파일이 많습니다.