Commit Graph

389 Commits

Author SHA1 Message Date
ba528b5a13 feat: API 요청/응답 로깅 시스템 추가
- api_request_logs 테이블 생성 (하루치만 보관)
- LogApiRequest 미들웨어로 DB + 로그 파일 이중 저장
- 날짜별 로그 파일: storage/logs/api/api-YYYY-MM-DD.log
- 민감 데이터 자동 마스킹 (password, token 등)
- api-log:prune 스케줄러로 매일 03:00 자동 정리
2025-12-15 15:16:38 +09:00
23fd59dc88 refactor: group_id 네이밍 통일 (code_group='group', code='1')
- 마이그레이션: code_group='item_group' → 'group', code='ITEM' → '1'
- ItemService: group_id로 code 조회 후 parent_id 매칭
- API: /api/v1/items?group_id=1 → 품목 그룹 전체 조회
2025-12-15 14:59:07 +09:00
b1bcad3be6 feat: Items API에 group_id 파라미터 지원 추가
- 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)
2025-12-15 14:47:04 +09:00
aaf7979d5f fix: ItemsFileController 파일 API 오류 수정
- delete() 메서드  타입을 mixed로 변경 + 내부 캐스팅
- userId null 처리 (auth()->id() ?? app('api_user'))
- deleteFile() private 메서드로 삭제 로직 일원화
- getFileUrl()을 file_id 기반으로 변경 (/api/v1/files/{id}/download)
- LOGICAL_RELATIONSHIPS.md items 통합 반영
2025-12-15 13:56:12 +09:00
18ef35a873 refactor: 레거시 product_id/material_id 컬럼 삭제
- orders.product_id 삭제
- order_items.product_id 삭제
- quotes.product_id 삭제
- material_receipts.material_id 삭제
- lots.material_id 삭제

items 테이블 통합 완료로 더 이상 불필요한 컬럼 정리

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 01:25:43 +09:00
4f3b218441 feat: Phase 5 - 참조 테이블 모델 item_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>
2025-12-14 01:23:05 +09:00
20ad6da164 fix: P0 Critical 이슈 수정 - 삭제된 Product/Material 참조 제거
- 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>
2025-12-14 01:10:25 +09:00
039fd623df refactor: products/materials 테이블 및 관련 코드 삭제
- products, materials, product_components 테이블 삭제 마이그레이션
- FK 제약조건 정리 (orders, order_items, material_receipts, lots)
- 관련 Models 삭제: Product, Material, ProductComponent 등
- 관련 Controllers 삭제: ProductController, MaterialController, ProductBomItemController
- 관련 Services 삭제: ProductService, MaterialService, ProductBomService
- 관련 Requests, Swagger 파일 삭제
- 라우트 정리: /products, /materials 엔드포인트 제거

모든 품목 관리는 /items 엔드포인트로 통합됨
item_id_mappings 테이블에 ID 매핑 보존

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-14 00:20:09 +09:00
a486595d07 fix: ItemService update() 동적 필드 병합 버그 수정
- 기존 item.options 기반으로 동적 필드 병합하도록 수정
- 일부 필드만 변경 시 나머지 필드가 보존됨
- Item-Master 연동 테스트 완료

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-14 00:10:46 +09:00
d2bdecf063 feat: BOM 테스트 및 데이터 마이그레이션
- 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>
2025-12-13 23:53:16 +09:00
9cc7cd1428 fix: ItemService newQuery()에 item_type 필터 추가
- 동적 테이블 라우팅에서 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>
2025-12-13 23:41:47 +09:00
d1afa6e05e feat: ItemService 동적 테이블 라우팅 구현
- 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>
2025-12-13 23:28:06 +09:00
a93dfe7b19 docs: Phase 6 마이그레이션 실행 결과 업데이트
- items 362개, item_details 362개, item_id_mappings 362개 이관 완료
- item_pages 47개 source_table='items'로 통합
- product_components, orders 등 참조 테이블 item_id 매핑 완료

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-13 15:45:48 +09:00
bc77d72ba6 fix: 데이터 이관 마이그레이션 null 코드 처리 추가
- 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>
2025-12-13 15:44:59 +09:00
80281e65b7 feat: Items 테이블 통합 마이그레이션 Phase 0-5 구현
## 주요 변경사항
- 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>
2025-12-13 15:41:30 +09:00
aa9746ae2f feat: files 테이블 field_key 컬럼 추가 및 file_type VARCHAR 변경
- 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 제약조건 처리 수정
2025-12-12 18:29:14 +09:00
2e4d4d3be3 feat: Items Files API 개선 - group_id 기반, 동적 field_key 지원
- GET /items/{id}/files 엔드포인트 추가 (파일 목록 조회)
- document_type을 group_id('1')로 변경 (테이블명 대신 코드 기반)
- field_key 제한 해제 (자유롭게 지정 가능)
- 품목 상세 조회 시 files 필드 포함 (field_key별 그룹핑)
- ItemFileUploadRequest FormRequest 추가
- DELETE 라우트 파라미터를 {fileId}로 변경
2025-12-12 17:38:22 +09:00
b6bea99cd9 fix: Items 이관 마이그레이션 비활성화
- 데이터 이관 로직 임시 비활성화
- item_type 컬럼 길이 문제로 정책 정리 후 재작업 예정
2025-12-12 09:54:56 +09:00
33260d5333 fix: Items 이관 롤백 마이그레이션 추가
- items, item_id_mappings 테이블 삭제
- 정책 정리 후 재작업 예정
2025-12-12 09:45:37 +09:00
a636311168 feat: Items 테이블 통합 마이그레이션 및 문서 정리
- Items 테이블 생성 마이그레이션 추가
- ID 매핑 테이블 생성 마이그레이션 추가
- Products/Materials → Items 데이터 이관 마이그레이션 추가
- Products 테이블 BOM 컬럼 추가 마이그레이션
- item_fields unique 제약조건 수정 마이그레이션
- LOGICAL_RELATIONSHIPS.md 업데이트
- AuthApi Swagger 수정
2025-12-12 08:52:00 +09:00
84ff9d7fd8 feat: Items API BOM 데이터 확장 기능 추가
- GET /items/{id} 응답에 BOM 확장 데이터 포함
  - child_item_code, child_item_name, unit, specification 필드 추가
