- biz_cert 테이블 생성 (사업자등록번호, 상호, 대표자, 개업일, 주소, 업태, 종목, 발급일)
- raw_text, ocr_method 필드 추가 (OCR 원본 텍스트 및 처리 방식 저장)
- biz_no, company_name 인덱스 추가
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Item 모델 files() 관계를 document_id/document_type 기반으로 변경
- show() 메서드에 files 로딩 및 field_key별 그룹화 추가
- item_type 파라미터 선택적 처리 (ID만으로 조회 가능)
- showWithPrice() 메서드 반환 타입 변경에 맞게 수정
- api_request_logs 테이블 생성 (하루치만 보관)
- LogApiRequest 미들웨어로 DB + 로그 파일 이중 저장
- 날짜별 로그 파일: storage/logs/api/api-YYYY-MM-DD.log
- 민감 데이터 자동 마스킹 (password, token 등)
- api-log:prune 스케줄러로 매일 03:00 자동 정리
- common_codes에 item_group 추가 및 item_type parent_id 연결
- /api/v1/items?type=RM → 단일 품목 유형 조회
- /api/v1/items?group_id=103 → 그룹 전체 품목 조회 (FG,PT,SM,RM,CS)
- ItemService에 getItemTypesByGroupId(), newQueryForTypes() 메서드 추가
- 에러 메시지 추가 (item_type_or_group_required, invalid_group_id)
- Order 모델: product_id 제거, item_id 추가, item() 관계 추가
- OrderItem 모델: product_id 제거, item_id 추가, item() 관계 추가
- Quote 모델: product_id 제거, item_id 추가, item() 관계 추가
- MaterialReceipt 모델: material_id 제거, item_id 추가, material() → item() 변경
- Lot 모델: Material import 제거, material() → item() 변경
DB 스키마는 이미 마이그레이션됨 (2025_12_13_153544)
기존 product_id/material_id 컬럼은 DB에 남아있지만 fillable에서 제거
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ItemsBomController: ProductBomService 제거, Item.bom JSON 기반으로 재구현
- ItemsFileController: Product/Material → Item 모델로 통합
- ItemPage: products/materials 클래스 매핑 제거
- ItemsService 삭제 (1,210줄) - ItemService로 대체 완료
BOM 기능 변경:
- 기존: ProductBomService (삭제됨)
- 변경: Item 모델의 bom JSON 필드 직접 조작
- 모든 BOM API 엔드포인트 정상 동작
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- BOM child_item_id를 새 items 테이블 ID로 마이그레이션
- Item.loadBomChildren() 수정: setRelation()으로 모델에 설정
- ItemService.validateBom() 추가: 순환 참조 방지
- error.php에 self_reference_bom 메시지 추가
- ID 7 자기참조 BOM 데이터 수정 완료
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- 동적 테이블 라우팅에서 item_type 필터 누락 버그 수정
- 모든 item_type이 동일한 결과를 반환하던 문제 해결
- CRUD 테스트 완료 (index/show/store/update/destroy)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- item_type → ItemPage.source_table → Model 클래스 동적 라우팅
- getModelInfoByItemType(): item_type으로 Model 정보 조회 (캐싱)
- newQuery(): 동적 Query Builder 생성
- 모든 CRUD 메서드 item_type 필수 파라미터로 변경
- ItemsController item_type 전달 로직 수정
- 에러 메시지 추가 (item_type_required, invalid_source_table)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- materials.material_code가 null인 경우 자동 코드 생성 (SM-000001 형식)
- item_id_mappings 테이블 중복 생성 방지 로직 추가
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
## 주요 변경사항
- Phase 0: 비표준 item_type 데이터 정규화 마이그레이션
- Phase 1.1: items 테이블 생성 (products + materials 통합)
- Phase 1.2: item_details 테이블 생성 (1:1 확장 필드)
- Phase 1.3: 데이터 이관 + item_id_mappings 테이블 생성
- Phase 3: item_pages.source_table 업데이트
- Phase 5: 참조 테이블 마이그레이션 (product_components, orders 등)
## 신규 파일
- app/Models/Items/Item.php - 통합 아이템 모델
- app/Models/Items/ItemDetail.php - 1:1 확장 필드 모델
- app/Services/ItemService.php - 통합 서비스 클래스
## 수정 파일
- ItemPage.php - items 테이블 지원 추가
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- file_type: ENUM → VARCHAR(50) 변경 (확장성 개선)
- field_key: VARCHAR(100) 신규 컬럼 (비즈니스 용도 구분)
- ItemsFileController: field_key 사용, file_type 자동 분류 (detectFileType)
- File 모델: fillable에 field_key 추가
- ItemsService: getItemFiles()에서 field_key로 그룹핑
- rollback_items_migration: FK 제약조건 처리 수정
- GET /items/{id}/files 엔드포인트 추가 (파일 목록 조회)
- document_type을 group_id('1')로 변경 (테이블명 대신 코드 기반)
- field_key 제한 해제 (자유롭게 지정 가능)
- 품목 상세 조회 시 files 필드 포함 (field_key별 그룹핑)
- ItemFileUploadRequest FormRequest 추가
- DELETE 라우트 파라미터를 {fileId}로 변경
- Items 테이블 생성 마이그레이션 추가
- ID 매핑 테이블 생성 마이그레이션 추가
- Products/Materials → Items 데이터 이관 마이그레이션 추가
- Products 테이블 BOM 컬럼 추가 마이그레이션
- item_fields unique 제약조건 수정 마이그레이션
- LOGICAL_RELATIONSHIPS.md 업데이트
- AuthApi Swagger 수정
- GET /items/{id} 응답에 BOM 확장 데이터 포함
- child_item_code, child_item_name, unit, specification 필드 추가
- expandBomData() 메서드 구현 (ItemsService)
- Product 모델 bom 캐스팅 추가
- ItemsFileController: files 테이블에 메타데이터 저장, products는 file_id 참조
- 저장 경로: storage/app/tenants/{tenant_id}/items/{year}/{month}/{stored_name}
- 파일명: 64bit 난수로 보안 강화 (bin2hex(random_bytes(8)))
- Swagger 문서: file_id 반환 및 저장 구조 설명 추가
- file-storage-guide.md 규격 준수
- 품목 삭제 시 모든 참조 테이블 사용 여부 체크 (Force Delete)
- Product: BOM 구성품/상위품목, BOM 템플릿, 주문, 견적
- Material: BOM 구성품, BOM 템플릿, 입고, LOT
- 사용 중인 품목 삭제 불가, 미사용 품목만 영구 삭제
- 일괄 삭제도 동일 로직 적용
- DuplicateCodeException 예외 처리 추가
- ApiResponse.handle()에서 정상 처리되도록 수정
- Handler.php에도 fallback 처리 추가
- i18n 에러 메시지 추가 (in_use, batch_in_use)
- DuplicateCodeException 커스텀 예외 추가
- 등록/수정 시 자동 코드 증가 기능 제거
- 중복 발견 시 duplicate_id, duplicate_code 함께 반환
- resolveUniqueCode(), resolveUniqueMaterialCode() 메서드 제거
- products 테이블에 options JSON 컬럼 추가 (마이그레이션)
- Material/Product 모델에 options 필드 추가 (fillable, casts)
- SystemFields::PRODUCTS에 options 상수 추가
- MaterialService/ProductService에 동적 필드 자동 추출 로직:
- getKnownFields(): SystemFields + ItemField 기반 고정 필드 조회
- extractDynamicOptions(): 동적 필드 추출
- normalizeOptions(): [{label, value, unit}] 형태로 정규화
- material_code 중복 체크 시 soft delete 포함 (withTrashed)
- 사용 중인 자재 삭제 방지 (checkMaterialUsage)
- Material 모델에 category 관계 추가
- ItemTypeHelper를 활용한 item_type(FG/PT/SM/RM/CS) → source_table 매핑
- getItem: item_type 파라미터로 products/materials 테이블 자동 결정
- deleteItem: item_type 필수 파라미터 추가
- batchDeleteItems: item_type별 일괄 삭제 지원
- 목록 조회 시 attributes 플랫 전개
- Swagger 문서 업데이트
- AttendanceController, AttendanceService 추가
- EmployeeController, EmployeeService 추가
- Attendance 모델 및 마이그레이션 추가
- TenantUserProfile에 employee_status 컬럼 추가
- DepartmentService 트리 조회 기능 개선
- Swagger 문서 추가 (AttendanceApi, EmployeeApi)
- API 라우트 등록
- SystemFields 상수 클래스 생성 (app/Constants/)
- source_table 기반 테이블별 예약어 관리
- products/materials 테이블 고정 컬럼 정의
- 공통 시스템 컬럼 포함
- ItemFieldService 수정
- validateFieldKeyUnique에 시스템 필드 검증 추가
- source_table 미지정시 그룹 전체 예약어 체크 (안전 모드)
- 에러 메시지 추가 (error.field_key_reserved)
- 작업 문서 추가 (docs/specs/item-master-field-key-validation.md)
- ItemField 모델: 소스 매핑 컬럼 추가 (source_table, source_column 등)
- ItemPage 모델: source_table 컬럼 추가
- ItemDataService: 동적 데이터 조회 서비스
- ItemMasterApi Swagger 업데이트
- ItemTypeSeeder: 품목 유형 시더
- 스펙 문서: ITEM_MASTER_FIELD_INTEGRATION_PLAN.md