Skip to content

✨ feat: 프로필 업데이트시 기존 파일 제거 로직 추가 및 버그 개선 #450

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

asn6878
Copy link
Member

@asn6878 asn6878 commented Aug 11, 2025

📋 작업 내용

업데이트 후 파일 정리 로직 추가

유저 프로필 수정 기능에 더이상 참조되지 않는 파일의 제거를 수행하는 로직을 추가하였습니다.

파일 업로드 API 엔드 포인트 변경

파일 업로드시 파일 타입을 전달받는 방법을 쿼리파라미터로 확정지었습니다. 이에 따라 파일 업로드의 엔드포인트도 /file/profile 에서 file?uploadType=PROFILE_IMAGE 형태로 변경되었고, 기존에 존재하던 주석 및 기본값들을 제거 하였습니다.

Important

파일 타입에 대한 유효성 검사가 왜 dto가 아닌 diskStorage.ts에서 수행되나요?

NestJS에서 요청 처리 순서는 다음과 같습니다.
Middleware -> Guards -> Interceptor -> Multer -> Pipes -> Controller -> Interceptors

여기서 diskStorage.ts 에서 파일 타입이 미리 추론이 되지 않으면 비즈니스 로직에 문제가 생기기에 Pipes(DTO) 레벨에서 유효성 검사를 수행할 수 없습니다.

nginx 정적 파일 경로 수정

어떠한 이미지를 저장하면 파일이 저장되는 서버 내 경로는 다음과 같습니다.
"var/web05-Denamu/objects/PROFILE_IMAGE/20250816/f4cbc239-6beb-453d-9ab4-bc0aa59e96e9.png", 이러한 파일 경로가 nginx objects` 매칭 라우터의 정보와 달라 수정하였습니다.

📷 스크린 샷(선택 사항)

image 로컬환경에서 테스트 실행한 응답 예시 입니다.

@asn6878 asn6878 self-assigned this Aug 11, 2025
@asn6878 asn6878 added the ✨ Feature 기능 구현 label Aug 11, 2025
@asn6878 asn6878 changed the title ✨ feat: 프로필 업데이트시 기존 파일 제거 로직 추가 ✨ feat: 프로필 업데이트시 기존 파일 제거 로직 추가 및 버그 개선 Aug 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 구현
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant