# 현장관리 (Site Management) API 연동 계획 > **작성일**: 2026-01-08 > **상위 문서**: [construction-api-integration-plan.md](../construction-api-integration-plan.md) > **상태**: ⏳ 대기 --- ## 1. 컴포넌트 분석 ### 1.1 파일 위치 ``` react/src/ ├── app/[locale]/(protected)/construction/order/site-management/ │ └── page.tsx └── components/business/construction/site-management/ ├── SiteManagementListClient.tsx ├── actions.ts └── types.ts ``` ### 1.2 현재 Mock 데이터 **actions.ts 내 MOCK_SITES:** ```typescript const MOCK_SITES: Site[] = [ { id: '1', siteCode: '123123', partnerId: '1', partnerName: '회사명', siteName: '현장명', address: '-', status: 'unregistered', createdAt: '2025-09-01T00:00:00Z', updatedAt: '2025-09-01T00:00:00Z', }, // ... 총 7개 현장 ]; ``` ### 1.3 현재 함수 목록 | 함수명 | 용도 | Mock 상태 | |--------|------|:--------:| | `getSiteList` | 현장 목록 조회 | ✅ Mock | | `getSiteStats` | 현장 통계 조회 | ✅ Mock | | `deleteSite` | 현장 삭제 | ✅ Mock | | `deleteSites` | 현장 일괄 삭제 | ✅ Mock | --- ## 2. API 설계 ### 2.1 엔드포인트 | Method | Endpoint | 용도 | |--------|----------|------| | GET | `/api/construction/sites` | 목록 조회 | | GET | `/api/construction/sites/stats` | 통계 조회 | | GET | `/api/construction/sites/{id}` | 상세 조회 | | POST | `/api/construction/sites` | 등록 | | PUT | `/api/construction/sites/{id}` | 수정 | | DELETE | `/api/construction/sites/{id}` | 삭제 | | DELETE | `/api/construction/sites/bulk` | 일괄 삭제 | ### 2.2 요청/응답 스키마 **목록 조회 Request:** ```typescript interface GetSiteListParams { page?: number; size?: number; startDate?: string; endDate?: string; partnerId?: string; status?: SiteStatus; search?: string; } ``` --- ## 3. 작업 항목 ### 3.1 Backend (API) | # | 작업 | 상태 | 비고 | |---|------|:----:|------| | 1 | SiteController 확인/수정 | ⏳ | 이미 import 존재 | | 2 | SiteService 생성 | ⏳ | | | 3 | SiteFormRequest 생성 | ⏳ | | | 4 | Site 모델 확인/수정 | ⏳ | | | 5 | routes/api.php 등록 | ⏳ | | | 6 | Swagger 문서 작성 | ⏳ | | ### 3.2 Frontend (React) | # | 작업 | 상태 | 비고 | |---|------|:----:|------| | 1 | actions.ts Mock → API 변환 | ⏳ | | | 2 | API 클라이언트 연동 | ⏳ | | | 3 | 에러 핸들링 추가 | ⏳ | | | 4 | types.ts 정합성 확인 | ⏳ | | --- ## 4. 타입 정의 ### 4.1 Site 타입 ```typescript interface Site { id: string; siteCode: string; partnerId: string; partnerName: string; siteName: string; address: string; status: SiteStatus; createdAt: string; updatedAt: string; } type SiteStatus = 'active' | 'suspended' | 'unregistered' | 'pending'; ``` ### 4.2 SiteStats 타입 ```typescript interface SiteStats { total: number; construction: number; unregistered: number; } ``` --- ## 5. 변경 이력 | 날짜 | 작업 | 상태 | |------|------|------| | 2026-01-08 | 문서 초안 작성 | ✅ | --- *상위 문서: [construction-api-integration-plan.md](../construction-api-integration-plan.md)*