-
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 #75 from jisung-in/refactor/71-comment-refactor
- Loading branch information
Showing
12 changed files
with
248 additions
and
118 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
32 changes: 32 additions & 0 deletions
32
src/main/java/com/jisungin/application/comment/response/CommentPageResponse.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,32 @@ | ||
package com.jisungin.application.comment.response; | ||
|
||
import com.jisungin.application.PageResponse; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
public class CommentPageResponse { | ||
|
||
private PageResponse<CommentQueryResponse> response; | ||
|
||
private List<Long> userLikeCommentIds = new ArrayList<>(); | ||
|
||
@Builder | ||
private CommentPageResponse(PageResponse<CommentQueryResponse> response, List<Long> userLikeCommentIds) { | ||
this.response = response; | ||
this.userLikeCommentIds = userLikeCommentIds; | ||
} | ||
|
||
public static CommentPageResponse of(PageResponse<CommentQueryResponse> response, | ||
List<Long> userLikeCommentIds) { | ||
return CommentPageResponse.builder() | ||
.response(response) | ||
.userLikeCommentIds(userLikeCommentIds) | ||
.build(); | ||
} | ||
|
||
} |
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
5 changes: 3 additions & 2 deletions
5
src/main/java/com/jisungin/domain/comment/repository/CommentRepositoryCustom.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,10 +1,11 @@ | ||
package com.jisungin.domain.comment.repository; | ||
|
||
import com.jisungin.application.PageResponse; | ||
import com.jisungin.application.comment.response.CommentQueryResponse; | ||
import java.util.List; | ||
|
||
public interface CommentRepositoryCustom { | ||
|
||
PageResponse<CommentQueryResponse> findAllComments(Long talkRoomId); | ||
List<CommentQueryResponse> findAllComments(Long talkRoomId); | ||
|
||
Long commentTotalCount(Long talkRoomId); | ||
} |
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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/jisungin/domain/mylibrary/repository/UserLibraryRepository.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 com.jisungin.domain.mylibrary.repository; | ||
|
||
import com.jisungin.domain.ReadingStatus; | ||
import com.jisungin.domain.mylibrary.UserLibrary; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
public interface UserLibraryRepository extends JpaRepository<UserLibrary, Long> { | ||
|
||
@Query( | ||
"SELECT ul.status FROM UserLibrary ul JOIN ul.user u WHERE u.id = :id" | ||
) | ||
ReadingStatus findByUserId(@Param("id") Long userId); | ||
} |
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.