Conversation
feat: 도커파일 추가
tmp: dev cd 트리거
tmp: dev cd 트리거
tmp: dev cd 트리거
tmp: dev cd 트리거
tmp: dev cd 트리거
tmp: 임시 dev cd 트리거
tmp: dev cd 트리거
tmp: dev cd 트리거
tmp: dev cd 트리거
tmp: dev cd 트리거
feat: ssh가 아닌 self hosted 로 접근
feat: prod CI / CD 파이프라인 구축
* refactor: 코틀린 파일 삭제 및 자바 파일 추가 * fix: 테스트 오류 수정
- 조직 문서와 크루 문서 모두가 조회되는지 확인한다.
test: 문서 조회 테스트 추가
feat: 특정 문서에 대한 조직 문서 삭제 API 구현
* feat: DTO 네이밍 및 공용 래퍼 정리 record 전환과 이름 규칙을 반영해 공용 요청/응답 DTO를 정리하고 관련 사용처를 갱신 * feat: 테스트 네이밍 규칙 적용 @nested 클래스명과 테스트 메서드명을 규칙에 맞게 정리 * feat: 컨벤션 문서 추가 프로젝트 규칙을 한국어로 정리하고 예시를 추가
[FEAT] 일반 문서 삭제 시, 연결된 조직 문서 해제
test: DocumentService 분리로 Crew/Organization 테스트 분리
[FEAT] 기존 조직 문서를 조직 문서에 연결하는 기능
feat: 조직 문서를 조회할 때 연결된 크루 문서 목록도 함께 반환하도록 기능을 구현
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 애플리케이션의 문서 관리 시스템을 개선하고 컨테이너화 지원을 추가합니다. 주요 변경 사항으로는 문서 삭제 로직을 UUID 기반으로 전환하고, 크루 문서 관련 기능을 전담하는 Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
이 PR은 develop 브랜치를 main으로 병합하는 것으로, 문서 관리 기능에 대한 대규모 리팩토링과 기능 추가를 포함하고 있습니다. 주요 변경 사항으로는 문서 식별자로 Long ID 대신 UUID를 사용하도록 변경하고, DocumentService를 CrewDocumentService와 DocumentService로 분리하여 역할을 명확히 한 점, 그리고 조직 문서를 크루 문서에 연결하는 새로운 기능을 추가한 점이 있습니다. 전반적으로 코드의 구조가 개선되고, DTO에 Java record를 사용하는 등 최신 Java 기능을 잘 활용했습니다. 테스트 코드도 BDD 스타일로 개선되어 가독성이 좋아졌습니다. 몇 가지 개선점을 제안 드리며, 이는 코드의 효율성과 유지보수성을 더욱 높이는 데 도움이 될 것입니다.
| public DocumentResponse getRandom() { | ||
| List<CrewDocument> documents = crewDocumentRepository.findAll(); | ||
| if (documents.isEmpty()) { | ||
| throw new WikiException(ErrorCode.DOCUMENT_NOT_FOUND); | ||
| } | ||
| CrewDocument document = documents.get(random.nextInt(documents.size())); | ||
| return mapToResponse(document); | ||
| } |
There was a problem hiding this comment.
getRandom() 메서드에서 crewDocumentRepository.findAll()을 호출하여 모든 문서를 메모리에 로드하는 방식은 문서 수가 많아질 경우 성능 저하 및 OutOfMemoryError를 유발할 수 있습니다. 데이터베이스에서 직접 임의의 문서 하나만 가져오도록 최적화하는 것이 좋습니다. 예를 들어, 전체 문서 수를 구한 뒤 임의의 오프셋을 지정하여 Pageable로 하나의 데이터만 조회하는 방식을 사용할 수 있습니다. 제안된 코드를 적용하려면 org.springframework.data.domain.Page와 org.springframework.data.domain.PageRequest를 임포트해야 합니다.
public DocumentResponse getRandom() {
long count = crewDocumentRepository.count();
if (count == 0) {
throw new WikiException(ErrorCode.DOCUMENT_NOT_FOUND);
}
int randomIndex = random.nextInt((int) count);
Page<CrewDocument> documentPage = crewDocumentRepository.findAll(PageRequest.of(randomIndex, 1));
if (documentPage.isEmpty()) {
throw new WikiException(ErrorCode.DOCUMENT_NOT_FOUND);
}
CrewDocument document = documentPage.getContent().get(0);
return mapToResponse(document);
}| adminService.deleteDocumentByDocumentId(documentId); | ||
| @Operation(summary = "문서 삭제", description = "문서 Uuid로 문서를 삭제합니다.") | ||
| @DeleteMapping("/documents/{documentUuid}") | ||
| public ApiResponse<ApiResponse.SuccessBody<Void>> deleteDocumentByDocumentId(@PathVariable UUID documentUuid) { |
There was a problem hiding this comment.
메서드 이름 deleteDocumentByDocumentId가 파라미터 documentUuid와 일치하지 않아 혼란을 줄 수 있습니다. 메서드의 역할과 파라미터를 명확하게 나타내기 위해 메서드 이름을 deleteDocumentByDocumentUuid로 변경하는 것을 권장합니다.
| public ApiResponse<ApiResponse.SuccessBody<Void>> deleteDocumentByDocumentId(@PathVariable UUID documentUuid) { | |
| public ApiResponse<ApiResponse.SuccessBody<Void>> deleteDocumentByDocumentUuid(@PathVariable UUID documentUuid) { | |
| public DocumentType getDocumentType() { | ||
| return type(); | ||
| } |
| @Nested | ||
| @DisplayName("문서 uuid로 삭제 기능") | ||
| class DeleteByUuid { | ||
|
|
||
| @DisplayName("존재하는 문서 id일 경우 문서가 로그들과 함께 삭제된다") | ||
| @Test | ||
| void deleteByUuid_success_byExistingDocument() { | ||
| // given | ||
| DocumentResponse documentResponse = crewDocumentService.create( | ||
| CrewDocumentFixture.createDocumentCreateRequest("title1", "content1", "writer1", 10L, | ||
| UUID.randomUUID())); | ||
|
|
||
| // before then | ||
| assertThat(documentRepository.findAll()).hasSize(1); | ||
| assertThat(historyRepository.findAll()).hasSize(1); | ||
|
|
||
| // when | ||
| crewDocumentService.deleteByUuid(documentResponse.documentUUID()); | ||
|
|
||
| // after then | ||
| assertThat(documentRepository.findAll()).hasSize(0); | ||
| assertThat(historyRepository.findAll()).hasSize(0); | ||
| } | ||
|
|
||
| @DisplayName("존재하지 않는 문서의 id일 경우 예외가 발생한다 : WikiException.DOCUMENT_NOT_FOUND") | ||
| @Test | ||
| void deleteByUuid_fail_byNonExistingDocument() { | ||
| // when & then | ||
| WikiException ex = assertThrows(WikiException.class, | ||
| () -> crewDocumentService.deleteByUuid(UUID.randomUUID())); | ||
| assertThat(ex.getErrorCode()).isEqualTo(DOCUMENT_NOT_FOUND); | ||
| } | ||
| } |
# Conflicts: # src/main/java/com/wooteco/wiki/organizationdocument/repository/DocumentOrganizationLinkRepository.java
No description provided.