feat: MaterialApi.php Swagger 점검 및 개선 (Phase 3-2)
- MaterialStoreRequest.php 생성 (검증 로직 분리) - MaterialUpdateRequest.php 생성 (검증 로직 분리) - MaterialApi.php 경로 수정 (/api/v1/products/materials) - MaterialController.php Swagger 주석 제거, FormRequest 적용 - lang/ko/message.php material 메시지 키 추가 - SAM API Development Rules 준수 완료
This commit is contained in:
32
app/Http/Requests/Material/MaterialStoreRequest.php
Normal file
32
app/Http/Requests/Material/MaterialStoreRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Material;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class MaterialStoreRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'category_id' => 'nullable|integer',
|
||||
'name' => 'required|string|max:100',
|
||||
'unit' => 'required|string|max:20',
|
||||
'is_inspection' => 'nullable|in:Y,N',
|
||||
'search_tag' => 'nullable|string|max:255',
|
||||
'remarks' => 'nullable|string|max:500',
|
||||
'attributes' => 'nullable|array',
|
||||
'attributes.*.label' => 'required|string|max:50',
|
||||
'attributes.*.value' => 'required|string|max:100',
|
||||
'attributes.*.unit' => 'nullable|string|max:20',
|
||||
'options' => 'nullable|array',
|
||||
'material_code' => 'nullable|string|max:30',
|
||||
'specification' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/Http/Requests/Material/MaterialUpdateRequest.php
Normal file
32
app/Http/Requests/Material/MaterialUpdateRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Material;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class MaterialUpdateRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'category_id' => 'nullable|integer',
|
||||
'name' => 'sometimes|string|max:100',
|
||||
'unit' => 'sometimes|string|max:20',
|
||||
'is_inspection' => 'nullable|in:Y,N',
|
||||
'search_tag' => 'nullable|string|max:255',
|
||||
'remarks' => 'nullable|string|max:500',
|
||||
'attributes' => 'nullable|array',
|
||||
'attributes.*.label' => 'required|string|max:50',
|
||||
'attributes.*.value' => 'required|string|max:100',
|
||||
'attributes.*.unit' => 'nullable|string|max:20',
|
||||
'options' => 'nullable|array',
|
||||
'material_code' => 'nullable|string|max:30',
|
||||
'specification' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user