T-17 이미지 업로드 (presigned URL) - #71
Open
ff1451 wants to merge 1 commit into
Open
Conversation
- POST /v1/admin/images/presigned-url : ImageAsset를 is_confirmed=false로 먼저 만들고
S3Presigner로 PUT presigned URL을 발급한다(ADR-009, 서버는 바이트를 경유하지 않는다).
- POST /v1/admin/images/{id}/complete : 브라우저의 S3 PUT이 끝난 뒤 호출해 is_confirmed를
true로 바꾼다. 이걸 안 하면 라이브러리에 노출되지 않는다(AC-4.4).
- GET /v1/admin/images?purpose= : confirmed=true만, 최신순 페이지네이션.
- 확장자(png|jpg|jpeg|webp|svg)·5MB 검증은 PresignedUrlRequest의 bean validation으로
끝낸다(AC-4.1, AC-4.2) — 다른 도메인의 @Min/@max 검증과 같은 방식.
- ImageAsset는 image_asset 테이블에 updated_at이 없어 BaseTimeEntity를 쓰지 않고
@CreatedDate만 직접 매핑했다(ActivityImage와 같은 이유). 콘텐츠 테이블과 FK로 묶지
않는다(ADR-009) — 이미지 행 삭제가 콘텐츠를 깨뜨리지 않게.
- S3Properties에 bucket·publicBaseUrl 추가(app.s3.bucket, app.s3.public-base-url).
- 테스트에서 S3Presigner는 @MockitoBean으로 대체했다 — 실제 AWS 자격증명 없이도
presignPutObject() 호출 경로를 검증할 수 있게.
검증: ./gradlew test 전체 통과, 3회 연속.
Author
|
Refs #29 |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
요약
POST /v1/admin/images/presigned-url:ImageAsset를is_confirmed=false로 먼저 만들고 S3 PUT presigned URL을 발급한다(ADR-009 — 서버는 이미지 바이트를 경유하지 않는다).POST /v1/admin/images/{id}/complete: 브라우저의 S3 PUT이 끝난 뒤 호출해is_confirmed를 true로 바꾼다. 호출 전에는 라이브러리에 노출되지 않는다(AC-4.4).GET /v1/admin/images?purpose=: confirmed된 이미지만 최신순 페이지네이션.png|jpg|jpeg|webp|svg)·5MB 검증은PresignedUrlRequest의 bean validation(@Pattern,@Max)으로 끝낸다(AC-4.1, AC-4.2) — 다른 도메인의@Min/@Max검증과 동일한 방식.설계 메모
image_asset은 콘텐츠 테이블과 FK로 묶지 않는다(ADR-009) — 이미지 행을 지워도 콘텐츠가 깨지지 않게.ImageAsset은updated_at컬럼이 없어BaseTimeEntity를 쓰지 않고@CreatedDate만 직접 매핑했다(ActivityImage와 같은 이유).S3Properties에bucket,publicBaseUrl을 추가했다(app.s3.bucket,app.s3.public-base-url, 각각 env var로 오버라이드 가능).S3Presigner를@MockitoBean으로 대체했다 — 실제 AWS 자격증명 없이 presign 호출 경로를 검증한다.S3Config의S3Client/S3Presigner빈은 조건 없이 항상 로드되는데(메일 전송의 SES 빈과 달리), 실제 서명 호출 시점에만 자격증명이 필요해서 그동안은 문제가 없었지만 이번에 실제로 호출하는 코드가 생겨 목이 필요해졌다.검증
./gradlew test전체 통과, 3회 연속.남은 항목
Refs #29 (프로젝트), 브랜치는
feat/t16-activity-public-api(#70) 위에 스택 — T-14~T-16까지 포함된 상태입니다.머지하지 않습니다. 부원 리뷰 후 직접 머지 예정입니다.