Files
sam-api/docs/front/[API-2025-11-26] item-master-api-changes.md

121 lines
2.6 KiB
Markdown
Raw Normal View History

# Item Master API 변경사항
**작성일**: 2025-11-26
**대상**: 프론트엔드 개발팀
**관련 문서**: `[API-2025-11-25] item-master-data-management-api-request.md`
---
## 구조 변경
**`section_templates` 테이블 삭제** → `item_sections``is_template=true`로 통합
---
## 변경된 API
### 섹션 템플릿 필드/BOM API
| 요청서 | 실제 구현 |
|--------|----------|
| `POST /section-templates/{id}/fields` | `POST /sections/{id}/fields` |
| `POST /section-templates/{id}/bom-items` | `POST /sections/{id}/bom-items` |
→ 템플릿도 섹션이므로 동일 API 사용
---
## 신규 API
### 1. 독립 섹션 API
| API | 설명 |
|-----|------|
| `GET /sections?is_template=true` | 템플릿 목록 조회 |
| `GET /sections?is_template=false` | 일반 섹션 목록 |
| `POST /sections` | 독립 섹션 생성 |
| `POST /sections/{id}/clone` | 섹션 복제 |
| `GET /sections/{id}/usage` | 사용처 조회 (어느 페이지에서 사용중인지) |
**Request** (`POST /sections`):
```json
{
"group_id": 1,
"title": "섹션명",
"type": "fields|bom",
"is_template": false,
"is_default": false,
"description": null
}
```
### 2. 독립 필드 API
| API | 설명 |
|-----|------|
| `GET /fields` | 필드 목록 |
| `POST /fields` | 독립 필드 생성 |
| `POST /fields/{id}/clone` | 필드 복제 |
| `GET /fields/{id}/usage` | 사용처 조회 |
**Request** (`POST /fields`):
```json
{
"group_id": 1,
"field_name": "필드명",
"field_type": "textbox|number|dropdown|checkbox|date|textarea",
"is_required": false,
"default_value": null,
"placeholder": null,
"options": [],
"properties": []
}
```
### 3. 독립 BOM API
| API | 설명 |
|-----|------|
| `GET /bom-items` | BOM 목록 |
| `POST /bom-items` | 독립 BOM 생성 |
**Request** (`POST /bom-items`):
```json
{
"group_id": 1,
"item_code": null,
"item_name": "품목명",
"quantity": 0,
"unit": null,
"unit_price": 0,
"spec": null,
"note": null
}
```
### 4. 링크 관리 API
| API | 설명 |
|-----|------|
| `POST /pages/{id}/link-section` | 페이지에 섹션 연결 |
| `DELETE /pages/{id}/unlink-section/{sectionId}` | 연결 해제 |
| `POST /sections/{id}/link-field` | 섹션에 필드 연결 |
| `DELETE /sections/{id}/unlink-field/{fieldId}` | 연결 해제 |
| `GET /pages/{id}/structure` | 페이지 전체 구조 조회 |
**Request** (link 계열):
```json
{
"target_id": 1,
"order_no": 0
}
```
**Response** (usage 계열):
```json
{
"used_in_pages": [{ "id": 1, "page_name": "기본정보" }],
"used_in_sections": [{ "id": 2, "title": "스펙정보" }]
}
```