- expandBomData() 메서드 구현 (ItemsService)
- Product 모델 bom 캐스팅 추가
2025-12-11 23:17:52 +09:00
cc3feb1927 feat: 품목 파일 업로드를 files 테이블 기반으로 변경
- 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 규격 준수
2025-12-11 22:40:55 +09:00
86ef841277 feat: 품목 삭제 로직 개선 및 중복 코드 예외 처리 보완
- 품목 삭제 시 모든 참조 테이블 사용 여부 체크 (Force Delete)
  - Product: BOM 구성품/상위품목, BOM 템플릿, 주문, 견적
  - Material: BOM 구성품, BOM 템플릿, 입고, LOT
- 사용 중인 품목 삭제 불가, 미사용 품목만 영구 삭제
- 일괄 삭제도 동일 로직 적용
- DuplicateCodeException 예외 처리 추가
  - ApiResponse.handle()에서 정상 처리되도록 수정
  - Handler.php에도 fallback 처리 추가
- i18n 에러 메시지 추가 (in_use, batch_in_use)
2025-12-11 19:01:07 +09:00
07f0db17a7 feat: 품목 코드 중복 시 에러 반환 및 중복 ID 제공
- DuplicateCodeException 커스텀 예외 추가
- 등록/수정 시 자동 코드 증가 기능 제거
- 중복 발견 시 duplicate_id, duplicate_code 함께 반환
- resolveUniqueCode(), resolveUniqueMaterialCode() 메서드 제거
2025-12-11 11:07:33 +09:00
d5ab522902 feat: Items API is_active 필터/반환 및 동적 필드 지원
- 목록 조회에 is_active 필드 반환 및 필터 파라미터 추가
- 상세 조회에서 options 동적 필드 플랫 전개
- 생성/수정 시 동적 필드 options 저장 지원
2025-12-11 09:56:01 +09:00
b086518075 feat: Material/Product 동적 필드 options 저장 및 자재 삭제 보호
- 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 관계 추가
2025-12-10 21:37:20 +09:00
cde89b2fb3 feat: Items API item_type 기반 통합 조회/삭제 개선
- ItemTypeHelper를 활용한 item_type(FG/PT/SM/RM/CS) → source_table 매핑
- getItem: item_type 파라미터로 products/materials 테이블 자동 결정
- deleteItem: item_type 필수 파라미터 추가
- batchDeleteItems: item_type별 일괄 삭제 지원
- 목록 조회 시 attributes 플랫 전개
- Swagger 문서 업데이트
2025-12-09 21:51:46 +09:00
9d5f0ba4ca fix: ItemTypeHelper CommonCode 모델 경로 수정
- App\Models\CommonCode → App\Models\Products\CommonCode
- Items 삭제 시 발생하던 Class not found 에러 해결
2025-12-09 21:47:58 +09:00
386eeb280f chore: 구버전 문서 정리 (docs 저장소로 이관)
- Item Master 관련 구버전 문서 삭제 (docs 저장소로 이관)
- 프론트엔드 요청서 삭제 (history 폴더로 아카이브)
- HR API 규칙 문서 삭제 (docs 저장소로 통합)
2025-12-09 20:28:06 +09:00
d9d2bbdacf docs: API 문서 인덱스 및 테스트 플로우 정리
- docs/INDEX.md 업데이트
- API 테스트 플로우 파일 추가
- LOGICAL_RELATIONSHIPS.md 업데이트
2025-12-09 20:27:54 +09:00
f1f4c52c31 feat: 근태관리/직원관리 API 구현
- AttendanceController, AttendanceService 추가
- EmployeeController, EmployeeService 추가
- Attendance 모델 및 마이그레이션 추가
- TenantUserProfile에 employee_status 컬럼 추가
- DepartmentService 트리 조회 기능 개선
- Swagger 문서 추가 (AttendanceApi, EmployeeApi)
- API 라우트 등록
2025-12-09 20:27:44 +09:00
33010f1916 feat: ItemTypeSeeder에 attributes.source_table 매핑 추가
- common_codes 테이블 item_type 그룹에 source_table 매핑 추가
- FG/PT → products, SM/RM/CS → materials 테이블 매핑
- attributes JSON에 name_en 영문명 추가
2025-12-09 20:27:30 +09:00
da44168464 fix: API 메뉴 권한 로직을 mng와 동일하게 수정
- MenuService, MemberService 권한 조회 로직 재작성
- 부서 권한: permission_overrides 테이블 사용 (Department 타입)
- 개인 권한: permission_overrides 테이블 사용 (User 타입)
- 권한 계산: (역할 ∪ 부서 ∪ 개인ALLOW) - 개인DENY
- User model_type을 'App\Models\User'로 하드코딩 (mng 호환)
2025-12-09 20:18:32 +09:00
d16f0410b8 feat: field_key 시스템 필드 예약어 검증 추가
- SystemFields 상수 클래스 생성 (app/Constants/)
  - source_table 기반 테이블별 예약어 관리
  - products/materials 테이블 고정 컬럼 정의
  - 공통 시스템 컬럼 포함
