Skip to content

Conversation

@joyewon0705
Copy link
Collaborator

@joyewon0705 joyewon0705 commented Oct 15, 2025

📌 개요

  • 게시글 파일 첨부 중 삭제 기능 개선
  • 프로필 이미지 교체 및 삭제 기능 추가

🔨 작업 내용

  1. 파일 매핑 구조 개선

    • AttachmentMappingFileAttachment 간의 양방향 연관관계 수정
      AttachmentMapping@JoinColumn(name = "attachment_id")을 가지도록 변경
      FileAttachment에서는 mappedBy = "fileAttachment"로 관계 정리
    • 불필요한 mappedBy 및 컬럼명 혼동 문제 해결
  2. Repository 기능 확장

    • AttachmentMappingRepositoryfindByEntityTypeAndEntityId() 추가
    • FileAttachmentRepositoryfindByPublicURL() 추가
  3. AccountService 리팩토링 및 프로필 이미지 관리 로직 추가

    • 프로필 업데이트 시 기존 이미지(S3 + FileAttachment + Mapping) 삭제 후 새 매핑 생성
    • updateProfileImage()deleteProfileImage() 메서드 추가
    • FileService를 주입받아 실제 S3 파일 삭제 처리 수행
    • 유저 탈퇴 시 프로필 이미지 및 매핑 자동 삭제 처리 추가
  4. 테스트 코드 개선

    • @MockBean FileService 적용으로 S3 외부 호출 방지
    • 파일 매핑 관련 테스트(AccountServiceTest, AccountControllerTest) 추가
    • 기존 프로필 이미지 삭제 및 새 이미지 매핑 검증 로직 강화
    • 게시글 및 계정 관련 테스트에서 파일 관련 예외 방지 처리
  5. DTO 및 Controller 일관성 정리

    • UpdateUserProfileRequestUserProfileRequest로 통합 및 네이밍 정리
    • 관련 컨트롤러 및 테스트에서 참조 타입 전면 수정

🔗 관련 이슈

Closes #285

📝 참고 사항

  • 추후 File 관련 개선이 완료되면 개할 예정입니다.

✅ 체크리스트

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

@github-actions github-actions bot changed the title Feat: 게시글 파일 첨부 및 프로필 이미지 매핑 기능 추가 Feat: 게시글 파일 첨부 및 프로필 이미지 매핑 기능 추가 (#285) Oct 15, 2025
@joyewon0705 joyewon0705 merged commit 08ea0b1 into dev Oct 15, 2025
4 checks passed
@github-actions github-actions bot deleted the Feat/285 branch October 15, 2025 01:31
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.

5 participants