- construction-api-integration-plan.md: 전체 완료 상태로 업데이트 - labor-plan.md: 노임관리 API 연동 완료 확인 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
145 lines
3.6 KiB
Markdown
145 lines
3.6 KiB
Markdown
# 노임관리 (Labor) API 연동 계획
|
|
|
|
> **작성일**: 2026-01-08
|
|
> **상위 문서**: [construction-api-integration-plan.md](../construction-api-integration-plan.md)
|
|
> **상태**: ✅ 완료
|
|
> **완료일**: 2026-01-12
|
|
|
|
---
|
|
|
|
## 1. 컴포넌트 분석
|
|
|
|
### 1.1 파일 위치
|
|
```
|
|
react/src/
|
|
├── app/[locale]/(protected)/construction/order/base-info/labor/
|
|
│ └── page.tsx
|
|
└── components/business/construction/labor-management/
|
|
├── LaborManagementClient.tsx
|
|
├── actions.ts
|
|
└── types.ts
|
|
```
|
|
|
|
### 1.2 현재 Mock 데이터
|
|
|
|
**actions.ts 내 Mock 함수:**
|
|
```typescript
|
|
// getLaborList에서 Mock 노임 데이터 생성
|
|
// 노임: 직종, 일당, 시급, 적용일 등
|
|
```
|
|
|
|
### 1.3 현재 함수 목록
|
|
|
|
| 함수명 | 용도 | Mock 상태 |
|
|
|--------|------|:--------:|
|
|
| `getLaborList` | 노임 목록 조회 | ✅ Mock |
|
|
| `getLaborStats` | 노임 통계 조회 | ✅ Mock |
|
|
| `deleteLabor` | 노임 삭제 | ✅ Mock |
|
|
| `deleteLaborBulk` | 노임 일괄 삭제 | ✅ Mock |
|
|
|
|
---
|
|
|
|
## 2. API 설계
|
|
|
|
### 2.1 엔드포인트
|
|
|
|
| Method | Endpoint | 용도 |
|
|
|--------|----------|------|
|
|
| GET | `/api/construction/labor` | 목록 조회 |
|
|
| GET | `/api/construction/labor/stats` | 통계 조회 |
|
|
| GET | `/api/construction/labor/{id}` | 상세 조회 |
|
|
| POST | `/api/construction/labor` | 등록 |
|
|
| PUT | `/api/construction/labor/{id}` | 수정 |
|
|
| DELETE | `/api/construction/labor/{id}` | 삭제 |
|
|
| DELETE | `/api/construction/labor/bulk` | 일괄 삭제 |
|
|
|
|
### 2.2 요청/응답 스키마
|
|
|
|
**목록 조회 Request:**
|
|
```typescript
|
|
interface GetLaborListParams {
|
|
page?: number;
|
|
size?: number;
|
|
jobType?: string;
|
|
status?: LaborStatus;
|
|
search?: string;
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 3. 작업 항목
|
|
|
|
### 3.1 Backend (API)
|
|
|
|
| # | 작업 | 상태 | 비고 |
|
|
|---|------|:----:|------|
|
|
| 1 | LaborController 생성 | ✅ | `api/app/Http/Controllers/Api/V1/LaborController.php` |
|
|
| 2 | LaborService 생성 | ✅ | `api/app/Services/LaborService.php` |
|
|
| 3 | LaborFormRequest 생성 | ✅ | `LaborIndexRequest`, `LaborStoreRequest`, `LaborUpdateRequest`, `LaborBulkDeleteRequest` |
|
|
| 4 | Labor 모델 생성 | ✅ | `api/app/Models/Labor.php` |
|
|
| 5 | routes/api.php 등록 | ✅ | `/labor` prefix |
|
|
| 6 | Swagger 문서 작성 | ⚠️ | 추후 보완 필요 |
|
|
|
|
### 3.2 Frontend (React)
|
|
|
|
| # | 작업 | 상태 | 비고 |
|
|
|---|------|:----:|------|
|
|
| 1 | actions.ts Mock → API 변환 | ✅ | apiClient 사용 |
|
|
| 2 | API 클라이언트 연동 | ✅ | 완료 |
|
|
| 3 | 에러 핸들링 추가 | ✅ | try-catch 구현 |
|
|
| 4 | types.ts 정합성 확인 | ✅ | 완료 |
|
|
|
|
---
|
|
|
|
## 4. 타입 정의
|
|
|
|
### 4.1 Labor 타입
|
|
|
|
```typescript
|
|
interface Labor {
|
|
id: string;
|
|
laborCode: string;
|
|
jobType: string; // 직종 (예: 목공, 철근공, 용접공)
|
|
jobCategory: string; // 직종 분류
|
|
dailyWage: number; // 일당
|
|
hourlyWage: number; // 시급
|
|
effectiveDate: string; // 적용일
|
|
expirationDate?: string; // 만료일
|
|
status: LaborStatus;
|
|
description?: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
type LaborStatus = 'active' | 'inactive' | 'expired';
|
|
```
|
|
|
|
### 4.2 LaborStats 타입
|
|
|
|
```typescript
|
|
interface LaborStats {
|
|
total: number;
|
|
active: number;
|
|
inactive: number;
|
|
averageDailyWage: number;
|
|
byJobCategory: {
|
|
category: string;
|
|
count: number;
|
|
averageWage: number;
|
|
}[];
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 5. 변경 이력
|
|
|
|
| 날짜 | 작업 | 상태 |
|
|
|------|------|------|
|
|
| 2026-01-08 | 문서 초안 작성 | ✅ |
|
|
| 2026-01-12 | Backend + Frontend API 연동 완료 확인 | ✅ |
|
|
|
|
---
|
|
|
|
*상위 문서: [construction-api-integration-plan.md](../construction-api-integration-plan.md)* |