- ItemFieldService 수정
  - validateFieldKeyUnique에 시스템 필드 검증 추가
  - source_table 미지정시 그룹 전체 예약어 체크 (안전 모드)
- 에러 메시지 추가 (error.field_key_reserved)
- 작업 문서 추가 (docs/specs/item-master-field-key-validation.md)
2025-12-09 14:06:35 +09:00
004324d65b docs: 사원관리/근태관리/부서트리 API 규칙 문서 추가
- docs/rules/employee-api.md: 사원관리 API 규칙 문서
- docs/rules/attendance-api.md: 근태관리 API 규칙 문서
- docs/rules/department-tree-api.md: 부서트리 조회 API 규칙 문서
2025-12-09 11:39:27 +09:00
0600a2f822 docs: Items API show 메서드 Swagger 추가 2025-12-09 10:30:35 +09:00
b2b3b27f17 docs: 작업 현황 및 관계 문서 업데이트 2025-12-09 09:40:01 +09:00
c4a4f85e63 feat: QuoteApi Swagger 추가 및 서비스 수정
- QuoteApi: 견적 API Swagger 문서 추가
- Board 모델, GlobalMenuService, MenuSyncService 오류 수정
2025-12-09 09:39:41 +09:00
bf92b37ff6 feat: 품목 마스터 소스 매핑 기능 추가
- ItemField 모델: 소스 매핑 컬럼 추가 (source_table, source_column 등)
- ItemPage 모델: source_table 컬럼 추가
- ItemDataService: 동적 데이터 조회 서비스
- ItemMasterApi Swagger 업데이트
- ItemTypeSeeder: 품목 유형 시더
- 스펙 문서: ITEM_MASTER_FIELD_INTEGRATION_PLAN.md
2025-12-09 09:39:16 +09:00
46d4c30880 chore: 마이그레이션 파일 안정화 (anonymousClass 추가) 2025-12-09 09:38:56 +09:00
5f200054ea feat: clients.is_active CHAR(1) → TINYINT(1) Boolean 마이그레이션
- DB: CHAR(1) 'Y'/'N' → TINYINT(1) 0/1 컬럼 타입 변경
- Model: boolean 캐스트 추가, scopeActive() 수정
- Service: toggle(), index() Boolean 로직 적용
- FormRequest: 'in:Y,N' → 'boolean' 검증 규칙 변경
- Swagger: is_active type string → boolean 변경
2025-12-08 20:25:38 +09:00
8d3ea4bb39 feat: 단가 관리 API 구현 및 Flow Tester 호환성 개선
- Price, PriceRevision 모델 추가 (PriceHistory 대체)
- PricingService: CRUD, 원가 조회, 확정 기능
- PricingController: statusCode 파라미터로 201 반환 지원
- NotFoundHttpException(404) 적용 (존재하지 않는 리소스)
- FormRequest 분리 (Store, Update, Index, Cost, ByItems)
- Swagger 문서 업데이트
- ApiResponse::handle()에 statusCode 옵션 추가
- prices/price_revisions 마이그레이션 및 데이터 이관
2025-12-08 19:03:50 +09:00
56c707f033 fix : 품목 목록 조회 (통합) - 정렬 역순 2025-12-08 10:38:25 +09:00
5131bfff98 feat: item_fields 테이블에 is_active 컬럼 추가
- 마이그레이션: is_active 컬럼 추가 (기본값 true)
- ItemField 모델: fillable, casts에 is_active 추가
- ItemFieldService: store, storeIndependent, clone, update 메서드에 is_active 처리
- FormRequest: is_active 유효성 검사 규칙 추가
- API Flow 테스트 시나리오 추가 (docs/api-flows/)
- docs/INDEX.md에 api-flows 섹션 추가

