-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] 게시글 조회시 사용자가 찜한 게시글인지 확인 가능한 값 추가 (#158)
* fix: 메인 페이지 게시글 페이지네이션시 일치 하지 않던 totalElements값 수정 * feat: custom findById 제거, @repository 제거, extends를 통해 PostRepositoryCustom 사용 * refactor: postCustomRepository대신 postRepository 사용 * feat: session이 비어있을 떄 null 반환하는 함수 추가 * feat: isLiked 필드 추가 * feat: memberId를 기준으로 좋아요한 게시글에 대한 isLiked상태 설정하여 반환 * feat: isLiked 기본값 false로 설정 * feat: 마이페이지 내가 작성한 게시글 조회시 isLiked 값 설정 * feat: 마이페이지 찜한 게시글 목록 조회시 isLiked 필드 true로 설정 * feat: 단일 게시글 조회시 isLiked 설정하여 반환 * refactor: Optional클래스 적용 * feat: Early Return 패턴 적용 * feat: SessionError 비즈니스 예외 처리 적용 * rename: Exception 이름 변경 * remove: 사용안하는 SessionErrorCode 제거 * refactor: SessionUtils validate 함수 대신 직접 Long형으로 변환 * refactor: getMemberIdOrNull 대신 getMemberId 사용 * refactor: SessionUtils catch 예외 NullpointerException, NumberFormatException 지정 * refactor: NumberFormatException 제거
- Loading branch information
Showing
10 changed files
with
122 additions
and
71 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
10 changes: 1 addition & 9 deletions
10
src/main/java/econo/buddybridge/post/repository/PostRepository.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,16 +1,8 @@ | ||
package econo.buddybridge.post.repository; | ||
|
||
import econo.buddybridge.post.entity.Post; | ||
import lombok.NonNull; | ||
import org.springframework.data.jpa.repository.EntityGraph; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.Optional; | ||
|
||
public interface PostRepository extends JpaRepository<Post, Long> { | ||
|
||
@NonNull | ||
@EntityGraph(attributePaths = {"author"}) | ||
Optional<Post> findById(Long postId); | ||
public interface PostRepository extends JpaRepository<Post, Long>, PostRepositoryCustom { | ||
|
||
} |
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