Skip to content

[feat] 사장님 금일 스케줄 조회 API 연동#20

Merged
limtjdghks merged 5 commits into
devfrom
feat/ALT-180
May 2, 2026
Merged

[feat] 사장님 금일 스케줄 조회 API 연동#20
limtjdghks merged 5 commits into
devfrom
feat/ALT-180

Conversation

@limtjdghks
Copy link
Copy Markdown
Member

@limtjdghks limtjdghks commented Apr 30, 2026

ID

  • ALT-180

변경 내용

  • 사장님 홈 금일 근무자 조회 API 연동 및 관련 버그 수정
  • 업장 정보 수정 버튼 삭제

구현 사항

  • 금일 근무자 조회 API 연동 (GET /manager/schedules/today)
  • TodayShiftDto, TodayWorkerDto, TodayScheduleApiResponse 타입 추가
  • fetchTodaySchedules() API 함수 추가
  • useTodaySchedulesViewModel 훅 신규 작성 — 응답 데이터를 TodayWorkerItem UI 모델로 변환
  • 기존 하드코딩된 더미 데이터(TODAY_WORKERS)를 실제 API 데이터로 교체
  • 페이지네이션 옵셔널 체이닝 적용 (에러 방어)
  • useManagedPostingsViewModel, useSubstituteRequestsViewModel의 getNextPageParam, totalCount, data 접근 경로에 ?. 추가
  • WorkspaceChangeCard, WorkspaceChangeList에서 onEdit 관련 props 및 UI 삭제
  • queryKeys.manager.todaySchedules 쿼리 키 추가

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 당일 근로자 목록을 실시간 데이터로 동적 표시
  • 버그 수정

    • 누락된 데이터 필드에 대한 오류 처리 강화
  • 개선 사항

    • 워크스페이스 카드의 편집 기능 제거로 상호작용 단순화

@limtjdghks limtjdghks requested review from dohy-eon and kim3360 April 30, 2026 09:46
@limtjdghks limtjdghks self-assigned this Apr 30, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
alter-client Ready Ready Preview, Comment Apr 30, 2026 10:05am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Warning

Rate limit exceeded

@limtjdghks has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 15 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 653d016e-2cbb-4d1d-9e1b-d5350737f973

📥 Commits

Reviewing files that changed from the base of the PR and between f7f5818 and 45428f0.

📒 Files selected for processing (3)
  • src/features/home/manager/hooks/useManagedPostingsViewModel.ts
  • src/features/home/manager/hooks/useSubstituteRequestsViewModel.ts
  • src/features/home/manager/hooks/useTodaySchedulesViewModel.ts
📝 Walkthrough

🎯 핵심 리뷰 요약

Walkthrough

오늘의 스케줄을 동적으로 로드하는 API 클라이언트, React Query 훅, 타입을 추가하고, 하드코딩된 작업자 목록을 대체했습니다. 또한 Workspace 편집 콜백을 제거하고 응답 필드 부재에 대한 방어 로직을 강화했습니다.

Changes

Cohort / File(s) Summary
Today Schedules API & Types
src/features/home/manager/api/schedule.ts, src/features/home/manager/types/schedule.ts, src/shared/lib/queryKeys.ts
새로운 /manager/schedules/today 엔드포인트 호출 및 DTO 타입(TodayShiftDto, TodayWorkerDto, TodayScheduleApiResponse) 정의. Query 키 추가.
Today Schedules ViewModel
src/features/home/manager/hooks/useTodaySchedulesViewModel.ts
React Query를 활용한 스케줄 데이터 페칭 및 UI 항목(workTime 포함) 매핑. workspaceId null 체크 포함.
기존 ViewModel 방어 강화
src/features/home/manager/hooks/useManagedPostingsViewModel.ts, src/features/home/manager/hooks/useSubstituteRequestsViewModel.ts
Optional chaining을 통한 중첩 응답 필드 안전 처리.
Manager Home 통합
src/features/home/manager/hooks/useManagerHomeViewModel.ts, src/pages/manager/home/index.tsx
동적 todayWorkers 데이터로 전환. 하드코딩된 TODAY_WORKERS 제거.
Workspace 편집 기능 제거
src/features/home/manager/ui/WorkspaceChangeCard.tsx, src/features/home/manager/ui/WorkspaceChangeList.tsx
onEdit / onEditWorkspace 콜백 제거 및 편집 버튼 삭제.

