# 단가관리 (Pricing) API 연동 계획 > **작성일**: 2026-01-08 > **상위 문서**: [construction-api-integration-plan.md](../construction-api-integration-plan.md) > **상태**: ⏳ 대기 > **API 상태**: ✅ 기존 API 존재 --- ## 1. 컴포넌트 분석 ### 1.1 파일 위치 ``` react/src/ ├── app/[locale]/(protected)/construction/order/base-info/pricing/ │ └── page.tsx └── components/business/construction/pricing-management/ ├── PricingListClient.tsx ├── actions.ts └── types.ts ``` ### 1.2 현재 Mock 데이터 **actions.ts 내 Mock 함수:** ```typescript // getPricingList에서 Mock 단가 데이터 생성 // 단가: 품목별 단가, 버전 관리, 적용일 등 ``` ### 1.3 현재 함수 목록 | 함수명 | 용도 | Mock 상태 | |--------|------|:--------:| | `getPricingList` | 단가 목록 조회 | ✅ Mock | | `getPricingStats` | 단가 통계 조회 | ✅ Mock | | `deletePricing` | 단가 삭제 | ✅ Mock | | `deletePricings` | 단가 일괄 삭제 | ✅ Mock | --- ## 2. 기존 API 분석 ### 2.1 기존 엔드포인트 (api/routes/api.php line 946-955) ```php Route::prefix('construction/pricing')->group(function () { Route::get('/', [PricingController::class, 'index']); Route::get('/cost', [PricingController::class, 'cost']); Route::get('/by-items', [PricingController::class, 'byItems']); Route::post('/', [PricingController::class, 'store']); Route::get('/{pricing}', [PricingController::class, 'show']); Route::put('/{pricing}', [PricingController::class, 'update']); Route::delete('/{pricing}', [PricingController::class, 'destroy']); Route::post('/{pricing}/finalize', [PricingController::class, 'finalize']); Route::get('/{pricing}/revisions', [PricingController::class, 'revisions']); }); ``` ### 2.2 API-컴포넌트 매핑 | 컴포넌트 함수 | API 엔드포인트 | 매핑 상태 | |--------------|---------------|:--------:| | `getPricingList` | `GET /construction/pricing` | ✅ 매핑 가능 | | `getPricingStats` | 없음 | ⚠️ 추가 필요 | | `deletePricing` | `DELETE /construction/pricing/{id}` | ✅ 매핑 가능 | | `deletePricings` | 없음 | ⚠️ bulk 추가 필요 | --- ## 3. 작업 항목 ### 3.1 Backend (API) | # | 작업 | 상태 | 비고 | |---|------|:----:|------| | 1 | stats 엔드포인트 추가 | ⏳ | | | 2 | bulk delete 엔드포인트 추가 | ⏳ | | | 3 | 프론트 타입과 정합성 확인 | ⏳ | | ### 3.2 Frontend (React) | # | 작업 | 상태 | 비고 | |---|------|:----:|------| | 1 | actions.ts Mock → API 변환 | ⏳ | | | 2 | API 클라이언트 연동 | ⏳ | | | 3 | 에러 핸들링 추가 | ⏳ | | | 4 | types.ts 정합성 확인 | ⏳ | | --- ## 4. 타입 정의 ### 4.1 Pricing 타입 ```typescript interface Pricing { id: string; itemId: string; itemName: string; itemCode: string; categoryId: string; categoryName: string; unitPrice: number; laborCost: number; materialCost: number; totalPrice: number; effectiveDate: string; expirationDate?: string; version: number; status: PricingStatus; createdAt: string; updatedAt: string; } type PricingStatus = 'draft' | 'active' | 'expired' | 'finalized'; ``` ### 4.2 PricingStats 타입 ```typescript interface PricingStats { total: number; active: number; expired: number; draft: number; averagePrice: number; } ``` --- ## 5. 변경 이력 | 날짜 | 작업 | 상태 | |------|------|------| | 2026-01-08 | 문서 초안 작성 | ✅ | --- *상위 문서: [construction-api-integration-plan.md](../construction-api-integration-plan.md)*