feat: Item Master 하이브리드 구조 전환 및 독립 API 추가
- CASCADE FK → 독립 엔티티 + entity_relationships 링크 테이블 - 독립 API 10개 추가 (섹션/필드/BOM CRUD, clone, usage) - SectionTemplate 모델 제거 → ItemSection.is_template 통합 - 페이지-섹션, 섹션-필드, 섹션-BOM 링크/언링크 API 14개 추가 - Swagger 문서 업데이트
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
use App\Models\ItemMaster\CustomTab;
|
||||
use App\Models\ItemMaster\ItemMasterField;
|
||||
use App\Models\ItemMaster\ItemPage;
|
||||
use App\Models\ItemMaster\SectionTemplate;
|
||||
use App\Models\ItemMaster\ItemSection;
|
||||
use App\Models\ItemMaster\UnitOption;
|
||||
use App\Services\Service;
|
||||
|
||||
@@ -15,7 +15,7 @@ class ItemMasterService extends Service
|
||||
* 초기화 데이터 로드
|
||||
*
|
||||
* - pages (섹션/필드 중첩)
|
||||
* - sectionTemplates
|
||||
* - sectionTemplates (is_template=true인 섹션)
|
||||
* - masterFields
|
||||
* - customTabs (columnSetting 포함)
|
||||
* - unitOptions
|
||||
@@ -24,10 +24,10 @@ public function init(): array
|
||||
{
|
||||
$tenantId = $this->tenantId();
|
||||
|
||||
// 1. 페이지 (섹션 → 필드 중첩)
|
||||
// 1. 페이지 (섹션 → 필드 중첩) - 템플릿 제외
|
||||
$pages = ItemPage::with([
|
||||
'sections' => function ($query) {
|
||||
$query->orderBy('order_no');
|
||||
$query->nonTemplates()->orderBy('order_no');
|
||||
},
|
||||
'sections.fields' => function ($query) {
|
||||
$query->orderBy('order_no');
|
||||
@@ -38,8 +38,11 @@ public function init(): array
|
||||
->where('is_active', 1)
|
||||
->get();
|
||||
|
||||
// 2. 섹션 템플릿
|
||||
$sectionTemplates = SectionTemplate::where('tenant_id', $tenantId)->get();
|
||||
// 2. 섹션 템플릿 (is_template=true인 섹션)
|
||||
$sectionTemplates = ItemSection::templates()
|
||||
->where('tenant_id', $tenantId)
|
||||
->with(['fields', 'bomItems'])
|
||||
->get();
|
||||
|
||||
// 3. 마스터 필드
|
||||
$masterFields = ItemMasterField::where('tenant_id', $tenantId)->get();
|
||||
|
||||
Reference in New Issue
Block a user