Skip to content

Feat/#144 게시글 시간, 좋아요순 정렬 기능 추가 - #145

Merged
klaqwe1 merged 5 commits into
devfrom
feat/#144-post-sort-by-time-like
Aug 14, 2026
Merged

Feat/#144 게시글 시간, 좋아요순 정렬 기능 추가#145
klaqwe1 merged 5 commits into
devfrom
feat/#144-post-sort-by-time-like

Conversation

@klaqwe1

@klaqwe1 klaqwe1 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

PR 타입

  • Bugfix
  • Feature
  • Code style update
  • Refactoring
  • Other... Please describe:

작업 내용

  • 테마·디자인 게시글 목록 API에 sort_type 정렬 조건을 추가
    • CREATED_ASC
    • CREATED_DESC (기본값)
    • PREFER_ASC
    • PREFER_DESC
  • 좋아요 수가 같은 경우 생성일 및 게시글 ID를 기준으로 안정적으로 정렬하도록 개선
  • 디자인 게시글의 중복 행도 designBoardId를 기준으로 순서를 고정

관련 이슈: #144

테스트 결과

image image image

PR 체크리스트

  • 커밋 메시지가 가이드라인을 따르는가
  • 테스트 코드를 모두 통과하였는가
  • 관련 이슈를 연결하였는가

@klaqwe1
klaqwe1 requested a review from kym8821 July 25, 2026 18:49
@klaqwe1 klaqwe1 self-assigned this Jul 25, 2026
@klaqwe1 klaqwe1 added the enhancement New feature or request label Jul 25, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@kym8821 kym8821 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전반적으로 잘 작성된 것 같습니다. QueryDSL 기반 동적 쿼리를 사용한 부분이 좋았습니다.

다만 일부 테스트는 실제 요구사항이나 중요한 동작을 보호하는 테스트인지 검토가 필요해 보입니다.

테스트는 모든 코드를 실행하는 것보다 변경 시 깨지면 안 되는 동작을 명확히 보장하는 것이 목적이라고 생각합니다. 특히 프레임워크 기본 동작이나 구현 세부사항을 검증하는 테스트는 유지 비용 대비 효용이 낮을 수 있어, 테스트가 어떤 장애/회귀를 방지하는지 검토가 필요할 것으로 보입니다.

Comment on lines +230 to +253
@Test
@DisplayName("게시글 목록 API 문서에는 sort_type만 정렬 조건으로 노출한다.")
void postBoardListOpenApi_excludesPageableSort() throws Exception {
User client = boardDetailDataGenerator.getUsers().get(0);
mockMvc.perform(mockMvcUtils.addAuthentication(
get("/v3/api-docs"), TestClientDto.fromEntity(client)))
.andExpect(status().isOk())
.andExpect(jsonPath(
"$.paths['/api/theme-boards'].get.parameters[?(@.name == 'page')]").isNotEmpty())
.andExpect(jsonPath(
"$.paths['/api/theme-boards'].get.parameters[?(@.name == 'size')]").isNotEmpty())
.andExpect(jsonPath(
"$.paths['/api/theme-boards'].get.parameters[?(@.name == 'sort_type')]").isNotEmpty())
.andExpect(jsonPath(
"$.paths['/api/theme-boards'].get.parameters[?(@.name == 'sort')]").isEmpty())
.andExpect(jsonPath(
"$.paths['/api/design-boards'].get.parameters[?(@.name == 'page')]").isNotEmpty())
.andExpect(jsonPath(
"$.paths['/api/design-boards'].get.parameters[?(@.name == 'size')]").isNotEmpty())
.andExpect(jsonPath(
"$.paths['/api/design-boards'].get.parameters[?(@.name == 'sort_type')]").isNotEmpty())
.andExpect(jsonPath(
"$.paths['/api/design-boards'].get.parameters[?(@.name == 'sort')]").isEmpty());
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API 문서 생성 결과를 검증하는 통합 테스트로 보입니다. 다만 현재 테스트가 검증하는 부분은 실제 API 동작보다는 Swagger/OpenAPI 문서 생성 및 SpringDoc 설정 동작에 가까워 보여, 해당 테스트가 별도로 필요한 이유가 궁금합니다.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이번 변경에서 정렬 기준을 sort_type으로 일원화하면서, 실제 조회 정렬에 사용되지 않는 Pageable.sort가 문서에 노출되지 않도록 숨기고 page, size만 수동으로 선언했습니다. 해당 문서 형태의 회귀를 방지하고자 테스트를 추가했으나, 말씀하신 대로 실제 API 동작보다 SpringDoc 생성 결과에 결합된 테스트라 유지 비용 대비 효용이 낮다는 점에 동의합니다. 해당 테스트는 제거하겠습니다.

@kym8821 kym8821 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

전반적으로 잘 작성되었습니다. 불필요한 테스트가 없어졌고 현재 필요한 테스트만 남은 것이 좋아보입니다.

@klaqwe1
klaqwe1 merged commit 0937964 into dev Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants