Skip to content

[FEAT] 칼럼 응답에 원문 기사 정보 추가 (제목, 출판일, 발행사)#14

Merged
goblurry merged 1 commit into
mainfrom
news
Nov 16, 2025
Merged

[FEAT] 칼럼 응답에 원문 기사 정보 추가 (제목, 출판일, 발행사)#14
goblurry merged 1 commit into
mainfrom
news

Conversation

@goblurry

@goblurry goblurry commented Nov 16, 2025

Copy link
Copy Markdown
Member

🎯 목적

칼럼에 원문 기사에 관한 정보를 추가함. (제목, 출판일, 발행사)

📝 주요 변경사항

  1. DB 스키마: source_title, source_publisher, source_published_at 컬럼 추가
  2. API 응답: 칼럼 조회 시 원문 정보 포함
  • source_title: 원본 기사 제목
  • source_publisher: 원본 기사 발행사
  • source_published_at: 원본 기사 발행 시각

🔗 관련 이슈/PR

  • Related to #
  • Includes changes from #

🔄 버전 검토

  • 배포 버전 변경 시 config.py 업데이트 필요

🧪 테스트

  • 로컬 테스트 완료(Swagger UI에서 API 동작 확인)

📋 체크리스트

  • API 스펙 변경사항 문서화 (Swagger 업데이트)
  • 프론트엔드에 필요한 환경 변수 안내
  • 데이터베이스 스키마 변경사항 공유 (schema.sql 업데이트)
  • API 응답 형식 변경 여부 확인
  • CodeRabbit 제안사항 검토 완료

📝 커밋 메시지 규칙
타입 설명
feat 새로운 기능 추가 (API, 서비스 로직 등)
fix 버그 수정 (예외 처리, 로직 오류 등)
refactor 리팩토링 (기능 변화 없이 구조 개선)
style 코드 스타일 수정 (공백, 들여쓰기 등)
docs 문서 수정 (README, Swagger, 주석 등)
test 테스트 코드 추가/수정
chore 설정/빌드 관련 변경 (requirements.txt, .gitignore 등)
perf 성능 개선 (쿼리 최적화 등)
ci CI/CD 관련 설정 변경 (GitHub Actions 등)
config 설정 파일 변경 (config.py 등)

예시: feat: 뉴스 칼럼 추천 API 추가

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 뉴스 칼럼에 추가 소스 메타데이터 지원 (소스 제목, 출판사, 발행일시)
  • Chores

    • 버전 업데이트: 1.2.3 → 1.2.4
    • 로깅 유틸리티 스크립트 추가

@coderabbitai

coderabbitai Bot commented Nov 16, 2025

Copy link
Copy Markdown
📝 Walkthrough

전체 요약

앱 버전이 1.2.4로 업데이트되었고, 뉴스 데이터베이스 저장소에 소스 메타데이터 필드(제목, 출판사, 발행 시간)가 추가되었습니다. 데이터베이스 스키마가 대응 컬럼으로 확장되었으며, 로그 확인 유틸리티 스크립트가 신규 작성되었습니다.

변경사항

그룹 / 파일명 변경사항 요약
버전 업데이트
app/config.py
Settings 클래스의 app_version 속성 기본값을 "1.2.3"에서 "1.2.4"로 변경
뉴스 저장소 메타데이터 확장
app/services/news/news_db_repository.py
news_columns 테이블에 source_title, source_publisher, source_published_at 필드 처리 추가. save_column에서 새 필드 추출 및 UPSERT 쿼리에 포함, get_column과 get_all_columns에서 조회 결과에 새 필드 확장
데이터베이스 스키마 마이그레이션
database/schema.sql
news_columns 테이블에 source_title (TEXT), source_publisher (VARCHAR(255)), source_published_at (TIMESTAMP) 컬럼 추가. 기존 설치 환경을 위한 멱등성 마이그레이션 블록 포함
로그 확인 유틸리티
check_column_generation_logs.sh
Docker 컨테이너 로그 집계 및 필터링 쉘 스크립트 신규 작성. 최근 로그, 실시간 로그 추적, JSON 로그 필터링 등 4가지 로그 조회 방식 제공

코드 검토 예상 소요 시간

🎯 2 (Simple) | ⏱️ ~12분

  • 주목 영역:
    • app/services/news/news_db_repository.py: source_published_at의 타임스탬프 변환 로직 및 UPSERT 쿼리 매개변수 전달 확인
    • database/schema.sql: 마이그레이션 블록의 멱등성 검증 (기존 테이블에서 컬럼 중복 추가 방지)
    • app/config.py: 버전 변경으로 인한 의존성이나 호환성 영향 확인

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목은 주요 변경사항을 명확하게 요약하고 있으며, 원문 기사 정보 추가라는 핵심 의도를 잘 반영합니다.
Description check ✅ Passed PR 설명은 템플릿의 대부분 필수 섹션(목적, 주요 변경사항, 테스트, 체크리스트)을 포함하고 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 news

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.

