feat: Product API 하이브리드 구조 지원 (Phase 1)

[FormRequest 업데이트]
- ProductStoreRequest, ProductUpdateRequest에 하이브리드 필드 추가
  - 고정 필드: safety_stock, lead_time, is_variable_size, product_category, part_type
  - 동적 필드: attributes, attributes_archive
  - unit 필드 추가
- is_active → 제거 (모델과 일치)
- boolean 검증 개선 (in:0,1 → boolean)

[ProductService 업데이트]
- store/update 메서드 중복 Validator 제거 (FormRequest가 검증)
- 기본값 설정 간소화 (true/false로 통일)
- is_active 관련 로직 주석처리
  - index 메서드 필터
  - toggle 메서드 비활성화
  - search 메서드 select 컬럼 수정
- Validator import 제거

[ProductController 업데이트]
- toggle 메서드 주석처리 (is_active 제거에 따름)

[기능 변경]
- 기존: 고정 필드 위주
- 변경: 하이브리드 구조 (최소 고정 + attributes JSON)
- attributes를 통해 테넌트별 커스텀 필드 지원

[비고]
- is_active는 필요시 attributes JSON이나 별도 필드로 재구현 가능
- toggle 기능도 필요시 복원 가능 (주석으로 보존)
This commit is contained in:
2025-11-14 12:42:08 +09:00
parent 4b04d6db87
commit e848e12412
4 changed files with 78 additions and 70 deletions

View File

@@ -70,11 +70,13 @@ public function search(Request $request)
}, __('message.product.searched'));
}
// Note: toggle 메서드는 is_active 필드 제거로 인해 비활성화됨
// 필요시 attributes JSON이나 별도 필드로 구현
// POST /products/{id}/toggle
public function toggle(int $id)
{
return ApiResponse::handle(function () use ($id) {
return $this->service->toggle($id);
}, __('message.product.toggled'));
}
// public function toggle(int $id)
// {
// return ApiResponse::handle(function () use ($id) {
// return $this->service->toggle($id);
// }, __('message.product.toggled'));
// }
}