feat: TenantApi.php & CategoryApi.php Swagger 점검 및 개선 (Phase 3-5, 3-6)
Phase 3-5 (TenantApi.php): - TenantStoreRequest.php 생성 (검증 로직 분리) - TenantUpdateRequest.php 생성 (검증 로직 분리) - TenantController.php FormRequest 적용 및 DI 패턴 적용 - TenantService static 호출 → DI 인스턴스 호출 - lang/ko/message.php tenant 메시지 키 추가 Phase 3-6 (CategoryApi.php): - CategoryStoreRequest.php 생성 (검증 로직 분리) - CategoryUpdateRequest.php 생성 (검증 로직 분리) - CategoryMoveRequest.php 생성 (카테고리 이동 검증) - CategoryReorderRequest.php 생성 (정렬순서 일괄 변경 검증) - CategoryController.php FormRequest 적용 - lang/ko/message.php category 메시지 키 추가 - SAM API Development Rules 준수 완료
This commit is contained in:
21
app/Http/Requests/Category/CategoryMoveRequest.php
Normal file
21
app/Http/Requests/Category/CategoryMoveRequest.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Category;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CategoryMoveRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'parent_id' => 'nullable|integer|exists:categories,id',
|
||||
'sort_order' => 'nullable|integer',
|
||||
];
|
||||
}
|
||||
}
|
||||
22
app/Http/Requests/Category/CategoryReorderRequest.php
Normal file
22
app/Http/Requests/Category/CategoryReorderRequest.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Category;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CategoryReorderRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'items' => 'required|array',
|
||||
'items.*.id' => 'required|integer|exists:categories,id',
|
||||
'items.*.sort_order' => 'required|integer',
|
||||
];
|
||||
}
|
||||
}
|
||||
25
app/Http/Requests/Category/CategoryStoreRequest.php
Normal file
25
app/Http/Requests/Category/CategoryStoreRequest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Category;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CategoryStoreRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'parent_id' => 'nullable|integer|exists:categories,id',
|
||||
'code' => 'nullable|string|max:50',
|
||||
'name' => 'required|string|max:100',
|
||||
'description' => 'nullable|string|max:255',
|
||||
'is_active' => 'nullable|boolean',
|
||||
'sort_order' => 'nullable|integer',
|
||||
];
|
||||
}
|
||||
}
|
||||
25
app/Http/Requests/Category/CategoryUpdateRequest.php
Normal file
25
app/Http/Requests/Category/CategoryUpdateRequest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Category;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CategoryUpdateRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'parent_id' => 'nullable|integer|exists:categories,id',
|
||||
'code' => 'nullable|string|max:50',
|
||||
'name' => 'sometimes|string|max:100',
|
||||
'description' => 'nullable|string|max:255',
|
||||
'is_active' => 'nullable|boolean',
|
||||
'sort_order' => 'nullable|integer',
|
||||
];
|
||||
}
|
||||
}
|
||||
25
app/Http/Requests/Tenant/TenantStoreRequest.php
Normal file
25
app/Http/Requests/Tenant/TenantStoreRequest.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Tenant;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class TenantStoreRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'company_name' => 'required|string|max:100',
|
||||
'email' => 'nullable|email|max:100',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
'address' => 'nullable|string|max:255',
|
||||
'business_num' => 'nullable|string|max:20',
|
||||
'ceo_name' => 'nullable|string|max:100',
|
||||
];
|
||||
}
|
||||
}
|
||||
26
app/Http/Requests/Tenant/TenantUpdateRequest.php
Normal file
26
app/Http/Requests/Tenant/TenantUpdateRequest.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Tenant;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class TenantUpdateRequest extends FormRequest
|
||||
{
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'tenant_id' => 'required|integer|exists:tenants,id',
|
||||
'company_name' => 'sometimes|string|max:100',
|
||||
'email' => 'nullable|email|max:100',
|
||||
'phone' => 'nullable|string|max:20',
|
||||
'address' => 'nullable|string|max:255',
|
||||
'business_num' => 'nullable|string|max:20',
|
||||
'ceo_name' => 'nullable|string|max:100',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user