Skip to content

Conversation

@joyewon0705
Copy link
Collaborator

📌 개요

  • PostService 내부 로직을 리팩토링하여 카테고리 매핑첨부파일 매핑을 각각 전담 서비스로 분리
  • 게시글-카테고리 간 매핑을 관리하는 PostCategoryMappingService 신규 추가
  • DevInitService, PostControllerTest, PostServiceTest, PostRepositoryImplTest 등 관련 테스트 수정

🔨 작업 내용

  1. PostService 리팩토링

    • PostCategoryMappingService를 통해 카테고리 검증 및 매핑 관리
    • AttachmentMappingService로 첨부파일 생성/갱신/삭제 로직 통합
    • updateCategories, validateAndFindCategories, validateAndFindAttachments 제거
  2. PostCategoryMappingService 추가

    • createMappings(), updateMappings(), deleteMappings() 구현
    • 기존 매핑 삭제, 신규 매핑 추가, 전체 제거 등 세부 동작 분리
    • 잘못된 ID 전달 시 CATEGORY_NOT_FOUND 예외 처리
  3. AttachmentMappingService 개선

    • createAttachments(), updateAttachments(), deleteAttachmentsByIds() 추가
    • 업로더 검증(FILE_ACCESS_DENIED) 강화
    • 기존 매핑과 새 매핑의 차이를 비교하여 효율적인 갱신 처리
    • @EntityGraph를 활용해 N+1 쿼리 최소화
  4. DevInitService 개선

    • EntityManager 의존성 제거
    • attachCategories() 내부에서 PostCategoryMappingService 사용
  5. 테스트 코드 수정 및 보강

    • PostRepositoryImplTest, PostControllerTest, PostServiceTest 등에서
      기존 post.updateCategories() 호출 제거 후 postCategoryMappingService.createMappings()로 대체
    • AttachmentMappingServiceTest에 신규 단위 테스트 추가
      • createAttachments_success
      • updateAttachments_success
      • deleteAttachmentsByIds_success
    • 정렬 테스트(createdAt DESC) 안정화를 위해 Thread.sleep() 기반 시간 간격 부여
    • 순서 단정 테스트를 포함 검증(contains) 방식으로 변경하여 안정성 확보

🔗 관련 이슈

Closes #298

📝 참고 사항

✅ 체크리스트

  • 기능 동작 확인
  • 테스트 코드 작성
  • 문서/주석 추가 및 최신화

@github-actions github-actions bot changed the title Refactor: PostService 구조 개선 및 매핑 로직 분리 Refactor: PostService 구조 개선 및 매핑 로직 분리 (#298) Oct 23, 2025
@joyewon0705 joyewon0705 merged commit 07a95d3 into dev Oct 24, 2025
3 checks passed
@github-actions github-actions bot deleted the Refactor/298 branch October 24, 2025 00:05
namgigun added a commit that referenced this pull request Oct 30, 2025
* Hotfix/loseminho : terminated 상태 조회 제거 (#314)

* refactor: 스더티룸 권한에 대한 로직 개선

* fix: ci에서 통과 못한 테스트코드 수정

* fix:rest api와 웹소켓 중간 경로 통합

* fix:rest api와 웹소켓 중간 경로 통합

* fix: 에러 확인을 위한 통합테스트 추가, Room.create()메서드 수정

* refactor, feat
: 조회 분할

* refactor: redis 로직 최적화 및 중복 검증 로직 제거

* fix: 에러 번호 수정

* feat: 스터디룸 방 비밀번호 변경 및 삭제 기능 구현

* fix:app-dev 제거

* feat: 웹소켓 기반 소극적 하트비트

* feat: 스터디룸 썸네일 기능 추가 및 webrtc 설정 변경에서 주석처리

* fix:소극적 하트비트 사용 주석처리

* Feat: 스터디 룸 내에 고양이 아바타 시스템과 프로필 이미지 url 연동

* fix: 기존 작성되어있던 test 코드 수정

* test: 아바타 테스트 코드 완료

* refactor: 프론트엔드 요청 사항에 따른 스터디룸 조회 마스킹 제거

* feat: 스터디룸 방 초대 코드 시스템

* Infra: main branch 로컬 환경과 운영 환경 동기화

* Infra: docker-compose 파일 수정

- Redis 버전 업그레이드
기존: 6.2 -> 변경: 7.0

* Fix: 백엔드 CD 파일 수정

- 자동화 시, 잘못된 도메인으로 호스트 ID 검증하는 오류 해결

* Infra: EC2 환경변수 수정

- 잘못 표기한 도메인 네임 변경

* Chore: CD 파일 수정

- Github Actions commandLine 인식 문제로 인해 set -Eeuo pipefail 줄바꿈

* Chore: 백엔드 CD 파일 수정

- 인스턴스 ID 체크 삭제

* Infra: 백엔드 CD 파일 수정

- .env 파일 추가시, $DOT_ENV_PROD -> $DOT_ENV 로 변경

* Infra: 도커 컴포즈 수정

- mysql 사용자 정보 변경

* Infra: 운영환경 설정

- application-prod.yml 과 application.yml 동기화

* Fix: SecurityConfig 수정

- H2 DB 허용 X

* test,fix: 방 초대에 대한 테스트 코드 작성 및 에러 수정

* fix: 스터디룸 파일 업로드 맵핑 형식으로 변환

* fix: 병합충돌 제어 수정

* fix: 병합충돌 제어

* fix: 스터디 룸 내 프론트엔드 요구 사항 및 오류사항 수정

* feat: 방 즐겨찾기, 방 공지사항 구현

* fix: mockbean 수정

* fix: 테스트에서 빠진 비로그인 사용자 추가

* hotfix: 누락된 사용자 추방에 대한 컨트롤러 추가

* hotfix: VISITOR도 추방 가능하도록 수정

* fix: 누락된 테스트코드 추가 및 테스트코드 로직 수정

* refactor: 아바타 시스템 db와 분리 및 테스트 코드 수정

* fix: 턴서버 dev에 맞춤

* hotfix: 추방 후 추방당한 유저에게 개인 메시지 전송 로직 추가

* fix: 웹소켓 메세지 전송

* fix: 병합 오류 제어

* test: 테스트코드 수정

* refactor: 스터디룸 파일 업로드 s3 + fileAttachment + Mapping 제거 방식으로 수정

* feat: 방 내 방명록 기능 추가

* hotfix:로젝 내 웹소켓 세션 제거

* hotfix: 방 조회 시 terminated 상태는 조회 안되도록

---------

Co-authored-by: namgigun <[email protected]>

* Refactor: PostService 구조 개선 및 매핑 로직 분리 (#298) (#316)

* Ref: PostService 개선

* Test: 테스트 작성

* Infra: 기존 AWS 계정 → 신규 계정 리소스 마이그레이션

* Infra: RDS 설정 변경

- db 관련정보 하드 코딩 -> 변수화

* Infra: S3 인스턴스 설정 변경

S3 버킷명 변경
- team5-s3-1 -> catfe-s3-1

---------

Co-authored-by: loseminho <[email protected]>
Co-authored-by: joyewon0705 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants