Skip to content

fix: 대시보드 정류장 집계에서 비활성 정류장 제외 및 recentStations null 수정 - #36

Merged
1ub7 merged 2 commits into
developfrom
fix/dashboard-station-count
Sep 28, 2026
Merged

1ub7 merged 2 commits into
developfrom
fix/dashboard-station-count

Conversation

@1ub7

@1ub7 1ub7 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

📝 작업 내용

대시보드 API에서 정류장 수가 실제보다 많게 나오고 최근 등록 정류장 목록이 비어서 내려오던 버그 수정했습니다.

🔧 변경 사항

  • DashboardResponse: 생성자 파라미터 오타(recetStations → recentStations) 수정
    • 오타 때문에 this.recentStations = recentStations가 필드에 자기 자신을 대입해서, 응답의 recentStations가 항상 null이었음
    • 같은 실수가 컴파일 단계에서 잡히도록 recentStations 필드에 final 추가
  • DashboardStationRepository: 활성 정류장만 조회하는 메서드 추가
    • countByActiveTrue()
    • findTop5ByActiveTrueOrderByCreatedAtDesc() (기존 findTop5ByOrderByCreatedAtDesc() 대체)
  • DashboardService: 정류장 개수와 최근 등록 목록을 위 메서드로 조회하도록 변경
    • 정류장 삭제가 소프트 삭제(active = false)라서, 기존 count()가 삭제된 정류장까지 세고 있었음

🧪 테스트 방법

  1. 서버 재배포 후 GET /manage/dashboard 호출
  2. totalStationCount가 정류장 관리 화면의 실제 개수와 같은지 확인 (DB 기준 active = 1인 정류장 수)
  3. recentStations에 활성 정류장이 최신 등록 순으로 최대 5개 내려오는지 확인
  4. 정류장을 삭제한 뒤 다시 호출해서 totalStationCount가 줄고, 삭제한 정류장이 recentStations에서 빠지는지 확인

@1ub7
1ub7 requested a review from s26047-code September 28, 2026 07:20
@1ub7
1ub7 merged commit 42f8159 into develop Sep 28, 2026
1 check passed
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.

2 participants