-
Notifications
You must be signed in to change notification settings - Fork 0
[chore] 패키지 구조 변경 (RoomPost 도입) #229
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
Changes from all commits
393d57b
343b4ed
53a7d7f
6b08345
6a5a677
20f4914
e29f42b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,8 +8,8 @@ | |
| import konkuk.thip.comment.application.port.out.CommentLikeQueryPort; | ||
| import konkuk.thip.comment.application.service.validator.CommentAuthorizationValidator; | ||
| import konkuk.thip.comment.domain.Comment; | ||
| import konkuk.thip.common.post.CountUpdatable; | ||
| import konkuk.thip.common.post.service.PostHandler; | ||
| import konkuk.thip.post.domain.CountUpdatable; | ||
| import konkuk.thip.post.application.service.handler.PostHandler; | ||
| import lombok.RequiredArgsConstructor; | ||
|
Comment on lines
+11
to
13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain패키지 경로 변경 반영 OK — Room 소속 리소스 접근 검증(Record/Vote) 동일 적용 여부 확인
아래 스크립트로 해당 메서드 구현과 룸 참가자 검증 로직(예: RoomParticipant/Room 권한 검사)이 포함되어 있는지 빠르게 점검할 수 있습니다. 동시에, 댓글 좋아요 중복 삽입 방지를 위해 (userId, commentId) 유니크 인덱스가 저장소 레벨에 구성되어 있는지도 확인해 주세요. 이는 동시성 하에서 중복 like를 방지하는 최후방어선입니다. 🏁 Script executed: #!/bin/bash
set -euo pipefail
# 메서드 선언/구현 위치 및 주변 문맥 확인
rg -nP 'validateUserCanAccessPostForComment\s*\(' -C5
# Room 참가자 검증과 연관된 키워드가 같은 파일에 함께 있는지 힌트 검색
rg -nP 'RoomParticipant|RoomParticipants|isParticipant|validate.*Participant|validate.*Room' -n -C3Length of output: 266650 #!/usr/bin/env bash
set -euo pipefail
# 1. CommentAccessPolicy 구현체 확인
echo "=== CommentAccessPolicy 구현체 ==="
rg -nP 'implements\s+CommentAccessPolicy' -C3 src/main/java
# 2. CommentLikeJpaEntity 위치 및 unique 제약 확인
echo
echo "=== CommentLikeJpaEntity 검색 ==="
entity_file=$(rg -lP 'class\s+CommentLikeJpaEntity' -g '*.java' src/main/java || true)
if [[ -n "$entity_file" ]]; then
echo "Found: $entity_file"
echo "--- @Table 어노테이션 포함 부분 ---"
rg -nP '@Table' -C2 "$entity_file" || echo "(no @Table annotation)"
echo "--- unique 또는 uniqueConstraints 키워드 ---"
rg -nP 'unique|uniqueConstraints' -n "$entity_file" || echo "(no unique constraints)"
else
echo "CommentLikeJpaEntity 클래스를 찾지 못했습니다."
fi🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== 1. CommentAccessPolicy 인터페이스 위치 ==="
rg -nP "interface\s+CommentAccessPolicy" -C3 src/main/java || echo "(인터페이스 없음)"
echo
echo "=== 2. CommentAccessPolicy 구현체 목록 ==="
rg -nP "implements\s+CommentAccessPolicy" -C3 src/main/java || echo "(구현체 없음)"
echo
echo "=== 3. CommentLikeJpaEntity 에서 (userId, commentId) 유니크 인덱스 확인 ==="
entity_file=$(rg -lP "class\s+CommentLikeJpaEntity" -g '*.java' src/main/java || true)
if [[ -n "$entity_file" ]]; then
echo "Found: $entity_file"
echo "--- @Table 어노테이션 ---"
rg -nP "@Table" -C2 "$entity_file" || echo "(어노테이션 없음)"
echo "--- uniqueConstraints 또는 unique 키워드 ---"
rg -nP "uniqueConstraints|unique" -C2 "$entity_file" || echo "(유니크 제약 없음)"
else
echo "CommentLikeJpaEntity 클래스를 찾지 못했습니다."
fiLength of output: 3801 CommentAuthorizationValidator: Record/Vote Room 참가자 검증 정상 적용 확인, CommentLike DB 유니크 제약 추가 필요
🤖 Prompt for AI Agents |
||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package konkuk.thip.common.annotation; | ||
|
|
||
| import org.springframework.core.annotation.AliasFor; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import java.lang.annotation.ElementType; | ||
| import java.lang.annotation.Retention; | ||
| import java.lang.annotation.RetentionPolicy; | ||
| import java.lang.annotation.Target; | ||
|
|
||
| @Target({ElementType.TYPE}) | ||
| @Retention(RetentionPolicy.RUNTIME) | ||
| @Component | ||
| public @interface DomainService { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 좋네여 굿굿 |
||
|
|
||
| @AliasFor(annotation = Component.class) | ||
| String value() default ""; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| package konkuk.thip.common.post; | ||
| package konkuk.thip.post.domain; | ||
|
|
||
| import konkuk.thip.post.domain.service.PostCountService; | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 밑에 TODO 패키지 구조 변경 주석 지워주시면 감사하겠습니다!!
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵 제가 지우겠습니다 |
||
| public interface CountUpdatable { //TODO 패키지 구조 충돌안나게 한번에 옮기기 | ||
| public interface CountUpdatable { | ||
| void increaseCommentCount(); | ||
| void decreaseCommentCount(); | ||
| void updateLikeCount(PostCountService postCountService, boolean isLike); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| package konkuk.thip.common.post; | ||
| package konkuk.thip.post.domain; | ||
|
|
||
| import konkuk.thip.common.exception.InvalidStateException; | ||
| import lombok.Getter; | ||
|
|
@@ -7,6 +7,7 @@ | |
| import java.util.Arrays; | ||
|
|
||
| import static konkuk.thip.common.exception.code.ErrorCode.POST_TYPE_NOT_MATCH; | ||
| import static konkuk.thip.common.exception.code.ErrorCode.ROOM_POST_TYPE_NOT_MATCH; | ||
|
|
||
| @Getter | ||
| @RequiredArgsConstructor | ||
|
|
@@ -26,4 +27,13 @@ public static PostType from(String type) { | |
| new InvalidStateException(POST_TYPE_NOT_MATCH) | ||
| ); | ||
| } | ||
|
|
||
| public static PostType roomPostTypeFrom(String type) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 roomPostType 따로 정의한게 아니라 PostType안에서 roomPostType확인하는거 좋네여 FEED일 경우 예외처리도 넘넘좋습니다!! |
||
| return Arrays.stream(PostType.values()) | ||
| .filter(p -> !p.equals(FEED) && p.getType().equalsIgnoreCase(type)) | ||
| .findFirst() | ||
| .orElseThrow(() -> | ||
| new InvalidStateException(ROOM_POST_TYPE_NOT_MATCH) | ||
| ); | ||
| } | ||
| } | ||
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.
💡 Verification agent
🧩 Analysis chain
PostType/CountUpdatable/PostHandler 패키지 이동 반영 OK. 타입 변환 방식 일관성 확인 권장
리팩터링된 패키지 경로로의 정리는 적절합니다. 한 가지 점검사항: 본 서비스는 PostType.from(String)을 사용합니다(라인 34). 본 PR에서 일부 컴포넌트가 room-post 전용 매핑 메서드(roomPostTypeFrom)를 사용하도록 변경되었다면, 여기서도 동일 규칙을 적용할지 확인해 주세요. 매핑 규칙이 분기되면 권한 검증/조회 핸들러에서 타입 해석 불일치가 발생할 수 있습니다.
아래 스크립트로 타입 매핑 사용 현황을 점검해 주세요.
참고: 프로젝트 학습 메모에 따르면 Record/Vote는 Room 소속, Feed는 비소속입니다. commentAuthorizationValidator가 타입별 룸 참가자 검증을 이 규칙에 맞춰 수행하는지 함께 확인하면 좋겠습니다.
🏁 Script executed:
Length of output: 2523
🏁 Script executed:
Length of output: 169
🏁 Script executed:
Length of output: 777
PostType 매핑 방식 일관성 확인 필요
리팩터링된 패키지 경로 반영은 적절합니다. 다만, 방 게시글 전용 매핑을 위해 일부 컴포넌트(RoomPostIsLikeRequest)에서는
PostType.roomPostTypeFrom을 사용하는 반면,CommentCreateService(src/main/java/konkuk/thip/comment/application/service/CommentCreateService.java:34)에서는 여전히 일반 매핑인PostType.from을 사용하고 있습니다.매핑 로직 분기 시 권한 검증·조회 핸들러에서 타입 해석이 불일치할 수 있으므로, 아래 사항을 검토해주세요:
PostType.from(command.postType())→PostType.roomPostTypeFrom(command.postType())적용 여부🤖 Prompt for AI Agents