generated from DDINGJOO/TEAMBIND_REPO_SETTUP
-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT] 신고 및 제재 시스템 데이터 레이어 구현 #30
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
Merged
Merged
Conversation
This file contains hidden or 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
.github/labeler.yml: 불필요한 빈 줄 제거 및 YAML 구조 개선 참고: 라벨링 대상 파일 경로의 기능적 변화는 없음
SupportServer/src/main/resources/sql/schema.sql: 신고, 제재 및 관련 테이블 생성 쿼리 추가 (카테고리, 신고, 제재, 이력, 통계 포함) 참고: 초기 신고 카테고리 데이터 포함, 추후 통계 집계 활용 예정.
SupportServer/src/main/java/com/teambind/supportserver/report/entity/enums/ActionType.java: 신고 처리 액션 타입 정의 추가 SupportServer/src/main/java/com/teambind/supportserver/report/entity/enums/ReferenceType.java: 신고 대상 타입 정의 추가 SupportServer/src/main/java/com/teambind/supportserver/report/entity/enums/ReportStatus.java: 신고 상태 정의 추가 SupportServer/src/main/java/com/teambind/supportserver/report/entity/enums/SanctionStatus.java: 제재 상태 정의 추가 SupportServer/src/main/java/com/teambind/supportserver/report/entity/enums/SanctionType.java: 제재 타입 정의 추가
SupportServer/src/main/java/com/teambind/supportserver/report/entity/Report.java: 신고 엔티티 정의 및 주요 필드와 메서드 추가 SupportServer/src/main/java/com/teambind/supportserver/report/entity/ReportCategory.java: 신고 카테고리 엔티티 정의 및 생성 메서드 추가 SupportServer/src/main/java/com/teambind/supportserver/report/entity/embeddable/ReportCategoryId.java: 신고 카테고리 복합키 정의 및 equals/hashCode 오버라이드 .idea/inspectionProfiles/Project_Default.xml: SQL DataSource 관련 경고 비활성화 설정 추가
SupportServer/src/main/java/com/teambind/supportserver/report/entity/ReportHistory.java: 신고 처리 이력 엔티티 정의 및 관련 필드, 메서드 추가 참고: 신고 처리 상태 변경 내역 추적 기능 구현 준비
SupportServer/src/main/java/com/teambind/supportserver/report/entity/ReportStatistics.java: 신고 통계 집계 엔티티 정의 및 신고 횟수 증가, 초기화 메서드 추가 SupportServer/src/main/java/com/teambind/supportserver/report/entity/Sanction.java: 제재 엔티티 정의 및 제재 상태 변경 메서드 추가 (취소, 만료 처리 등) SupportServer/src/main/java/com/teambind/supportserver/report/entity/SanctionRule.java: 제재 규칙 엔티티 정의 및 활성화/비활성화 메서드 추가 참고: 신고 통계 집계 및 제재 자동화를 위한 구조 기반 마련
SupportServer/src/main/java/com/teambind/supportserver/report/entity/ReportHistory.java: 신고 처리 이력에 여러 상태 생성 메서드 추가 (검토 완료, 제재 적용 등) SupportServer/src/main/java/com/teambind/supportserver/report/entity/Sanction.java: 제재 엔티티에 상태 확인 및 설정 메서드 추가 (영구 여부, 남은 일수 계산 등) SupportServer/src/main/java/com/teambind/supportserver/report/entity/Report.java: 신고 엔티티에 비즈니스 로직 및 상태 변경 관련 메서드 추가 (승인, 거부, 철회 등) 참고: 신고 및 제재 상태 관리 로직 개선 및 확장.
SupportServer/src/main/java/com/teambind/supportserver/report/repository/ReportCategoryRepository.java: 신고 카테고리 리포지토리 클래스 추가 SupportServer/src/main/java/com/teambind/supportserver/report/repository/ReportHistoryRepository.java: 신고 처리 이력 리포지토리 클래스 추가 SupportServer/src/main/java/com/teambind/supportserver/report/repository/ReportRepository.java: 신고 리포지토리 클래스 추가 SupportServer/src/main/java/com/teambind/supportserver/report/repository/ReportStatisticsRepository.java: 신고 통계 집계 리포지토리 클래스 추가 SupportServer/src/main/java/com/teambind/supportserver/report/repository/SanctionRepository.java: 제재 리포지토리 클래스 추가 SupportServer/src/main/java/com/teambind/supportserver/report/repository/SanctionRuleRepository.java: 제재 규칙 리포지토리 클래스 추가 참고: 신고 및 제재 관리 데이터 접근 계층 구조 완성.
SupportServer/.env: Redis 및 Kafka 환경 변수 업데이트, 불필요 변수 제거 SupportServer/src/main/java/com/teambind/supportserver/report/entity/embeddable/ReportCategoryId.java: 필드에 @column 어노테이션 추가 SupportServer/src/main/resources/application-dev.yaml: dev 프로파일 포트 변경 및 ddl-auto 설정 업데이트 SupportServer/src/main/resources/sql/schema.sql: DB 테이블 스키마 수정 - 외래 키 순서 변경 및 제약 조건 정리 SupportServer/build.gradle: 불필요한 Kafka 디펜던시 제거 참고: ddl-auto 설정 변경으로 초기 데이터베이스 테스트 준비 필요.
.idea/dataSources.xml: IntelliJ DataSource 설정 파일 추가 (버전 관리에서 제외 필요) .idea/data_source_mapping.xml: IntelliJ DataSource 관련 매핑 파일 추가 (버전 관리에서 제외 필요) SupportServer/.gitignore: .env 파일 제외 패턴 개선 (모든 디렉토리 .env 파일 제외) 참고: IntelliJ 환경 설정 파일 자동 생성 방지 필요.
SupportServer/src/main/resources/sql/schema.sql: `report` 테이블의 기존 유니크 키에 `status` 컬럼 추가 참고: 상태별 신고 관리 로직 대비.
SupportServer/build.gradle: 테스트 환경을 위한 H2 데이터베이스 디펜던시 추가 SupportServer/src/main/java/com/teambind/supportserver/report/entity/ReportHistory.java: 상태 컬럼 nullable 속성 수정 및 @nullable 어노테이션 추가 SupportServer/src/main/java/com/teambind/supportserver/report/entity/Report.java: `report` 테이블 유니크 제약 조건에 `status` 컬럼 포함 참고: 테스트 환경 지원 및 상태 관리 유연성 개선.
SupportServer/src/test/resources/application-test.yaml: H2 메모리 DB 및 JPA 설정 포함한 테스트 프로파일 구성 추가 참고: 테스트 환경 격리 및 주요 DB 동작 검증을 위해 추가.
SupportServer/src/test/java/com/teambind/supportserver/report/entity/ReportEntityTest.java: Report 엔티티 상태 변경 및 생성 관련 단위 테스트 추가 참고: Report 엔티티의 안정성 검증 및 주요 비즈니스 로직 확인.
SupportServer/src/test/java/com/teambind/supportserver/report/entity/ReportCategoryEntityTest.java: ReportCategory 관련 생성 및 다양한 ReferenceType 검증 테스트 추가 참고: ReportCategory 엔티티의 주요 동작 및 상태 안정성 검증
SupportServer/src/test/java/com/teambind/supportserver/report/entity/ReportHistoryEntityTest.java: ReportHistory 엔티티 관련 생성 및 다양한 액션 타입 테스트 추가 참고: 주요 상태 변경 및 이력 생성 로직에 대한 검증 포함.
SupportServer/src/test/java/com/teambind/supportserver/report/entity/ReportStatisticsEntityTest.java: ReportStatistics 엔티티 관련 생성과 주요 동작(신고 횟수 증가 및 초기화 등) 테스트 추가 참고: 다양한 ReferenceType 및 카테고리별 처리 로직 포함.
SupportServer/src/test/java/com/teambind/supportserver/report/entity/SanctionEntityTest.java: Sanction 엔티티 생성, 상태 변경, 만료 처리 및 주요 동작 테스트 추가 참고: isActive, isExpired 등 상태 기반 메서드의 동작 검증 포함.
SupportServer/src/test/java/com/teambind/supportserver/report/entity/SanctionRuleEntityTest.java: SanctionRule 엔티티 생성, 활성화/비활성화, 규칙 생성 및 주요 동작 테스트 추가 참고: 다양한 ReferenceType, SanctionType 및 기간(duration) 관련 로직 검증 포함.
SupportServer/src/test/java/com/teambind/supportserver/report/repository/ReportRepositoryTest.java: ReportRepository에 대한 CRUD, 상태 변경, 연관 관계 및 기타 주요 동작 통합 테스트 추가 참고: 다양한 ReportStatus 및 카테고리 연관 데이터 처리 검증 포함.
SupportServer/src/test/java/com/teambind/supportserver/report/repository/ReportCategoryRepositoryTest.java: ReportCategoryRepository의 CRUD 동작, 복합키 처리, 대량 데이터 처리, 카테고리명 대소문자 구분 등 주요 동작 테스트 추가 참고: 다양한 ReferenceType 및 복합키 관련 주요 로직 검증 포함.
SupportServer/src/test/java/com/teambind/supportserver/report/repository/ReportHistoryRepositoryTest.java: ReportHistoryRepository의 CRUD, 상태 변경, 다양한 ActionType 저장/조회, PrePersist 등 주요 동작 테스트 추가 참고: 대량 데이터 처리, 다양한 연관 관계 및 워크플로우 검증 포함.
SupportServer/src/test/java/com/teambind/supportserver/report/repository/ReportStatisticsRepositoryTest.java: ReportStatisticsRepository의 CRUD, 신고 횟수 증가/초기화, 대량 데이터 처리, 다양한 ReferenceType 테스트 추가 SupportServer/src/test/java/com/teambind/supportserver/report/repository/SanctionRepositoryTest.java: SanctionRepository에 대한 CRUD, 제재 상태/타입 저장 및 조회, 연관 관계, PrePersist 등 주요 동작 테스트 추가 참고: 다양한 ReferenceType 및 연관 관계 데이터를 다루는 주요 로직 검증 포함.
docs/image/img.png: 프로젝트 리소스로 사용할 이미지 파일 추가
Owner
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
신고 및 제재 시스템의 데이터 레이어를 구현했습니다. 엔티티 설계 시 상속 구조와 속성 추가 방식을 비교 검토한 결과, 현재 비즈니스 요구사항에는 속성 추가 방식이 더 적합하다고 판단하여 이를 채택했습니다.
주요 구현 사항
1. 엔티티 설계
2. 엔티티 설계 고민사항
상속 vs 속성 추가 검토
초기에는
Report엔티티를ProfileReport,ArticleReport등으로 상속 구조로 설계할지 고민했습니다.상속 구조의 장점:
상속 구조의 단점:
최종 결정: 속성 추가 방식 채택
현재 비즈니스 요구사항을 분석한 결과 다음과 같은 이유로 속성 추가 방식을 선택했습니다:
referenceType과reportedId를 통해 다형성 구현 가능3. 주요 기술적 특징
@EmbeddedId) 활용으로 카테고리 관리 최적화4. 리포지토리 계층
ReportRepository: 신고 조회 및 통계 쿼리ReportCategoryRepository: 카테고리 관리ReportHistoryRepository: 이력 관리SanctionRepository: 제재 조회 및 관리ReportStatisticsRepository: 통계 데이터 집계5. 테스트 커버리지
단위 테스트 (100% 커버리지)
Report엔티티: 상태 변경, 제재 적용/거부/철회 로직 테스트Sanction엔티티: 제재 활성화/만료/취소 로직 및 남은 기간 계산 테스트ReportHistory팩토리 메서드 테스트ReportStatistics집계 로직 테스트통합 테스트 (리포지토리 레이어)
ReportRepository: 복잡한 통계 쿼리 및 다중 조건 조회 검증ReportCategoryRepository: 복합키 기반 CRUD 검증ReportHistoryRepository: 이력 조회 및 저장 검증SanctionRepository: 제재 조회 및 만료 처리 검증ReportStatisticsRepository: 집계 데이터 정합성 검증테스트 환경
application-test.yaml을 통한 테스트 전용 설정 분리Test Plan
Closes #14