ModelTrait::scopeActive() 메서드 사용을 위한 필수 컬럼
2025-12-05 14:40:09 +09:00
c946fa457c chore: API Flow Tester 설정 및 문서 업데이트
- flow-tester-auth.json: 인증 API 테스트 설정 추가
- flow-tester-client.json: Client API 테스트 설정 업데이트
- flow-tester-item-master.json: ItemMaster API 테스트 설정 추가
- LOGICAL_RELATIONSHIPS.md: 논리 관계 문서 업데이트
2025-12-04 22:22:46 +09:00
2b57910ca5 chore: 누락된 마이그레이션 추가
- create_quote_formula_tables: 견적 수식 테이블 5개
  - quote_formula_categories (카테고리)
  - quote_formulas (수식)
  - quote_formula_ranges (범위값)
  - quote_formula_mappings (매핑값)
  - quote_formula_items (품목 출력)

- add_api_logs_to_admin_api_flow_runs_table: API Flow 로그 컬럼
2025-12-04 22:20:09 +09:00
40ca8b8697 feat: [quote] 견적 API Phase 2-3 완료 (Service + Controller Layer)
Phase 2 - Service Layer:
- QuoteService: 견적 CRUD + 상태관리 (확정/전환)
- QuoteNumberService: 견적번호 채번 (KD-{PREFIX}-YYMMDD-SEQ)
- FormulaEvaluatorService: 수식 평가 엔진 (SUM, IF, ROUND 등)
- QuoteCalculationService: 자동산출 (스크린/철재 제품)
- QuoteDocumentService: PDF 생성 및 이메일/카카오 발송

Phase 3 - Controller Layer:
- QuoteController: 16개 엔드포인트
- FormRequest 7개: Index, Store, Update, BulkDelete, Calculate, SendEmail, SendKakao
- QuoteApi.php: Swagger 문서 (12개 스키마, 16개 엔드포인트)
- routes/api.php: 16개 라우트 등록

i18n 키 추가:
- error.php: quote_not_found, formula_* 등
- message.php: quote.* 성공 메시지
2025-12-04 22:03:40 +09:00
d164bb4c4a feat: [client] 거래처 API 2차 필드 추가 및 견적 계획 업데이트
- 거래처 유형(client_type), 연락처(mobile, fax), 담당자 정보 필드 추가
- 발주처 설정(account_id/password, payment_day) 필드 추가
- 약정 세금(tax_agreement, tax_amount, tax_start/end_date) 필드 추가
- 악성채권(bad_debt 관련 5개 필드) 정보 필드 추가
- Model, Service, FormRequest, Swagger 문서 업데이트
- 견적 API 계획에 문서 발송 API(email/fax/kakao) 요구사항 추가
2025-12-04 21:13:58 +09:00
96e9a0ba18 feat: [quote] 견적관리 API 기반 구축 (Phase 1)
- 마이그레이션 생성: quotes, quote_items, quote_revisions 테이블
- Model 생성: Quote, QuoteItem, QuoteRevision
- BelongsToTenant, SoftDeletes 트레이트 적용
- 상태 관리 메서드 및 스코프 구현
- 개발 계획서 작성 및 진행 상황 문서화
2025-12-04 17:17:05 +09:00
ccd8b6f81d feat: [quote] 수식 시더 품목/매핑 데이터 추가
- QuoteFormulaSeeder: CONTROLLER_TYPE input 수식 추가
- QuoteFormulaItemSeeder: 14개 품목 마스터 (GR, CASE, MOTOR, CTRL, EDGE, INSP)
- QuoteFormulaMappingSeeder: CTRL_AUTO_SELECT 매핑 3건 (매립형/노출형/일체형)
2025-12-04 16:23:39 +09:00