[feat] 사장님 금일 스케줄 조회 API 연동#20
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 Walkthrough🎯 핵심 리뷰 요약Walkthrough오늘의 스케줄을 동적으로 로드하는 API 클라이언트, React Query 훅, 타입을 추가하고, 하드코딩된 작업자 목록을 대체했습니다. 또한 Workspace 편집 콜백을 제거하고 응답 필드 부재에 대한 방어 로직을 강화했습니다. Changes
🚨 핵심 이슈1. 에러 처리 누락 (높음)
const { data, isLoading, error } = useQuery(...)
return { todayWorkers, isLoading, error } // 또는 error 상태 처리2. workTime 유도 로직의 안전성 (중간)"첫 번째 shift의 start/end datetime"을 사용하지만, shifts 배열이 비어있는 경우 처리가 불명확합니다.
const shift = shifts?.[0]
const workTime = shift ? `${formatTime(shift.startDatetime)} ~ ${formatTime(shift.endDatetime)}` : '-'3. Workspace 편집 기능 의도 확인 필요 (중간)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 41 minutes and 15 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/features/home/manager/hooks/useTodaySchedulesViewModel.ts (1)
6-6: ⚡ Quick winUI 타입 의존성을 훅 밖으로 옮겨주세요.
useTodaySchedulesViewModel가ui/TodayWorkerList의TodayWorkerItem타입을 직접 가져오면 view-model이 UI에 묶입니다. 이 타입은 feature 공용types모듈로 옮기거나 훅 내부 로컬 타입으로 분리하는 편이 안전합니다. As per coding guidelines, 비즈니스 로직이 UI 컴포넌트와 분리되어 있는지.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/features/home/manager/hooks/useTodaySchedulesViewModel.ts` at line 6, 현재 useTodaySchedulesViewModel 훅이 ui/TodayWorkerList의 TodayWorkerItem 타입을 직접 임포트해 뷰와 비즈니스 로직을 결합하고 있으므로, TodayWorkerItem 의존성을 훅 밖으로 옮기세요: ui/TodayWorkerList에서의 타입 임포트를 제거하고 대신 feature 공용 types 모듈에 TodayWorkerItem 인터페이스를 정의하고 export 하거나 훅 내부에 로컬 타입(예: TodayWorkerItemLocal)으로 분리한 뒤 useTodaySchedulesViewModel 내부의 모든 해당 참조를 새 타입으로 교체하고 필요한 파일들에서 새 타입을 import 하도록 업데이트하세요.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/features/home/manager/hooks/useManagedPostingsViewModel.ts`:
- Around line 34-44: The code accesses page.data and data.pages[0].data without
fully guarding for missing data, causing runtime crashes; update
getNextPageParam, the postings useMemo (and map usage of adaptPostingDto), and
totalCount calculation to check that page.data (and data?.pages[0]?.data) exists
before reading .page, .cursor, .data or .totalCount (use optional chaining and
fallback empty arrays/0 where appropriate) so null/undefined pages are safely
skipped and postings/totalCount remain valid when page.data is absent.
In `@src/features/home/manager/hooks/useSubstituteRequestsViewModel.ts`:
- Around line 34-46: The code currently assumes page.data and data exist and
will throw when they are missing; update the null checks so getNextPageParam,
the requests useMemo, and totalCount all guard for missing data/page fields.
Specifically, in getNextPageParam (referenced by getNextPageParam: lastPage) use
optional chaining to check lastPage?.data?.page?.cursor; in the requests
computation (referenced by requests, data.pages and adaptSubstituteRequestDto)
ensure each page is checked (e.g., page?.data?.data) and default to an empty
array before flatMap; and for totalCount (referenced by totalCount and
data.pages[0]) use optional chaining on data?.pages?.[0]?.data?.page?.totalCount
with a safe default (0).
---
Nitpick comments:
In `@src/features/home/manager/hooks/useTodaySchedulesViewModel.ts`:
- Line 6: 현재 useTodaySchedulesViewModel 훅이 ui/TodayWorkerList의 TodayWorkerItem
타입을 직접 임포트해 뷰와 비즈니스 로직을 결합하고 있으므로, TodayWorkerItem 의존성을 훅 밖으로 옮기세요:
ui/TodayWorkerList에서의 타입 임포트를 제거하고 대신 feature 공용 types 모듈에 TodayWorkerItem
인터페이스를 정의하고 export 하거나 훅 내부에 로컬 타입(예: TodayWorkerItemLocal)으로 분리한 뒤
useTodaySchedulesViewModel 내부의 모든 해당 참조를 새 타입으로 교체하고 필요한 파일들에서 새 타입을 import 하도록
업데이트하세요.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: cbc53207-3b7c-4ace-a1ba-e6f330b5ca67
📒 Files selected for processing (10)
src/features/home/manager/api/schedule.tssrc/features/home/manager/hooks/useManagedPostingsViewModel.tssrc/features/home/manager/hooks/useManagerHomeViewModel.tssrc/features/home/manager/hooks/useSubstituteRequestsViewModel.tssrc/features/home/manager/hooks/useTodaySchedulesViewModel.tssrc/features/home/manager/types/schedule.tssrc/features/home/manager/ui/WorkspaceChangeCard.tsxsrc/features/home/manager/ui/WorkspaceChangeList.tsxsrc/pages/manager/home/index.tsxsrc/shared/lib/queryKeys.ts
💤 Files with no reviewable changes (3)
- src/pages/manager/home/index.tsx
- src/features/home/manager/ui/WorkspaceChangeList.tsx
- src/features/home/manager/ui/WorkspaceChangeCard.tsx
1271f38 to
45428f0
Compare
ID
변경 내용
구현 사항
Summary by CodeRabbit
릴리스 노트
새로운 기능
버그 수정
개선 사항