-
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.
Browse files
Browse the repository at this point in the history
…JI-132 ✨ [feature] #116 - 스터디룸 게시글, 정보나눔 게시글, 트러블슈팅 게시글 구현 API
- Loading branch information
Showing
17 changed files
with
427 additions
and
17 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
11 changes: 11 additions & 0 deletions
11
...ain/java/gaji/service/domain/roomBoard/repository/RoomInfo/InfoPostCommentRepository.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,9 +1,20 @@ | ||
package gaji.service.domain.roomBoard.repository.RoomInfo; | ||
|
||
import gaji.service.domain.roomBoard.entity.RoomInfo.InfoPostComment; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface InfoPostCommentRepository extends JpaRepository<InfoPostComment, Long> { | ||
|
||
@Query("SELECT c FROM InfoPostComment c " + | ||
"LEFT JOIN FETCH c.replies " + | ||
"WHERE c.roomInfoPost.id = :postId " + | ||
"AND c.parentComment IS NULL " + | ||
"ORDER BY c.createdAt ASC, c.id ASC") | ||
Page<InfoPostComment> findOldestComments(@Param("postId") Long postId, Pageable pageable); | ||
} |
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: 10 additions & 0 deletions
10
src/main/java/gaji/service/domain/roomBoard/repository/RoomPost/PostCommentRepository.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,9 +1,19 @@ | ||
package gaji.service.domain.roomBoard.repository.RoomPost; | ||
|
||
import gaji.service.domain.roomBoard.entity.RoomPost.PostComment; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface PostCommentRepository extends JpaRepository<PostComment, Long> { | ||
@Query("SELECT c FROM PostComment c " + | ||
"LEFT JOIN FETCH c.replies " + | ||
"WHERE c.roomPost.id = :postId " + | ||
"AND c.parentComment IS NULL " + | ||
"ORDER BY c.createdAt ASC, c.id ASC") | ||
Page<PostComment> findOldestComments(@Param("postId") Long postId, Pageable pageable); | ||
} |
22 changes: 22 additions & 0 deletions
22
...va/gaji/service/domain/roomBoard/repository/RoomTrouble/TroublePostCommentRepository.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,9 +1,31 @@ | ||
package gaji.service.domain.roomBoard.repository.RoomTrouble; | ||
|
||
import gaji.service.domain.roomBoard.entity.RoomTrouble.TroublePostComment; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.PageRequest; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface TroublePostCommentRepository extends JpaRepository<TroublePostComment, Long> { | ||
@Query("SELECT c FROM TroublePostComment c " + | ||
"LEFT JOIN FETCH c.replies " + | ||
"WHERE c.roomTroublePost.id = :postId " + | ||
"AND c.isReply = false " + | ||
"AND (:lastCommentId IS NULL OR c.id > :lastCommentId) " + | ||
"ORDER BY c.createdAt ASC, c.id ASC") | ||
List<TroublePostComment> findCommentsWithReplies(@Param("postId") Long postId, | ||
@Param("lastCommentId") Long lastCommentId, | ||
Pageable pageable); | ||
|
||
@Query("SELECT c FROM TroublePostComment c " + | ||
"WHERE c.roomTroublePost.id = :postId " + | ||
"AND c.isReply = false " + | ||
"ORDER BY c.createdAt ASC, c.id ASC") | ||
Page<TroublePostComment> findOldestComments(@Param("postId") Long postId, Pageable pageable); | ||
} |
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
Oops, something went wrong.