[Feature] Promotion API 추가 및 테스트 인프라 구축#1136
Conversation
- withErrorHandling 함수는 에러를 로깅하고 재throw하는 것 외에 없음
- 홍보리스트 get - 홍보 게시물 post 구현
- 홍보게시판 API를 위한 React Query 훅을 추가
- Storybook에서 백엔드 없이 컴포넌트 개발을 위한 MSW 설정을 추가
- msw-storybook-addon 사용
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning
|
| 코호트 / 파일 | 요약 |
|---|---|
API 에러 처리 리팩토링 frontend/src/apis/applicants.ts, frontend/src/apis/application.ts, frontend/src/apis/auth.ts, frontend/src/apis/club.ts, frontend/src/apis/image.ts, frontend/src/apis/utils/apiHelpers.ts |
모든 API 함수에서 withErrorHandling 래퍼 제거 후 직접 handleResponse 호출로 변경. 공개 API 서명은 유지되며 제어 흐름만 단순화됨. |
홍보 API 추가 frontend/src/apis/promotion.ts, frontend/src/apis/promotion.test.ts, frontend/src/types/promotion.ts, frontend/src/hooks/Queries/usePromotion.ts, frontend/src/constants/queryKeys.ts |
홍보 게시판 조회/생성 API 함수, React Query 훅, 타입 정의 및 테스트 추가. getPromotionArticles() 및 createPromotionArticle() 내보냄. |
MSW 핸들러 재구성 frontend/src/mocks/handlers/index.ts, frontend/src/mocks/handlers/promotion.ts, frontend/src/mocks/browser.ts |
새로운 핸들러 인덱스 생성, 홍보 엔드포인트 모킹 추가, 핸들러 가져오기 경로 업데이트. |
레거시 모킹 유틸리티 제거 frontend/src/mocks/api/apply.ts, frontend/src/mocks/api/applyHandlers.test.skip.ts, frontend/src/mocks/api/index.ts, frontend/src/mocks/api/utils/request.ts, frontend/src/mocks/constants/clubApi.ts, frontend/src/mocks/constants/error.ts, frontend/src/mocks/data/mockData.ts, frontend/src/mocks/utils/createApiUrl.ts, frontend/src/mocks/utils/createApiUrl.test.ts, frontend/src/mocks/utils/validateClubId.ts |
기존 클럽 신청 API 모킹, 검증 유틸리티, 하드코딩된 상수 및 모의 데이터 완전 제거. |
빌드 및 개발 도구 설정 frontend/package.json, frontend/src/index.tsx, frontend/.storybook/preview.tsx |
msw-storybook-addon 의존성 추가, MSW 워커 가져오기 경로 변경, Storybook에서 MSW 초기화 및 로더 구성. |
예상 코드 리뷰 난이도
🎯 3 (보통) | ⏱️ ~25분
연관된 이슈
- MOA-597: 홍보게시판 API 추가 — 이 PR은 홍보 게시판 목록 조회 및 글 추가 POST API를 구현하여 요청된 기능을 직접 충족합니다.
연관된 PR
- [feature] 다중 지원서 API 연결 #783: 동일한 지원자 API 함수(
getClubApplicants,deleteApplicants)를 수정하므로 코드 수준에서 관련됨. - [Refactor] hooks 리팩토링 PR에 대한 추가수정 #1063:
frontend/src/apis/utils/apiHelpers.ts에러 처리 유틸리티 변경과 직접 관련됨. - [feature] 동아리 지원서 타입 설계 및 Mock API 개발 #418: 이 PR이 원래 추가한 MSW 모킹 모듈(
src/mocks/api/apply.ts,mocks/data/mockData.ts등)을 제거합니다.
제안 레이블
📬 API
제안 리뷰어
- lepitaaar
- oesnuj
- suhyun113
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Out of Scope Changes check | The PR includes significant out-of-scope changes: removal of withErrorHandling wrapper across multiple API files (applicants, application, auth, club, image) that are unrelated to promotion API or testing infrastructure objectives. | Remove the withErrorHandling refactoring changes from API modules (applicants.ts, application.ts, auth.ts, club.ts, image.ts) as they extend beyond the stated PR objectives of adding promotion API and test infrastructure. | |
| Docstring Coverage | Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The PR title accurately describes the main changes: adding promotion API and establishing test infrastructure (MSW setup). |
| Linked Issues check | ✅ Passed | All coding requirements from MOA-597 are met: GET API for promotion list (getPromotionArticles) and POST API for creating articles (createPromotionArticle) are fully implemented. |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
✏️ 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
feature/#1135-promotion-api-MOA-597
Important
Action Needed: IP Allowlist Update
If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
- ✨
136.113.208.247/32(new) 34.170.211.100/3235.222.179.152/32
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist.
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.
Comment @coderabbitai help to get the list of available commands and usage tips.
- ThemeProvider와 GlobalStyles로 styled-components 의존 컴포넌트 오류 해결 - 스토리북에서 공통 스타일을 동일하게 적용
lepitaaar
left a comment
There was a problem hiding this comment.
홍보 게시판 API 구현 수고하셨습니다. 레이아웃만 추가하면 될듯하네요!
#️⃣연관된 이슈
📝작업 내용
1. API 에러 처리 개선
withErrorHandling래퍼 함수 제거handleResponse직접 사용하도록 리팩토링withErrorHandling 함수는 api에서 발생한 에러를 받고 다시 thorw하는 역할이었습니다.
그리고 handleResponse 내부에서 에러를 던지고 있기에 withErrorHandling는 필요없다고 생각했습니다.
2. Promotion API 구현 (7ee0ec7, 17fdde7)
getPromotionArticles(): 홍보게시판 목록 조회createPromotionArticle(): 홍보게시판 글 작성useGetPromotionArticles: 목록 조회 훅 (1분 캐싱)useCreatePromotionArticle: 글 작성 훅 (자동 캐시 무효화)3. MSW 테스트 인프라 구축
4. API 테스트 작성
promotion.test.ts: 6개 테스트 케이스를 작성api 테스트를 해야할까 했지만 오랜만에 새로 추가된 api이고 추후 변경사항이 있을 것을 고려하여 응답, 에러 테스트를 짰습니다.
중점적으로 리뷰받고 싶은 부분(선택)
논의하고 싶은 부분(선택)
🫡 참고사항
Summary by CodeRabbit
릴리스 노트
새로운 기능
개선 사항
테스트
기타