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 문서 업데이트
This commit is contained in:
2025-12-09 21:51:46 +09:00
parent 9d5f0ba4ca
commit cde89b2fb3
7 changed files with 367 additions and 93 deletions

View File

@@ -14,6 +14,9 @@ public function authorize(): bool
public function rules(): array
{
return [
// 품목 유형 (필수 - 테이블 분기용)
'item_type' => 'required|string|in:FG,PT,SM,RM,CS',
// 선택 필드 (모두 sometimes)
'code' => 'sometimes|string|max:50',
'name' => 'sometimes|string|max:255',
@@ -36,12 +39,23 @@ public function rules(): array
// 동적 필드 (JSON)
'attributes' => 'sometimes|array',
// Material 전용 필드
'material_code' => 'sometimes|string|max:50',
'item_name' => 'nullable|string|max:255',
'specification' => 'nullable|string|max:255',
'is_inspection' => 'nullable|string|in:Y,N',
'search_tag' => 'nullable|string|max:255',
'remarks' => 'nullable|string',
'options' => 'nullable|array',
];
}
public function messages(): array
{
return [
'item_type.required' => '품목 유형은 필수입니다.',
'item_type.in' => '품목 유형은 FG, PT, SM, RM, CS 중 하나여야 합니다.',
'code.max' => '품목코드는 50자 이내로 입력하세요.',
'name.max' => '품목명은 255자 이내로 입력하세요.',
'product_type.in' => '품목 유형은 FG, PT, SM, RM, CS 중 하나여야 합니다.',