Conversation
- hashTag 및 group 과의 매핑 테이블 groupHashTag 정의 - mapping table 상에서 group/hashtag 에 대한 lazy loading - tag 에 대한 유니크(+인덱싱) - groupHashTag 에서 group 에 대한 인덱싱 Ref: #132
- usedCount 필드 원자적 증감/soft delete 추가 - n+1 방지 fetch join 메서드 추가 - 자동완성 용 prefix 용 조회 메서드 추가 Ref: #132
- 실제 저장되는 값과, 보여지는 데이터를 분리하여 보여지는 데이터를 groupHashTag 에 추가 Ref: #132
- 해시태그 정규화 및 ui 상 보여지는 이름 분리(실제 저장과 외부 노출 값 분리) - 동시성 문제로 인한 unique 예외에 대비한 1회 재시도 전략 - 이미 존재하는 태그는 1 추가/ 아닌 경우는 새롭게 생성 Ref: #132
There was a problem hiding this comment.
Pull request overview
This PR adds group hashtag functionality to the application, allowing users to associate hashtags with groups during creation. However, there's a mismatch between the PR title/implementation and the referenced issue #132, which is actually about username/nickname duplicate checking, not group hashtags.
Key Changes:
- Added hashtag normalization utility (StringUtils) that sanitizes user input by removing special characters, converting spaces to underscores, and handling edge cases
- Implemented entities (HashTag, GroupHashTag) and repositories to support many-to-many relationship between groups and hashtags with usage tracking
- Created GroupHashTagWorker with concurrency handling for saving hashtags with duplicate detection and retry logic
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| StringUtils.java | New utility class for normalizing hashtag strings with pattern-based sanitization |
| GroupHashTagWorker.java | New worker class handling hashtag persistence, normalization, and concurrency conflicts |
| HashTag.java | New entity representing hashtags with usage count tracking and soft delete support |
| GroupHashTag.java | New junction entity mapping groups to hashtags with display tag preservation |
| HashTagRepository.java | Repository with custom queries for hashtag operations including autocomplete and bulk updates |
| GroupHashTagRepository.java | Repository for group-hashtag mappings with fetch join optimization |
| CreateGroupReq.java | Added hashTags field to group creation DTO |
| GroupServiceImpl.java | Integrated hashtag saving into group creation workflow |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/com/studypals/domain/groupManage/service/GroupServiceImpl.java
Show resolved
Hide resolved
src/main/java/com/studypals/domain/groupManage/entity/HashTag.java
Outdated
Show resolved
Hide resolved
src/main/java/com/studypals/domain/groupManage/worker/GroupHashTagWorker.java
Outdated
Show resolved
Hide resolved
src/main/java/com/studypals/domain/groupManage/worker/GroupHashTagWorker.java
Show resolved
Hide resolved
src/main/java/com/studypals/domain/groupManage/dao/HashTagRepository.java
Outdated
Show resolved
Hide resolved
src/main/java/com/studypals/domain/groupManage/worker/GroupHashTagWorker.java
Show resolved
Hide resolved
- naming, null check, 일부 잠재적인 동시성 오류 부분 수정 Ref: #142
src/main/java/com/studypals/domain/groupManage/worker/GroupHashTagWorker.java
Show resolved
Hide resolved
src/main/java/com/studypals/domain/groupManage/worker/GroupHashTagWorker.java
Show resolved
Hide resolved
src/main/java/com/studypals/domain/groupManage/worker/GroupHashTagWorker.java
Show resolved
Hide resolved
src/main/java/com/studypals/domain/groupManage/dao/HashTagRepository.java
Outdated
Show resolved
Hide resolved
- transactional 을 덮는 RetryTx 어노테이션 추가 Ref: #142
- retry 정상 작동 여부 테스트 - hashTag 관련한 변경으로 인해 실패하는 테스트 수정 - aspect 시 annotation 이 제대로 들어가지 않는 문제 해결 - 주석 추가 Ref: #142
- try-catch 제거 - retryTx 적용 Ref: #142
- hashtag 삭제를 batch 서버로 이전함에 따라, 1차 캐시 초기화 불필요로 인한 삭제 Ref: #142
- 기존 prefix 를 토대로 검색을 대신하여 중간에 값이 있어도 검색 가능하도록 변경 Ref: #142
- local/ test / prod 분리 및 운용 DB 분리 - 자세한 내용은 위키 참조 Ref: #142
- test 프로파일 적용 제거 - hash tag 테스트 추가 - retryTx 성능 테스트 시 db 초기화 로직 추가 - 문자열 정규화 로직 추가 - 그 외 테스트 유틸 수정 Ref: #142
- 기존에 -Dspring.profiles.active 환경변수가 있으면 이를 사용, 없으면 test 프로필 적용 Ref: #142
- 잘못 작성된 이름 수정 Ref: #142
|
@sleepyhoon 리뷰 반영 및 retryTx 어노테이션 관련 추가, 일부 자잘한 로직 등을 개편하였습니다. application.properties 구조를 개편하였습니다. 중복된 부분을 제거하고 각 상황에 맞게 prod(application.properties), local(application-local.properties), test(application-test.properties)로 구분하였습니다.
|
src/main/java/com/studypals/domain/groupManage/dao/HashTagRepository.java
Show resolved
Hide resolved
src/main/java/com/studypals/domain/groupManage/dao/HashTagRepository.java
Show resolved
Hide resolved
- search 관련 주석 변경 - application-local.properties 가 더 이 상 git 에서 추적되지 않음. Ref: #142
b77b5f2 to
6a9dc00
Compare
|
LGTM |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a9dc00efb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
테스트 개편에 대한 부분이 많습니다. 실제 비지니스 로직 부분은 그리 많지 않습니다.
✨ 구현 기능 명세
그룹 hashTag create
각 그룹 생성 시 hashTag 를 함께 저장할 수 있습니다. 해시태그의 유무는 선택이며, 최대 개수 5개, 각 문자열의 길이는 20 입니다.
이는
HashTag엔티티와GroupHashTag엔티티를 통해 관리합니다.HashTag엔티티는 정규화된 문자열을 기준으로 하여 실제 데이터를 저장하고 있으며 추후 검색을 위해 정규화된 값입니다. 사용자가 해시태그에 대해 검색 시 해당 엔티티를 거칩니다.groupHashTag엔티티는 groupId, hashTagId 뿐만 아니라 실제 hashtag 의 원본을 가지고 있습니다. 이는 실제로 그룹 검색 시 클라이언트에게 보여지는 부분이며, 정규화되기 이전의 값입니다. 대부분, 사용자가 입력한 데이터 원본입니다.현재는 group create 시에만 hashTag 가 같이 저장하는 부분만 구현되어 있습니다.
RetryTx
@Transactional어노테이션의 대체제이며, 실패 시 새로운 트랜잭션을 열어 재시도하는 어노테이션입니다. 자세한 내용은 retryTx 재시도 전략 를 참고해주세요.test 및 build 환경 개편
run/debug configurations에서 VM options 에 다음 두 값을 입력할 수 있습니다.-Dspring.profiles.active,-Dtc.disable이며, 각각local, test,true, false가 올 수 있습니다.전자는 테스트 및 빌드 시 어떤 프로필을 사용할지에 대한 내용이며, 기본 default 에 덮어씌워질 수 있습니다.
후자는
TestContainer활성 여부를 선택하며, false 선택 시 활성화된 profile 로 테스트를 수행할 수 있습니다.local,false조합 사용 시, localhost 로 빌드/테스트를 수행할 수 있습니다.