Skip to content

Conversation

@joyewon0705
Copy link
Collaborator

@joyewon0705 joyewon0705 commented Oct 15, 2025

📌 개요

  • 파일 매핑 및 삭제 로직을 AttachmentMappingService로 일원화하여 중복 제거 및 책임 분리

🔨 작업 내용

  1. PostService

    • FileService 제거 및 AttachmentMappingService로 교체
    • 게시글 수정 시, 기존 첨부 중 제외된 파일만 삭제하도록 deleteRemovedAttachments 로직 적용
    • 게시글 삭제 시 attachmentMappingService.deleteAttachments() 사용으로 일관성 확보
  2. AttachmentMappingService

    • 새 메서드 deleteRemovedAttachments() 추가

      • 기존 매핑 중 새 요청 목록에 없는 첨부만 S3·DB에서 삭제
    • 기존 전체 삭제 로직(deleteAttachments)과 분리하여 부분 삭제 가능하도록 개선

  3. AccountService

    • 프로필 이미지 교체 및 삭제 로직을 AttachmentMappingService로 위임
    • 불필요한 중복 메서드(updateProfileImage, removeExistingMapping, isExternalImageUrl) 제거
    • 회원 탈퇴 시 UserProfile 기준으로 프로필 이미지 매핑 삭제 수행
  4. 테스트 코드(PostServiceTest, AccountServiceTest)

    • 실제 S3 호출 방지를 위해 AmazonS3@MockBean 처리
    • AttachmentMappingService는 실제 Bean 주입하여 DB 반영 검증 가능하도록 수정
    • 프로필 매핑 검증 시 userId 대신 userProfile.id 기준으로 조회하도록 수정

🔗 관련 이슈

Closes #{이슈 번호}

📝 참고 사항

✅ 체크리스트

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

@github-actions github-actions bot changed the title Fix: 게시글 및 프로필 파일 관련 로직 보완 Fix: 게시글 및 프로필 파일 관련 로직 보완 (#308) Oct 15, 2025
@joyewon0705 joyewon0705 force-pushed the Fix/308 branch 4 times, most recently from a5464cc to f766630 Compare October 15, 2025 17:08
@joyewon0705 joyewon0705 merged commit d1a3007 into dev Oct 15, 2025
4 checks passed
@github-actions github-actions bot deleted the Fix/308 branch October 15, 2025 17:19
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.

4 participants