- Models: AdminPmProject, AdminPmTask, AdminPmIssue - Services: ProjectService, TaskService, IssueService, ImportService - API Controllers: ProjectController, TaskController, IssueController, ImportController - FormRequests: Store/Update/BulkAction 요청 검증 - Views: 대시보드, 프로젝트 CRUD, JSON Import 화면 - Routes: API 42개 + Web 6개 엔드포인트 주요 기능: - 프로젝트/작업/이슈 계층 구조 관리 - 상태 변경, 우선순위, 마감일 추적 - 작업 순서 드래그앤드롭 (reorder API) - JSON Import로 일괄 등록 - Soft Delete 및 복원
85 lines
2.8 KiB
PHP
85 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\ProjectManagement;
|
|
|
|
use App\Models\Admin\AdminPmTask;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreTaskRequest 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.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'project_id' => 'required|exists:admin_pm_projects,id',
|
|
'title' => 'required|string|max:255',
|
|
'description' => 'nullable|string|max:5000',
|
|
'status' => 'nullable|in:'.implode(',', array_keys(AdminPmTask::getStatuses())),
|
|
'priority' => 'nullable|in:'.implode(',', array_keys(AdminPmTask::getPriorities())),
|
|
'due_date' => 'nullable|date',
|
|
'sort_order' => 'nullable|integer|min:0',
|
|
'assignee_id' => 'nullable|exists:users,id',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'project_id' => '프로젝트',
|
|
'title' => '작업 제목',
|
|
'description' => '작업 설명',
|
|
'status' => '상태',
|
|
'priority' => '우선순위',
|
|
'due_date' => '마감일',
|
|
'sort_order' => '정렬 순서',
|
|
'assignee_id' => '담당자',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the error messages for the defined validation rules.
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'project_id.required' => '프로젝트를 선택해주세요.',
|
|
'project_id.exists' => '존재하지 않는 프로젝트입니다.',
|
|
'title.required' => '작업 제목은 필수입니다.',
|
|
'title.max' => '작업 제목은 최대 255자까지 입력 가능합니다.',
|
|
'description.max' => '작업 설명은 최대 5000자까지 입력 가능합니다.',
|
|
'status.in' => '올바른 상태를 선택해주세요.',
|
|
'priority.in' => '올바른 우선순위를 선택해주세요.',
|
|
'due_date.date' => '올바른 날짜 형식이 아닙니다.',
|
|
'sort_order.integer' => '정렬 순서는 숫자여야 합니다.',
|
|
'assignee_id.exists' => '존재하지 않는 담당자입니다.',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Prepare the data for validation.
|
|
*/
|
|
protected function prepareForValidation(): void
|
|
{
|
|
// 기본값 설정
|
|
if (! $this->has('status')) {
|
|
$this->merge(['status' => AdminPmTask::STATUS_TODO]);
|
|
}
|
|
if (! $this->has('priority')) {
|
|
$this->merge(['priority' => AdminPmTask::PRIORITY_MEDIUM]);
|
|
}
|
|
}
|
|
}
|