Skip to content

feat(configuration): 파일 도메인 모델 및 규칙 정의 #26 - #56

Open
tlgms wants to merge 5 commits into
developfrom
feat(document)-파일-도메인-모델-#26

Hidden character warning

The head ref may contain hidden characters: "feat(document)-\ud30c\uc77c-\ub3c4\uba54\uc778-\ubaa8\ub378-#26"
Open

feat(configuration): 파일 도메인 모델 및 규칙 정의 #26#56
tlgms wants to merge 5 commits into
developfrom
feat(document)-파일-도메인-모델-#26

Conversation

@tlgms

@tlgms tlgms commented Jul 27, 2026

Copy link
Copy Markdown

스택 PR 1/4 — base: develop
이후 PR은 이 브랜치를 base로 합니다. 순서대로 머지해 주세요.

Summary

  • Document 파일 처리의 도메인 모델과 형식·용량·파일명 규칙을 정의합니다.
  • Spring / AWS / JPA에 의존하지 않는 순수 Kotlin 모듈입니다 (deps.bzl은 비어 있는 상태 유지).

Related Issue

Scope

  • In scope: configuration-domainhs.kr.entrydsm.configuration.domain.document 패키지
  • Out of scope: 어댑터 구현, REST / gRPC 노출, 트랜잭션 처리

Implementation

API 11종은 허용 확장자·용량 한도·object_key 명명 규칙이 API마다 다릅니다. 이 규칙이 컨트롤러나 어댑터에 흩어지면 원서 슬롯에 이미지가 올라가는 식의 사고를 막을 수 없어 도메인에 모았습니다.

  • FileExtension — 확장자↔MIME 매핑. jpegjpg 별칭으로 처리
  • FileCategory — 용도별 object_key prefix, 허용 확장자 집합, 최대 용량. 전역 화이트리스트 하나로 두면 카테고리별 제한이 불가능해 카테고리가 자기 허용 집합을 갖습니다
  • FileNaming — 명세 응답 예시와 동일한 파일명 생성(application_1001.pdf, photo_5f3c9a2b.jpg 등) + 경로 조작 방어
  • 예외 6종 — 명세 에러 코드와 1:1 (INVALID_FILE_FORMAT, FILE_TOO_LARGE, FILE_NOT_FOUND, STORAGE_UPLOAD_FAILED, PRESIGN_FAILED)
  • 포트port/in 3종, port/out 2종. 참조 구현(EnvironmentVariable)과 동일하게 -application이 아니라 -domain에 둡니다

#7 지원자 목록 excel 다운fileName이 그대로 S3 키에 붙으므로 requireSafeFileName으로 경로 구분자·상위 경로 참조를 거부합니다.

Testing

  • Unit tests — 도메인 규칙 테스트 12개 (확장자 인식, 카테고리별 허용/용량, 명세와 동일한 파일명 생성, 경로 조작 거부)
  • Integration tests
  • Manual verification
bazel test //systems/configuration/...

Deployment Notes

  • Feature flag: 없음
  • Migration required: 없음 (이 PR 범위 한정)
  • Rollout considerations: 도메인 모듈만 추가되며 기존 동작에 영향 없음

Checklist

  • Matches product/tech requirements
  • Backward compatibility considered
  • Docs updated if applicable

리뷰 시 봐주셨으면 하는 것

  1. 용량 한도가 임의값입니다 — 명세에 수치가 없어 문서 10MB / 사진 5MB / 첨부 20MB로 정했습니다. 팀 기준이 있으면 알려주세요.
  2. .hwp MIME — 표준이 없어 application/x-hwp로 고정했습니다.
  3. BUILD.bazel 수정 포함 — 기존 test 타깃이 :main에 의존하지 않아 도메인 클래스를 참조하는 테스트가 컴파일되지 않았습니다. 함께 고쳤습니다. kt_jvm_testtest_class를 하나만 받아 document_test 타깃을 별도로 추가했습니다.
  4. 파일이 21개지만 예외·포트가 4~11줄짜리라 실질 리뷰량은 크지 않습니다.

tlgms and others added 5 commits July 27, 2026 20:36
- FileExtension: 확장자↔MIME 매핑, jpeg 별칭 허용
- FileCategory: 용도별 object_key prefix, 허용 확장자, 최대 용량
- FileDocument: files 테이블 대응 도메인 모델

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
명세의 에러 코드에 1:1 대응하는 예외를 추가한다.
INVALID_FILE_FORMAT, FILE_TOO_LARGE, FILE_NOT_FOUND,
STORAGE_UPLOAD_FAILED, PRESIGN_FAILED 및 키 조작 방어용 예외.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
- port/in: UploadFileUseCase, IssueDownloadUrlUseCase, ReadFileUseCase
- port/out: StoragePort(S3), FileDocumentRepository(files)
- DownloadUrl, StoredObject 값 객체와 커맨드 추가

바이너리는 커맨드가 아니라 InputStream 파라미터로 분리해 커맨드의 값 의미를 유지한다.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
명세 응답 예시(application_1001.pdf, photo_5f3c9a2b.jpg 등)에 맞는
파일명 생성 규칙을 도메인에 둔다.

경로 구분자, 상위 경로 참조, 허용 외 문자를 걸러 object_key 조작을 막는다.
지원자 목록 excel 다운로드는 fileName이 그대로 키에 붙으므로
requireSafeFileName으로 거부한다.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
확장자 인식, 카테고리별 허용 형식/용량, 명세 예시와 동일한 파일명 생성,
경로 조작 거부를 검증한다.

기존 test 타깃이 :main에 의존하지 않아 도메인 클래스를 참조하는 테스트가
컴파일되지 않던 문제를 함께 수정한다.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ready-for-review
🚫 Excluded labels (none allowed) (2)
  • wip
  • do-not-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f604da3e-ae74-419d-9aeb-16d7d258eaef

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat(document)-파일-도메인-모델-#26
  • 🛠️ cleanup stale imports
  • 🛠️ harden error messages
  • 🛠️ test clarity pass

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tlgms
tlgms requested review from kusuri12-09 and wlyoon921 July 27, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant