Skip to content

[refactor] 주요 조회 API 응답 검증 및 데이터 흐름 개선 - #19

Merged
bom0320 merged 11 commits into
mainfrom
refactor/architecture
Jul 22, 2026
Merged

[refactor] 주요 조회 API 응답 검증 및 데이터 흐름 개선#19
bom0320 merged 11 commits into
mainfrom
refactor/architecture

Conversation

@bom0320

@bom0320 bom0320 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

개요 💡

기존 주요 조회 API가 TypeScript 타입만 신뢰하고 있어 실제 서버 응답의 필드 누락, 타입 불일치, 예상하지 못한 상태값을 런타임에서 확인하기 어려웠습니다.

이에 주요 entity의 API 응답을 Zod Schema로 검증하고, API 요청 함수·TanStack Query Hook·Mapper·UI의 책임을 분리해 데이터 흐름을 일관된 구조로 정리했습니다.

작업내용 ⌨️

  • Reservation, Machine, User, Report, Dashboard 조회 응답에 Zod 런타임 검증 적용
  • API 응답을 unknown으로 수신한 뒤 검증된 데이터만 Mapper와 UI에 전달
  • Zod Schema에서 TypeScript 타입을 추론하도록 변경
  • 실제 응답에 맞게 예약 시간 필드와 penaltyExpiresAt의 nullable 타입 수정
  • API 요청 함수와 TanStack Query Hook 분리
  • Machine의 WASHER·DRYER 요청 및 검증 흐름 공통화
  • Dashboard API URL과 Query Key 중앙화
  • AdminLayout 내부의 Dashboard 조회 로직을 entity Hook으로 이동

@bom0320
bom0320 requested a review from LeeSangHyeok0731 July 21, 2026 07:21
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
washer Ready Ready Preview, Comment Jul 22, 2026 5:52am

Request Review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors API integration across multiple entities (dashboard, machine, report, reservation, and user) by introducing Zod schemas for robust runtime response validation and inferring TypeScript types directly from them. It also updates React Query hooks to utilize these schemas and refactored fetchers. The review feedback suggests improving import consistency by using double quotes in getReservations.ts, and optimizing performance by adding an enabled option to the useGetMachines hook so that machine data is only fetched in ReportsPage.tsx when a floor filter is actually selected.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/entities/reservation/api/getReservations.ts Outdated
Comment thread src/entities/machine/api/useGetMachines.ts Outdated
Comment thread src/widgets/reports-page/ReportsPage.tsx Outdated

@LeeSangHyeok0731 LeeSangHyeok0731 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Gemini code assist 코멘트만 확인하시면 될 것 같습니다.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@bom0320
bom0320 merged commit 8abbd57 into main Jul 22, 2026
3 checks passed
@bom0320
bom0320 deleted the refactor/architecture branch July 22, 2026 05:52
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