✨ feat: 프로필 업데이트시 기존 파일 제거 로직 추가 및 버그 개선 #450
Open
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.
📋 작업 내용
업데이트 후 파일 정리 로직 추가
유저 프로필 수정 기능에 더이상 참조되지 않는 파일의 제거를 수행하는 로직을 추가하였습니다.
파일 업로드 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` 매칭 라우터의 정보와 달라 수정하였습니다.📷 스크린 샷(선택 사항)