@goblurry
goblurry changed the base branch from deploy to main November 16, 2025 12:51
@goblurry
goblurry merged commit 956c3c2 into main Nov 16, 2025
1 check passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
database/schema.sql (1)

41-67: 마이그레이션 로직이 안전하게 구현되었습니다.

idempotent 방식으로 구현되어 기존 데이터베이스에 안전하게 적용할 수 있습니다. CREATE TABLE 구문(라인 33-35)과 마이그레이션 블록을 함께 제공하는 것은 올바른 접근입니다.

향후 고려사항: source_published_at에 인덱스 추가를 고려할 수 있습니다(시간 기반 정렬/필터링이 필요한 경우).

CREATE INDEX IF NOT EXISTS idx_news_columns_source_published_at ON news_columns(source_published_at DESC);
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f866f50 and daad522.

📒 Files selected for processing (4)
  • app/config.py (1 hunks)
  • app/services/news/news_db_repository.py (10 hunks)
  • check_column_generation_logs.sh (1 hunks)
  • database/schema.sql (1 hunks)
🧰 Additional context used
🪛 Ruff (0.14.4)
app/services/news/news_db_repository.py

46-46: Do not catch blind exception: Exception

(BLE001)


136-136: Consider moving this statement to an else block

(TRY300)

🔇 Additional comments (11)
app/config.py (1)

44-44: 버전 업데이트가 적절합니다.

새로운 필드 추가는 하위 호환성을 유지하면서 기능을 확장하므로 마이너 버전 업데이트(1.2.3 → 1.2.4)가 적절합니다.

database/schema.sql (1)

33-35: 스키마 변경이 올바르게 구현되었습니다.

새로운 컬럼(source_title, source_publisher, source_published_at)이 적절한 데이터 타입으로 정의되었습니다.

check_column_generation_logs.sh (1)

1-31: 로그 모니터링 스크립트가 잘 구성되었습니다.

다양한 필터링 방법을 제공하여 칼럼 생성 프로세스를 효과적으로 모니터링할 수 있습니다. 읽기 전용 유틸리티로 안전하게 사용할 수 있습니다.

app/services/news/news_db_repository.py (8)

4-4: datetime 임포트가 적절합니다.

source_published_at 필드를 TIMESTAMP로 변환하기 위해 필요한 임포트입니다.


26-28: 원문 정보 필드 추출이 올바르게 구현되었습니다.

새로운 source 메타데이터 필드를 적절하게 추출하고 있습니다.


37-47: datetime 파싱 로직이 안전하게 구현되었습니다.

ISO 형식 문자열과 datetime 객체를 모두 처리하며, 파싱 실패 시 안전하게 None으로 폴백합니다. 정적 분석 도구가 blind Exception을 지적하지만, 이 컨텍스트에서는 방어적 코딩으로 적절합니다.

참고: ISO 8601 형식(예: "2024-03-15T10:30:00Z")이 예상되는 주요 입력 형식임을 확인했습니다.


52-66: UPSERT 쿼리가 올바르게 확장되었습니다.

새로운 원문 정보 컬럼이 INSERT와 UPDATE 구문 모두에 적절하게 포함되었습니다. ON CONFLICT 처리가 일관되게 구현되어 있습니다.


69-79: 쿼리 파라미터 전달이 정확합니다.

새로운 필드들이 올바른 순서로 execute 함수에 전달되고 있습니다.


101-136: 칼럼 조회 로직이 올바르게 확장되었습니다.

SELECT 쿼리에 새로운 필드가 포함되었고, 결과 딕셔너리에 조건부로 추가하여 하위 호환성을 유지합니다. 정적 분석 도구가 라인 136의 return을 else 블록으로 이동하라고 제안하지만, 이는 false positive입니다(라인 110-111의 early return 이후 라인 136이 실행되므로 문제없음).


150-183: 전체 칼럼 조회 로직이 일관되게 구현되었습니다.

get_column과 동일한 패턴으로 새로운 원문 정보 필드를 처리합니다. 각 row에서 조건부로 필드를 추가하여 일관성을 유지합니다.


16-28: 리뷰 코멘트는 부정확합니다

코드를 검증한 결과, 새로운 source 메타데이터 필드들이 이미 올바르게 전달되고 있습니다. _generate_column_from_news 메서드는 라인 377-380에서 source_title, source_publisher, source_published_at를 Column 객체에 명시적으로 설정한 후, 라인 385에서 column.model_dump()로 반환합니다. 따라서 save_column이 호출되는 라인 208과 285에서 전달되는 column_data는 이미 모든 필드를 포함하고 있습니다.

Likely an incorrect or invalid review comment.

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.

1 participant