🚨 핵심 이슈

1. 에러 처리 누락 (높음)

useTodaySchedulesViewModel에서 React Query 에러 상태 처리가 보이지 않습니다.

  • 문제: API 실패 시 UI 상태 관리 부재, 사용자에게 오류 전달 불가
  • 수정안:
const { data, isLoading, error } = useQuery(...)
return { todayWorkers, isLoading, error } // 또는 error 상태 처리

2. workTime 유도 로직의 안전성 (중간)

"첫 번째 shift의 start/end datetime"을 사용하지만, shifts 배열이 비어있는 경우 처리가 불명확합니다.

  • 문제: shifts[0] 접근 시 undefined 오류 가능
  • 수정안:
const shift = shifts?.[0]
const workTime = shift ? `${formatTime(shift.startDatetime)} ~ ${formatTime(shift.endDatetime)}` : '-'

3. Workspace 편집 기능 의도 확인 필요 (중간)

WorkspaceChangeCard에서 onEdit 콜백을 완전 제거했으나, 이것이 향후 기능 제거인지 또는 다른 방식으로 대체되는지 명확하지 않습니다.

  • 확인사항: PR 제목/설명에서 의도 명시 필요

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • PR #7: 정적 TODAY_WORKERS 및 UI 기초를 도입했으며, 본 PR이 이를 런타임 데이터 플로우(API, 타입, 훅)로 대체합니다.
  • PR #9: Manager home UI(WorkspaceChangeCard, WorkspaceChangeList) 및 스케줄 화면을 건드렸으며, 본 PR이 정적 today-worker UI를 동적 데이터로 전환합니다.
  • PR #13: Manager 스케줄 API/훅(월간)을 추가했으며, 본 PR이 같은 영역에 today-schedules API와 훅을 추가하므로 관련 있습니다.

Suggested reviewers

  • kim3360
  • dohy-eon
🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed PR 설명이 필수 섹션을 모두 포함하고 있으며, 변경 내용과 구현 사항이 구체적이고 명확하게 기술되어 있습니다.
Title check ✅ Passed PR 제목이 주요 변경사항을 정확하게 반영합니다. 사장님(매니저) 금일 스케줄 조회 API 연동이라는 핵심 목표를 명확하게 표현하고 있습니다.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ALT-180

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
Review rate limit: 0/1 reviews remaining, refill in 41 minutes and 15 seconds.

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

Copy link
Copy Markdown

@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: 2

🧹 Nitpick comments (1)
src/features/home/manager/hooks/useTodaySchedulesViewModel.ts (1)

6-6: ⚡ Quick win

UI 타입 의존성을 훅 밖으로 옮겨주세요.

useTodaySchedulesViewModelui/TodayWorkerListTodayWorkerItem 타입을 직접 가져오면 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6a4b513 and f7f5818.

📒 Files selected for processing (10)
  • src/features/home/manager/api/schedule.ts
  • src/features/home/manager/hooks/useManagedPostingsViewModel.ts
  • src/features/home/manager/hooks/useManagerHomeViewModel.ts
  • src/features/home/manager/hooks/useSubstituteRequestsViewModel.ts
  • src/features/home/manager/hooks/useTodaySchedulesViewModel.ts
  • src/features/home/manager/types/schedule.ts
  • src/features/home/manager/ui/WorkspaceChangeCard.tsx
  • src/features/home/manager/ui/WorkspaceChangeList.tsx
  • src/pages/manager/home/index.tsx
  • src/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

Comment thread src/features/home/manager/hooks/useManagedPostingsViewModel.ts Outdated
Comment thread src/features/home/manager/hooks/useSubstituteRequestsViewModel.ts Outdated
@limtjdghks limtjdghks changed the title [FE] 사장님 금일 스케줄 조회 API 연동 [feat] 사장님 금일 스케줄 조회 API 연동 Apr 30, 2026
@limtjdghks limtjdghks merged commit e2f10c8 into dev May 2, 2026
4 checks 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