-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: comment 내에서 member의 객체 참조 -> id 참조로 변경 * test: 커버링 인덱스 성능 테스트를 위한 쿼리 케이스 생성 - 2번: 댓글에 커버링 인덱스 적용 - 3번: 서브쿼리를 활용해 댓글에 커버링 인덱스 적용 - 4번: 댓글에 커버링 인덱스 적용 후 쓰레드 풀을 사용해 댓글, 멤버에 조회 * refactor: 사용하지 않는 쿼리 및 기능 삭제 * chore: 인덱스 추가 * test: 사용하지 않는 테스트 삭제 * refactor: comment 패키지 생성 및 의존성 분리 * test: comment 필드 변경으로 불필요한 테스트 로직 제거 * refactor: dto를 interface로 프로젝션하도록 변경
- Loading branch information
1 parent
08dfcc4
commit 2f33705
Showing
19 changed files
with
157 additions
and
134 deletions.
There are no files selected for viewing
11 changes: 6 additions & 5 deletions
11
...ginroom/controller/CommentController.java → ...comment/controller/CommentController.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
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
13 changes: 13 additions & 0 deletions
13
backend/src/main/java/com/digginroom/digginroom/comment/repository/dto/CommentMember.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,13 @@ | ||
package com.digginroom.digginroom.comment.repository.dto; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public record CommentMember( | ||
Long id, | ||
String comment, | ||
LocalDateTime createdAt, | ||
LocalDateTime updatedAt, | ||
Long memberId, | ||
String nickname | ||
) { | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...igginroom/service/dto/CommentRequest.java → ...m/comment/service/dto/CommentRequest.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
38 changes: 38 additions & 0 deletions
38
backend/src/main/java/com/digginroom/digginroom/comment/service/dto/CommentResponse.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,38 @@ | ||
package com.digginroom.digginroom.comment.service.dto; | ||
|
||
import com.digginroom.digginroom.comment.domain.Comment; | ||
import com.digginroom.digginroom.comment.repository.dto.CommentMember; | ||
import java.time.LocalDateTime; | ||
import java.util.Objects; | ||
|
||
public record CommentResponse( | ||
Long id, | ||
String writer, | ||
String comment, | ||
LocalDateTime createdAt, | ||
LocalDateTime updatedAt, | ||
boolean isOwner | ||
) { | ||
|
||
public static CommentResponse of(final CommentMember commentMember, final Long memberId) { | ||
return new CommentResponse( | ||
commentMember.id(), | ||
commentMember.nickname(), | ||
commentMember.comment(), | ||
commentMember.createdAt(), | ||
commentMember.updatedAt(), | ||
Objects.equals(commentMember.memberId(), memberId) | ||
); | ||
} | ||
|
||
public static CommentResponse of(final Comment comment, boolean isOwner, String nickname) { | ||
return new CommentResponse( | ||
comment.getId(), | ||
nickname, | ||
comment.getComment(), | ||
comment.getCreatedAt(), | ||
comment.getUpdatedAt(), | ||
isOwner | ||
); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ginroom/service/dto/CommentsResponse.java → ...comment/service/dto/CommentsResponse.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
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
9 changes: 9 additions & 0 deletions
9
backend/src/main/java/com/digginroom/digginroom/repository/dto/MemberNickname.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,9 @@ | ||
package com.digginroom.digginroom.repository.dto; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
|
||
public interface MemberNickname { | ||
|
||
@Value("#{target.nickname}") | ||
String getNickname(); | ||
} |
25 changes: 0 additions & 25 deletions
25
backend/src/main/java/com/digginroom/digginroom/service/dto/CommentResponse.java
This file was deleted.
Oops, something went wrong.
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
1 change: 1 addition & 0 deletions
1
backend/src/main/resources/db/migration/V6.4__create_index_room_id_id_from_comment.sql
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 @@ | ||
CREATE INDEX COMMENT_ROOM_ID_COMMENT_ID_IDX ON comment (room_id, id desc); |
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.