Skip to content

fix: 기사 견적 API 경로 수정 및 fetchInstance 적용 - #45

Closed
yooseohyeon wants to merge 1 commit into
devfrom
fix/mover-estimate-fetch-client
Closed

fix: 기사 견적 API 경로 수정 및 fetchInstance 적용#45
yooseohyeon wants to merge 1 commit into
devfrom
fix/mover-estimate-fetch-client

Conversation

@yooseohyeon

@yooseohyeon yooseohyeon commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

해당 수정사항은 추후 리팩토링 브랜치에서 반영될 예정으로 close함


📋 작업 내용

기사 견적 요청 관련 API 호출을 axiosInstance에서 프로젝트 공통 fetchInstance로 전환했습니다.
환경변수의 API base URL에 이미 /api가 포함되어 있어 요청 경로가 /api/api/...로 생성될 수 있던 문제도 함께 수정했습니다.


🔥 변경 사항

  • 기사 견적 관련 API 4개를 fetchInstance로 전환
    • 기사 견적 요청 목록 조회
    • 기사 견적 전송
    • 기사 견적 반려
    • 기사 견적 반려 내역 조회
  • /api를 직접 붙이지 않고 API_ROUTES.ESTIMATES의 전용 경로 상수를 사용하도록 변경
    • REQUESTS
    • SEND
    • REJECT
    • REJECTIONS
  • fetchInstance가 공통 응답의 data를 반환하고 실패 응답을 ApiError로 처리하므로, 개별 API의 response.data.success 분기를 제거
  • Axios 응답 전체를 표현하던 타입을 실제 API 반환 데이터 타입으로 단순화
    • MoverEstimateRequestListResult
    • RejectedEstimateRequestListResult
    • SentEstimate
    • RejectedEstimate

✅ 체크리스트

  • 로컬에서 정상 동작을 확인했습니다.
  • 기존 기능에 영향을 주지 않는지 확인했습니다.
  • 불필요한 console.log를 제거했습니다.
  • lint를 통과했습니다.
  • README 또는 문서를 수정했습니다. (필요 시)
  • API 명세와 일치하는지 확인했습니다.

📷 스크린샷 (선택)

API 클라이언트 및 요청 경로 변경으로 별도의 UI 변경은 없습니다.


💬 To Reviewer

  • 현재 다른 API 클라이언트는 모두 NEXT_PUBLIC_API_BASE_URL/api가 포함된 구성을 기준으로 하고 있기 때문에, 이에 맞게 .env 및 코드가 수정되어야 합니다. (현재 임시로 사용 중인 axiosInstance에서는 경로 앞에 /api를 추가하는 로직이 있는 것으로 파악되지만, 프로젝트 공통인 fetchInstance는 그렇지 않습니다)
  • 기존 Axios 응답 타입과 수동 성공 여부 분기를 제거하고, 공통 fetchInstance의 응답·에러 처리 방식을 사용하도록 변경했습니다.
  • upstream에서 추가된 API_ROUTES.ESTIMATES의 전용 경로 상수를 유지하면서 fetchInstance 전환 내용을 반영했습니다.

Summary by CodeRabbit

  • 개선 사항
    • 견적 요청 목록, 전송, 반려 및 반려 내역 조회 기능의 응답 처리가 간소화되었습니다.
    • 견적 요청 및 반려 내역 목록에서 데이터와 페이지 정보를 더욱 일관된 형식으로 제공합니다.
    • API 오류 처리와 응답 처리가 개선되어 기능 안정성이 향상되었습니다.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

견적 요청 API가 axiosInstance에서 fetchInstance로 전환되었습니다. 성공/실패 응답 래퍼와 수동 오류 처리가 제거되었습니다. 목록 및 반려 내역은 직접 반환되는 결과 타입을 사용합니다.

Changes

견적 요청 API 전환

Layer / File(s) Summary
응답 결과 타입 정의
src/types/moverEstimateRequest.ts
목록 응답의 성공/실패 래퍼를 제거했습니다. itemspagination을 직접 포함하는 결과 타입을 추가했습니다.
fetchInstance API 연동
src/lib/api/moverEstimateRequests.ts
견적 요청 목록 조회, 전송, 반려, 반려 내역 조회가 fetchInstance의 반환값을 직접 사용합니다. success 검사와 수동 오류 생성을 제거했습니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: soooob43

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 기사 견적 API 경로 수정과 fetchInstance 적용이라는 주요 변경 사항을 정확하고 간결하게 설명합니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mover-estimate-fetch-client

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

@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.

🧹 Nitpick comments (1)
src/types/moverEstimateRequest.ts (1)

31-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

객체 응답 타입을 interface로 변경하세요.

MoverEstimateRequestListResultRejectedEstimateRequestListResult는 객체 형태의 API 응답 타입입니다. 프로젝트 규칙에 따라 type 대신 interface를 우선 사용하세요.

변경 예시
-export type MoverEstimateRequestListResult = {
+export interface MoverEstimateRequestListResult {
   items: MoverEstimateRequest[];
   pagination: {
     nextCursor: string | null;
     hasNextPage: boolean;
     totalCount: number;
   };
-};
+}

-export type RejectedEstimateRequestListResult = {
+export interface RejectedEstimateRequestListResult {
   items: RejectedEstimateRequestItem[];
   pagination: {
     nextCursor: string | null;
     hasNextPage: boolean;
   };
-};
+}

As per coding guidelines, interface를 우선 사용합니다.

Also applies to: 91-97

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/types/moverEstimateRequest.ts` around lines 31 - 38, Change the object
response declarations MoverEstimateRequestListResult and
RejectedEstimateRequestListResult from type aliases to interfaces, preserving
their existing properties and nested pagination shape unchanged.

Sources: Coding guidelines, Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/types/moverEstimateRequest.ts`:
- Around line 31-38: Change the object response declarations
MoverEstimateRequestListResult and RejectedEstimateRequestListResult from type
aliases to interfaces, preserving their existing properties and nested
pagination shape unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a93f6fb-af34-4325-8323-2e5829091539

📥 Commits

Reviewing files that changed from the base of the PR and between e5c4723 and d9f8ac0.

📒 Files selected for processing (2)
  • src/lib/api/moverEstimateRequests.ts
  • src/types/moverEstimateRequest.ts

@soooob43

soooob43 commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

앗 서현님 감사합니다! 근데 제가 어제부터 리팩토링을 진행하면서 커밋까지 해둔 영역이라, 변경 사항이 겹칠 것 같네요.. 어떻게 할까요
서현님 PR 머지하고 제가 충돌나면 해결하는 게 좋을까요..?

@yooseohyeon yooseohyeon closed this Aug 1, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Aug 1, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants