Skip to content

[25.01.28 / TASK-271] Hotfix - recentPosts에서 viewDiff 제거#51

Merged
Jihyun3478 merged 4 commits intomainfrom
hotfix/svg-view-diff
Feb 7, 2026
Merged

[25.01.28 / TASK-271] Hotfix - recentPosts에서 viewDiff 제거#51
Jihyun3478 merged 4 commits intomainfrom
hotfix/svg-view-diff

Conversation

@Jihyun3478
Copy link
Copy Markdown
Contributor

@Jihyun3478 Jihyun3478 commented Jan 27, 2026

🔥 변경 사항

  • recentPosts에서 viewDiff 제거 및 이에 따른 관련 코드 업데이트

🏷 관련 이슈

  • 관련 이슈: #123

📸 스크린샷 (UI 변경 시 필수)

(변경 사항이 UI와 관련된 경우 스크린샷을 첨부해주세요.)

📌 체크리스트

  • 기능이 정상적으로 동작하는지 테스트 완료
  • 코드 스타일 가이드 준수 여부 확인
  • 관련 문서 업데이트 완료 (필요 시)

Summary by CodeRabbit

  • 개선 사항
    • 배지 데이터 응답 구조 단순화 — 사용자 배지 및 최근 게시물에서 viewDiff(조회수 차이) 필드 제거
    • 최근 게시물 반환 항목 축소 — 제목, 공개일, 오늘 조회수, 오늘 좋아요만 제공
    • 최근 게시물 조회 로직 간소화 — 날짜 범위 필터 및 관련 조인 제거로 쿼리 최적화
  • 변경 사항
    • 최근 게시물 기본 조회 개수 통일 — 기본 제한이 4에서 10으로 조정

✏️ Tip: You can customize this high-level summary in your review settings.

@Jihyun3478 Jihyun3478 added the bug Something isn't working label Jan 27, 2026
@notion-workspace
Copy link
Copy Markdown

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 27, 2026

Walkthrough

getUserRecentPosts의 dateRange 매개변수를 제거하고, start_stats 조인 및 view_diff 관련 로직을 삭제해 DB 쿼리와 반환 필드를 title, released_at, today_view, today_like로 단순화했습니다.

Changes

Cohort / File(s) Summary
저장소 쿼리 변경
src/repositories/totalStats.repository.ts
getUserRecentPosts 시그니처에서 dateRange 제거; 쿼리(빌드)에서 start_stats 조인 및 날짜 기반 조건 제거; 반환 필드에서 view_diff 관련 로직 삭제(선택된 필드: title, released_at, today_view, today_like).
서비스 호출 및 상수 업데이트
src/services/totalStats.service.ts
내부 상수 BADGE_RECENT_POSTS_LIMIT 추가(값 10); getUserRecentPosts 호출 시 기본 타입에 대해 하드코드된 4를 상수로 대체; recentPosts 매핑에서 viewDiff 제거.
응답 타입 정리
src/types/dto/responses/totalStatsResponse.type.ts
BadgeUserDataBadgeRecentPost 인터페이스에서 viewDiff 필드 제거 및 관련 Swagger/타입 정의 축소.
메타/패키지 파일
package.json
메타 변경 없음(포함되어 있으나 기능적 변경 없음).

Sequence Diagram(s)

(생성 조건 미충족 — 생략)

Estimated code review effort

🎯 3 (중간) | ⏱️ ~20분

Possibly related PRs

Suggested reviewers

  • six-standard
  • ooheunda

Poem

🐰
타임라인 덜어내고 가벼워졌네,
viewDiff는 안녕, 쿼리는 단정해.
제목과 날짜, 조회수만 들고,
당당히 풀을 뜁니다 — 홧팅! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 recentPosts에서 viewDiff 제거라는 주요 변경 사항을 명확하게 설명하고 있으며, 이는 변경 사항의 핵심을 정확히 반영합니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/svg-view-diff

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/services/totalStats.service.ts`:
- Around line 72-74: The call that assigns recentPosts is passing
BADGE_DATE_RANGE (30) as the limit to getUserRecentPosts which causes 30 items
to be returned; update the call in totalStats.service.ts (the recentPosts
assignment / the getUserRecentPosts invocation used when type === 'default') to
use the intended recent-post limit (e.g. introduce or use RECENT_POSTS_LIMIT =
4) or omit the stray date-range constant so getUserRecentPosts receives the
correct 4-item limit instead of BADGE_DATE_RANGE; ensure you reference and/or
add the RECENT_POSTS_LIMIT constant and pass that into getUserRecentPosts (or
rely on its default) rather than BADGE_DATE_RANGE.

Copy link
Copy Markdown
Member

@Nuung Nuung left a comment

Choose a reason for hiding this comment

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

거의 다 코드를 빼는거라 특별하게 리뷰할 포인트가 없긴 하네요! 코멘트만 체크해 주세요.
궁금한건 view diff 를 빼면 CTE 를 포함해 sql query 가 좀 줄어들 줄 알았는데 생각보다 거의 차이가 없네요?!

Copy link
Copy Markdown
Member

@ooheunda ooheunda left a comment

Choose a reason for hiding this comment

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

변경사항 확인했습니다! 고생하셨습니다~! 🔥👍
기존에 CTE를 별도 블록으로 빼두셔서 이번 수정사항을 따라가기가 더 쉬웠던 것 같아요.

@Jihyun3478
Copy link
Copy Markdown
Contributor Author

거의 다 코드를 빼는거라 특별하게 리뷰할 포인트가 없긴 하네요! 코멘트만 체크해 주세요. 궁금한건 view diff 를 빼면 CTE 를 포함해 sql query 가 좀 줄어들 줄 알았는데 생각보다 거의 차이가 없네요?!

현재는 최근 게시물의 증가폭만 제거한 상태입니다. user 전체 통계의 증가폭도 필요가 없어진다면, sql query가 더 줄어들 것 같습니다!

Copy link
Copy Markdown
Member

@six-standard six-standard left a comment

Choose a reason for hiding this comment

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

리뷰가 생각보다 너무 늦어졌네요.. 죄송합니다
다른 분들이 리뷰해주신 부분 제외하고 큰 문제는 없는 것 같고, 생각보다 줄어든 양이 좀 적어서 놀랍네요

@Jihyun3478 Jihyun3478 requested a review from Nuung February 6, 2026 12:43
@Jihyun3478 Jihyun3478 merged commit 5a1f2b4 into main Feb 7, 2026
8 of 13 checks passed
@Jihyun3478 Jihyun3478 deleted the hotfix/svg-view-diff branch February 7, 2026 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants