feat(configuration): S3 및 files 테이블 어댑터와 유스케이스 구현 #26 - #57
Open
tlgms wants to merge 4 commits into
Hidden character warning
The head ref may contain hidden characters: "feat(document)-\ud30c\uc77c-\uc800\uc7a5\uc18c-\uc5b4\ub311\ud130-#26"
Open
Conversation
One-Version Rule에 따라 kotlin.MODULE.bazel에 버전을 고정하고 configuration-adapter-out에서만 S3를 참조한다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ERD의 files 스키마에 대응하는 JPA 엔티티와 FileDocumentRepository 아웃바운드 포트 구현을 추가한다. object_key에 유니크 제약을 둔다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
StoragePort를 AWS SDK v2로 구현한다. 업로드 시 SHA-256 체크섬을 받아 files 메타데이터에 남기고, 다운로드는 presigned URL로 발급한다. SdkException을 STORAGE_UPLOAD_FAILED / PRESIGN_FAILED 도메인 예외로 변환해 어댑터 밖으로 AWS 타입이 새지 않게 한다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
FileDocumentService가 UploadFileUseCase, IssueDownloadUrlUseCase, ReadFileUseCase를 구현한다. 검증(형식/용량) → S3 업로드 → 메타데이터 저장 순서를 지키고, 메타데이터 저장이 실패하면 업로드된 객체를 보상 삭제한다. 보상 삭제 실패는 로깅만 하고 원래 예외를 덮지 않는다. 파일명은 API마다 결정 방식이 달라 커맨드의 fileName을 필수로 바꾸고 컨트롤러가 결정하도록 한다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
🚫 Excluded labels (none allowed) (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
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.
Summary
StoragePort를 AWS S3로,FileDocumentRepository를 JPA로 구현합니다.FileDocumentService유스케이스를 추가합니다.Related Issue
Scope
configuration-adapter-out,configuration-application,kotlin.MODULE.bazelImplementation
바이너리는 S3에, 메타데이터는 DB(
files)에 둡니다. 응답으로 바이너리를 스트리밍하지 않고 presigned URL을 반환해 서버 부하를 줄입니다.어댑터
S3StorageAdapter— 업로드 시 SHA-256 체크섬 수신, presigned URL 발급, 존재 확인, 삭제S3Config—S3Client/S3Presigner빈. 자격증명은 기본 provider chainFileDocumentJpaEntity/JpaRepository/PersistenceAdapter— ERDfiles스키마 대응,object_key에 유니크 제약SdkException을STORAGE_UPLOAD_FAILED/PRESIGN_FAILED도메인 예외로 변환해 AWS 타입이 어댑터 밖으로 새지 않게 합니다유스케이스 — 순서가 핵심입니다
S3 업로드는 DB 트랜잭션에 참여하지 않습니다. 순서를 잘못 잡으면 검증 실패인데 S3를 호출하거나, 메타데이터 없이 객체만 남습니다.
보상 삭제가 또 실패하면 로깅만 하고 원래 예외를 덮지 않습니다. 삭제 실패로 진짜 원인을 가리지 않기 위해서입니다.
Testing
컴파일과 기존 테스트 통과만 확인했습니다.
S3StorageAdapter는 실제 S3에 대해 검증되지 않았습니다.Deployment Notes
files테이블이 필요합니다.ddl-auto: validate이므로 없으면 기동 실패합니다. DDL은 PR 4에 포함되어 있습니다S3_BUCKET,AWS_REGION환경변수 주입 필요 (PR 4)Checklist
리뷰 시 봐주셨으면 하는 것
RequestBody.fromInputStream+checksumAlgorithm(SHA256)조합 — 스트리밍 체크섬이 실제로 동작하는지 목으로는 확인이 안 됩니다. 통합 테스트를 후속 이슈로 잡아두었습니다. 체크섬이 null이면 eTag로 폴백합니다.2.31.0— One-Version Rule에 따라kotlin.MODULE.bazel에만 기재했습니다. 팀에서 쓰는 버전이 따로 있으면 알려주세요.