Skip to content

[#64] [Feat] 문서 버전 삭제 API 및 삭제 후 최신 버전 조회 처리 - #67

Merged
snowballourown merged 2 commits into
feature/42from
feature/64-api
Nov 19, 2026
Merged

snowballourown merged 2 commits into
feature/42from
feature/64-api

Conversation

@snowballourown

Copy link
Copy Markdown
Collaborator

변경 내용

선택한 DocumentVersion을 삭제하는 API를 추가하고,
삭제 후 문서 목록과 최신 PDF 조회가 남은 DocumentVersion을 기준으로 동작하도록 수정했습니다.

삭제 API

DELETE /api/v1/workspaces/{workspaceId}/documents/{documentId}/versions/{documentVersionId}

  • 기존 DocumentVersionDeletionService를 HTTP API에 연결
  • 로그인한 OidcUser의 issuer·subject를 서비스에 전달
  • 세 경로 ID에 양수 검증 적용
  • 로그인 세션과 유효한 CSRF 토큰 필요
  • 성공 시 본문 없는 204와 Cache-Control: no-store 반환

204는 DB 삭제와 S3ObjectDeletionTask 등록 완료를 의미합니다.
실제 S3 파일 삭제는 기존 작업자가 이후 처리합니다.

삭제 후 최신 버전 조회

  • 목록과 최신 PDF 조회에서 남은 최대 DocumentVersion.versionNumber 선택
  • 목록 응답의 revision·변환 상태·버전 개수를 남은 버전에 맞춰 반환
  • 번호 발급을 위한 Document.revision은 유지하여 삭제한 번호 재사용 방지
  • 남은 최신 버전의 PDF가 준비되지 않으면 409 반환
  • 모든 버전 삭제 후에도 Document 유지
    • 목록 응답: revision=0, versionCount=0, conversionStatus=null
    • 버전 히스토리: 빈 배열
    • 최신 PDF URL: 409
  • 삭제한 버전의 PDF·원본 URL 조회는 404 반환

예를 들어 V3 삭제 후에는 V2를 조회하지만,
Document.revision은 3으로 유지하여 다음 업로드에는 V4를 발급합니다.

문서

  • DocumentVersion 삭제 API 설명 추가
  • 버전 조회 및 S3 삭제 작업 문서 갱신

검증

  • 삭제 API 테스트 25개 통과
  • 실제 DELETE 요청 이후 조회 흐름 테스트 8개 통과
  • 문서 목록·기존 문서 조회·버전별 URL 조회 테스트 73개 통과
  • 로그인·CSRF·업로더 권한·경로 ID 검증
  • 다른 회원 및 소속 관계가 다른 경로의 삭제 거부
  • 변환 중인 버전 삭제 거부
  • 삭제 요청의 클라이언트 저장 키·업로더 ID를 사용하지 않음
  • 중복 삭제 시 404이며 S3ObjectDeletionTask 중복 등록 없음
  • 삭제 후 남은 버전 조회와 Document.revision 유지 확인

단계별 검증에 별도 임시 MySQL DB와 모의 S3를 사용했습니다.
실제 S3 파일 삭제와 브라우저 화면은 검증하지 않았습니다.

후속 작업

버전 히스토리에 삭제 버튼·확인창·삭제 후 목록 갱신을 연결합니다.

@snowballourown snowballourown self-assigned this Nov 18, 2026
@snowballourown
snowballourown added this pull request to stack #48 November 18, 2026 23:11
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e16969c2-f414-4b39-ab1f-9f0171a5bba2

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Base automatically changed from feature/64 to feature/42 November 19, 2026 09:28
@sonarqubecloud

Copy link
Copy Markdown

@snowballourown
snowballourown merged commit 3b6c18b into feature/42 Nov 19, 2026
3 checks passed
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.

1 participant