Skip to content

Comments

refactor: 이미지 업로드 로직 리팩토링#244

Merged
yongjun0511 merged 16 commits intodevelopfrom
refactor/#232-image-upload
Nov 1, 2025
Merged

refactor: 이미지 업로드 로직 리팩토링#244
yongjun0511 merged 16 commits intodevelopfrom
refactor/#232-image-upload

Conversation

@yongjun0511
Copy link
Collaborator

@yongjun0511 yongjun0511 commented Oct 31, 2025

🌱 관련 이슈


📌 작업 내용 및 특이사항

다음과 같은 API들이 수정되고 생성되었습니다.

<수정 사항>

앨범 이미지 업로드 PresignedUrl 발급 API & 임시 앨범 이미지 업로드 PresignedUrl 발급 API

  • 더 이상 바로 이미지 엔티티를 생성하지 않습니다.
  • 대신 presignedUrl을 발급할 경우 status 태그에 pending을 붙여서 발급합니다.

S3에 status=pending인 사진들은 하루에 한번씩 청소되도록 규칙을 추가했습니다.
(이런 방법을 통해 pending 상태의 사진이 사용자들에게 노출될 일도 없고 별도의 Cleaner를 만들지 않도록 했습니다)

스크린샷 2025-10-31 오후 5 43 56

<추가 사항>
앨범 이미지 업로드 검증 API & 임시 앨범 이미지 업로드 검증 API

  • S3에 사진이 업로드 된 것을 검증합니다.
  • Pending 태그를 complete로 바꿔줍니다.
  • 이미지 엔티티를 생성합니다.

따라서, 검증을 완료하지 않은 이미지들은 엔티티로 생성될 수 없는 구조입니다.
검증 단계에서는 발급 단계에서 진행했던 validation을 중복으로 수행하지는 않습니다.

@yongjun0511 yongjun0511 requested a review from ht3064 as a code owner October 31, 2025 08:37
@yongjun0511 yongjun0511 linked an issue Oct 31, 2025 that may be closed by this pull request
@yongjun0511 yongjun0511 self-assigned this Oct 31, 2025
import java.util.List;

public record AlbumImagesConfirmResponse(
@Schema(description = "로컬 사진 삭제 허용 여부") Boolean localImageDeletion,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이미 검증을 마치고 업로드하는 부분이니 다음 응답 필드는 빼도 될 것 같아요.
로컬 사진 삭제 허용 여부는 클라이언트에서 검증 API 호출 전에 확인하는게 맞아보입니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

별도로 확인하는 API를 만들자는 말씀인가요?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

회원 정보 조회로 로컬 사진 삭제 허용 여부를 확인할 수 있어서 해당 API 응답에는 불필요해 보인다고 말씀드린겁니다!
업로드 완료 처리 후보다는 완료 전에 허용 여부를 확인하는 게 더 자연스러울 것 같아서요

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 1, 2025

Copy link
Collaborator

@ht3064 ht3064 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다!

@yongjun0511 yongjun0511 merged commit ce568fe into develop Nov 1, 2025
2 checks passed
@yongjun0511 yongjun0511 deleted the refactor/#232-image-upload branch November 1, 2025 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

♻️ 이미지 업로드 로직 수정

2 participants