Merged
Conversation
There was a problem hiding this comment.
Pull request overview
문서 삭제 정책을 hard delete(기본 DELETE)와 휴지통 이동(PATCH /trash)로 분리하고, 휴지통 복구 만료(5분) 및 자동 영구 삭제 스케줄러/조회 API까지 추가하는 변경입니다. 문서/블록/하위 문서의 수명주기를 일관되게 맞추면서, 휴지통 UX를 위한 조회 및 제목 유니크 정책도 함께 도입합니다.
Changes:
DELETE /v1/documents/{documentId}를 hard delete로 전환하고,PATCH /v1/documents/{documentId}/trash및 휴지통 조회 API를 추가- 휴지통 복구 가능 시간(현재 테스트 기준 5분) 검증 및 만료 문서 자동 purge 스케줄러 추가
- 워크스페이스 내 문서 title 유니크 정책을 create/update/restore에 적용하고 테스트/문서 갱신
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| prompts/2026-03-25-document-trash-and-hard-delete.md | 변경 단계/테스트 실행 기록 문서 추가 |
| documents-infrastructure/src/test/java/com/documents/service/DocumentServiceImplTest.java | hard delete/휴지통 이동/복구 만료/purge/title 유니크 관련 서비스 테스트 보강 |
| documents-infrastructure/src/main/java/com/documents/service/DocumentServiceImpl.java | hard delete 전환, trash/restore 만료 검증, purge 로직, title 유니크 검증 추가 |
| documents-infrastructure/src/main/java/com/documents/repository/DocumentRepository.java | 휴지통 목록/만료 trash root 조회 쿼리 및 title 중복 체크 메서드 추가 |
| documents-core/src/main/java/com/documents/service/DocumentService.java | getTrash/trash/purgeExpiredTrash API 추가 |
| documents-core/src/main/java/com/documents/domain/DocumentTrashPolicy.java | 휴지통 보관 시간(5분) 정책 상수 추가 |
| documents-boot/src/test/java/com/documents/api/document/DocumentApiIntegrationTest.java | 휴지통 조회/삭제 정책/휴지통 이동/복구 만료/purge/title 유니크 통합 테스트 보강 |
| documents-boot/src/main/java/com/documents/DocumentTrashPurgeScheduler.java | 1분 fixedDelay purge 스케줄러 추가 |
| documents-boot/src/main/java/com/documents/DemoApplication.java | 스케줄링 활성화(@EnableScheduling) |
| documents-api/src/test/java/com/documents/api/document/DocumentControllerWebMvcTest.java | 휴지통 조회/휴지통 이동/복구 만료/title 유니크 등 컨트롤러 슬라이스 테스트 추가 |
| documents-api/src/main/java/com/documents/api/document/dto/TrashDocumentResponse.java | 휴지통 목록 응답 DTO 추가(deletedAt/purgeAt 포함) |
| documents-api/src/main/java/com/documents/api/document/DocumentController.java | 휴지통 목록 조회 및 휴지통 이동 엔드포인트 추가 |
| documents-api/src/main/java/com/documents/api/document/DocumentApiMapper.java | TrashDocumentResponse 매핑(purgeAt 계산 포함) 추가 |
| docs/runbook/DEBUG.md | hard delete/휴지통 이동/복구/조회/purge 디버깅 런북 보강 |
| docs/roadmap/v2/documents/document-trash.md | 문서 휴지통 v2 로드맵/운영 고려사항 추가 |
| docs/discussions/2026-03-25-document-hard-delete-and-trash-endpoint-review.md | 정책 검토 메모 문서 추가 |
| docs/REQUIREMENTS.md | 삭제/휴지통/복구 정책 및 title 유니크 요구사항 반영 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
documents-api/src/test/java/com/documents/api/document/DocumentControllerWebMvcTest.java
Show resolved
Hide resolved
documents-infrastructure/src/main/java/com/documents/service/DocumentServiceImpl.java
Outdated
Show resolved
Hide resolved
documents-boot/src/test/java/com/documents/api/document/DocumentApiIntegrationTest.java
Show resolved
Hide resolved
jho951
reviewed
Mar 25, 2026
Owner
jho951
left a comment
There was a problem hiding this comment.
document title 다시 중복 안되게 변경 부탁드릴게요.
jho951
approved these changes
Mar 25, 2026
Owner
jho951
left a comment
There was a problem hiding this comment.
reviewed these changes and approve the merge!
Collaborator
Author
반영하여 수정했습니다! |
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.
📝 Part (해당되는 것만 체크)
#️⃣ 연관된 이슈
closes #41
🔎 작업 내용
1. 주요 변경 사항 요약
soft delete에서hard delete로 변경soft deleteAPI를 추가2. 상세 내용 (선택)
삭제 정책 변경
DELETE /v1/documents/{documentId}는 문서, 하위 문서, 각 문서 소속 블록을 즉시 물리 삭제합니다.휴지통 이동 API
PATCH /v1/documents/{documentId}/trashdeletedAt을 기록합니다.휴지통 복구 API
POST /v1/documents/{documentId}/restore를 휴지통 복구 API로 사용합니다.deletedAt + 5분이 지나면 복구할 수 없습니다.자동 영구 삭제
deletedAt + 5분이 지나면 자동 영구 삭제됩니다.휴지통 조회 API
GET /v1/workspaces/{workspaceId}/trash/documentsdocumentId,title,parentId,deletedAt,purgeAt를 포함합니다.3. 프롬프트 경로
💬 집중 리뷰 요청
🧪 테스트 방법
1. 로컬 실행 방법
./gradlew :documents-infrastructure:test --tests com.documents.service.DocumentServiceImplTest./gradlew :documents-api:test --tests com.documents.api.document.DocumentControllerWebMvcTest./gradlew :documents-boot:test --tests com.documents.api.document.DocumentApiIntegrationTest2. 테스트 시나리오
DELETE /v1/documents/{documentId}호출 시 문서, 하위 문서, 소속 블록이 물리 삭제되는지 확인PATCH /v1/documents/{documentId}/trash호출 시 문서, 하위 문서, 소속 블록이 휴지통 상태로 전환되는지 확인POST /v1/documents/{documentId}/restore호출 시 5분 이내 문서만 복구되는지 확인GET /v1/workspaces/{workspaceId}/trash/documents호출 시 휴지통 문서만 조회되는지 확인✅ PR 체크리스트