v7.0.0-beta.1 release
This commit is contained in:
commit
6595fd0eb5
3967 files changed
+1875383
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Schedule;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use App\Models\Schedule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class BulkDeleteScheduleRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'ids' => 'required|array|min:1',
|
||||
'ids.*' => ['required', 'integer', Rule::exists(Schedule::class, 'id')],
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
return HookManager::applyFilters('core.schedule.bulk_delete_validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'ids.required' => __('schedule.validation.ids_required'),
|
||||
'ids.array' => __('schedule.validation.ids_array'),
|
||||
'ids.min' => __('schedule.validation.ids_min'),
|
||||
'ids.*.integer' => __('schedule.validation.id_integer'),
|
||||
'ids.*.exists' => __('schedule.validation.id_exists'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Schedule;
|
||||
|
||||
use App\Extension\HookManager;
|
||||
use App\Models\Schedule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class BulkUpdateScheduleStatusRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'ids' => 'required|array|min:1',
|
||||
'ids.*' => ['required', 'integer', Rule::exists(Schedule::class, 'id')],
|
||||
'is_active' => 'required|boolean',
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
return HookManager::applyFilters('core.schedule.bulk_update_status_validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'ids.required' => __('schedule.validation.ids_required'),
|
||||
'ids.array' => __('schedule.validation.ids_array'),
|
||||
'ids.min' => __('schedule.validation.ids_min'),
|
||||
'ids.*.integer' => __('schedule.validation.id_integer'),
|
||||
'ids.*.exists' => __('schedule.validation.id_exists'),
|
||||
'is_active.required' => __('schedule.validation.is_active_required'),
|
||||
'is_active.boolean' => __('schedule.validation.is_active_boolean'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Schedule;
|
||||
|
||||
use App\Enums\ExtensionOwnerType;
|
||||
use App\Enums\ScheduleFrequency;
|
||||
use App\Enums\ScheduleType;
|
||||
use App\Extension\HookManager;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CreateScheduleRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$types = implode(',', ScheduleType::values());
|
||||
$frequencies = implode(',', ScheduleFrequency::values());
|
||||
|
||||
$rules = [
|
||||
'name' => 'required|string|max:255',
|
||||
'description' => 'nullable|string|max:1000',
|
||||
'type' => "required|string|in:{$types}",
|
||||
'command' => 'required|string|max:2000',
|
||||
'expression' => 'required|string|max:100',
|
||||
'frequency' => "required|string|in:{$frequencies}",
|
||||
'without_overlapping' => 'boolean',
|
||||
'run_in_maintenance' => 'boolean',
|
||||
'timeout' => 'nullable|integer|min:1|max:86400',
|
||||
'is_active' => 'boolean',
|
||||
'extension_type' => 'nullable|string|in:'.implode(',', ExtensionOwnerType::values()),
|
||||
'extension_identifier' => 'nullable|string|max:255|required_with:extension_type',
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
return HookManager::applyFilters('core.schedule.create_validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'name.required' => __('schedule.validation.name_required'),
|
||||
'name.max' => __('schedule.validation.name_max'),
|
||||
'type.required' => __('schedule.validation.type_required'),
|
||||
'type.in' => __('schedule.validation.type_invalid'),
|
||||
'command.required' => __('schedule.validation.command_required'),
|
||||
'command.max' => __('schedule.validation.command_max'),
|
||||
'expression.required' => __('schedule.validation.expression_required'),
|
||||
'expression.max' => __('schedule.validation.expression_max'),
|
||||
'frequency.required' => __('schedule.validation.frequency_required'),
|
||||
'frequency.in' => __('schedule.validation.frequency_invalid'),
|
||||
'timeout.integer' => __('schedule.validation.timeout_integer'),
|
||||
'timeout.min' => __('schedule.validation.timeout_min'),
|
||||
'timeout.max' => __('schedule.validation.timeout_max'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'without_overlapping' => $this->without_overlapping ?? false,
|
||||
'run_in_maintenance' => $this->run_in_maintenance ?? false,
|
||||
'is_active' => $this->is_active ?? true,
|
||||
'created_by' => Auth::id(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증된 데이터 반환
|
||||
*/
|
||||
public function validatedWithCreator(): array
|
||||
{
|
||||
return array_merge($this->validated(), [
|
||||
'created_by' => Auth::id(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Schedule;
|
||||
|
||||
use App\Enums\ScheduleResultStatus;
|
||||
use App\Enums\ScheduleTriggerType;
|
||||
use App\Extension\HookManager;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ScheduleHistoryListRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$statuses = implode(',', array_diff(ScheduleResultStatus::values(), ['never']));
|
||||
$triggerTypes = implode(',', ScheduleTriggerType::values());
|
||||
|
||||
$rules = [
|
||||
'page' => 'integer|min:1',
|
||||
'per_page' => 'integer|min:1|max:100',
|
||||
|
||||
// 필터
|
||||
'status' => "nullable|string|in:{$statuses}",
|
||||
'trigger_type' => "nullable|string|in:{$triggerTypes}",
|
||||
|
||||
// 날짜 필터
|
||||
'started_from' => 'nullable|date',
|
||||
'started_to' => 'nullable|date|after_or_equal:started_from',
|
||||
|
||||
// 정렬
|
||||
'sort_by' => 'nullable|string|in:started_at,ended_at,duration,status',
|
||||
'sort_order' => 'nullable|string|in:asc,desc',
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
return HookManager::applyFilters('core.schedule.history_list_validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'page.integer' => __('schedule.validation.page_integer'),
|
||||
'page.min' => __('schedule.validation.page_min'),
|
||||
'per_page.integer' => __('schedule.validation.per_page_integer'),
|
||||
'per_page.min' => __('schedule.validation.per_page_min'),
|
||||
'per_page.max' => __('schedule.validation.per_page_max'),
|
||||
'status.in' => __('schedule.validation.history_status_invalid'),
|
||||
'trigger_type.in' => __('schedule.validation.trigger_type_invalid'),
|
||||
'started_from.date' => __('schedule.validation.started_from_invalid'),
|
||||
'started_to.date' => __('schedule.validation.started_to_invalid'),
|
||||
'started_to.after_or_equal' => __('schedule.validation.started_to_after_from'),
|
||||
'sort_by.in' => __('schedule.validation.sort_by_invalid'),
|
||||
'sort_order.in' => __('schedule.validation.sort_order_invalid'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$this->merge([
|
||||
'per_page' => $this->per_page ?? 15,
|
||||
'page' => $this->page ?? 1,
|
||||
'sort_by' => $this->sort_by ?? 'started_at',
|
||||
'sort_order' => $this->sort_order ?? 'desc',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Schedule;
|
||||
|
||||
use App\Enums\ExtensionOwnerType;
|
||||
use App\Enums\ScheduleFrequency;
|
||||
use App\Enums\ScheduleResultStatus;
|
||||
use App\Enums\ScheduleType;
|
||||
use App\Extension\HookManager;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ScheduleListRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* 검색 가능한 필드 목록
|
||||
*/
|
||||
public const SEARCHABLE_FIELDS = ['name', 'description', 'command'];
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$searchableFields = implode(',', array_merge(['all'], self::SEARCHABLE_FIELDS));
|
||||
$types = implode(',', ScheduleType::values());
|
||||
$frequencies = implode(',', ScheduleFrequency::values());
|
||||
$results = implode(',', ScheduleResultStatus::values());
|
||||
|
||||
$rules = [
|
||||
'page' => 'integer|min:1',
|
||||
'per_page' => 'integer|min:1|max:100',
|
||||
|
||||
// 다중 검색 조건
|
||||
'filters' => 'nullable|array|max:10',
|
||||
'filters.*.field' => "required_with:filters|string|in:{$searchableFields}",
|
||||
'filters.*.value' => 'required_with:filters|string|max:255',
|
||||
'filters.*.operator' => 'nullable|string|in:like,eq,starts_with,ends_with',
|
||||
|
||||
// 필터
|
||||
'type' => "nullable|string|in:{$types}",
|
||||
'frequency' => "nullable|string|in:{$frequencies}",
|
||||
'status' => 'nullable|string|in:active,inactive',
|
||||
'last_result' => "nullable|string|in:{$results}",
|
||||
'without_overlapping' => 'nullable|in:0,1',
|
||||
'run_in_maintenance' => 'nullable|in:0,1',
|
||||
'extension_type' => 'nullable|string|in:'.implode(',', ExtensionOwnerType::values()),
|
||||
'extension_identifier' => 'nullable|string|max:255',
|
||||
|
||||
// 날짜 필터
|
||||
'created_from' => 'nullable|date',
|
||||
'created_to' => 'nullable|date|after_or_equal:created_from',
|
||||
|
||||
// 정렬
|
||||
'sort_by' => 'nullable|string|in:created_at,name,next_run_at,last_run_at,is_active,last_result',
|
||||
'sort_order' => 'nullable|string|in:asc,desc',
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
return HookManager::applyFilters('core.schedule.list_validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'page.integer' => __('schedule.validation.page_integer'),
|
||||
'page.min' => __('schedule.validation.page_min'),
|
||||
'per_page.integer' => __('schedule.validation.per_page_integer'),
|
||||
'per_page.min' => __('schedule.validation.per_page_min'),
|
||||
'per_page.max' => __('schedule.validation.per_page_max'),
|
||||
'type.in' => __('schedule.validation.type_invalid'),
|
||||
'frequency.in' => __('schedule.validation.frequency_invalid'),
|
||||
'status.in' => __('schedule.validation.status_invalid'),
|
||||
'last_result.in' => __('schedule.validation.last_result_invalid'),
|
||||
'created_from.date' => __('schedule.validation.created_from_invalid'),
|
||||
'created_to.date' => __('schedule.validation.created_to_invalid'),
|
||||
'created_to.after_or_equal' => __('schedule.validation.created_to_after_from'),
|
||||
'sort_by.in' => __('schedule.validation.sort_by_invalid'),
|
||||
'sort_order.in' => __('schedule.validation.sort_order_invalid'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
// value가 비어있는 filters 제거
|
||||
$filters = $this->filters;
|
||||
if (is_array($filters)) {
|
||||
$filters = array_filter($filters, function ($filter) {
|
||||
return ! empty($filter['value']);
|
||||
});
|
||||
$filters = array_values($filters);
|
||||
$this->merge(['filters' => $filters ?: null]);
|
||||
}
|
||||
|
||||
// 기본값 설정
|
||||
$this->merge([
|
||||
'per_page' => $this->per_page ?? 15,
|
||||
'page' => $this->page ?? 1,
|
||||
'sort_by' => $this->sort_by ?? 'created_at',
|
||||
'sort_order' => $this->sort_order ?? 'desc',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Schedule;
|
||||
|
||||
use App\Enums\ExtensionOwnerType;
|
||||
use App\Enums\ScheduleFrequency;
|
||||
use App\Enums\ScheduleType;
|
||||
use App\Extension\HookManager;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateScheduleRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$types = implode(',', ScheduleType::values());
|
||||
$frequencies = implode(',', ScheduleFrequency::values());
|
||||
|
||||
$rules = [
|
||||
'name' => 'sometimes|required|string|max:255',
|
||||
'description' => 'nullable|string|max:1000',
|
||||
'type' => "sometimes|required|string|in:{$types}",
|
||||
'command' => 'sometimes|required|string|max:2000',
|
||||
'expression' => 'sometimes|required|string|max:100',
|
||||
'frequency' => "sometimes|required|string|in:{$frequencies}",
|
||||
'without_overlapping' => 'boolean',
|
||||
'run_in_maintenance' => 'boolean',
|
||||
'timeout' => 'nullable|integer|min:1|max:86400',
|
||||
'is_active' => 'boolean',
|
||||
'extension_type' => 'nullable|string|in:'.implode(',', ExtensionOwnerType::values()),
|
||||
'extension_identifier' => 'nullable|string|max:255|required_with:extension_type',
|
||||
];
|
||||
|
||||
// 모듈/플러그인이 validation rules를 동적으로 추가할 수 있도록 훅 제공
|
||||
return HookManager::applyFilters('core.schedule.update_validation_rules', $rules, $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom messages for validator errors.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'name.required' => __('schedule.validation.name_required'),
|
||||
'name.max' => __('schedule.validation.name_max'),
|
||||
'type.required' => __('schedule.validation.type_required'),
|
||||
'type.in' => __('schedule.validation.type_invalid'),
|
||||
'command.required' => __('schedule.validation.command_required'),
|
||||
'command.max' => __('schedule.validation.command_max'),
|
||||
'expression.required' => __('schedule.validation.expression_required'),
|
||||
'expression.max' => __('schedule.validation.expression_max'),
|
||||
'frequency.required' => __('schedule.validation.frequency_required'),
|
||||
'frequency.in' => __('schedule.validation.frequency_invalid'),
|
||||
'timeout.integer' => __('schedule.validation.timeout_integer'),
|
||||
'timeout.min' => __('schedule.validation.timeout_min'),
|
||||
'timeout.max' => __('schedule.validation.timeout_max'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user