feat: 공정 단계(ProcessStep) CRUD API 구현
- process_steps 테이블 마이그레이션 생성 (step_code, sort_order, boolean 플래그 등)
- ProcessStep 모델 생성 (child entity 패턴, HasFactory만 사용)
- ProcessStepService: CRUD + reorder + STP-001 자동채번
- ProcessStepController: DI + ApiResponse::handle 패턴
- FormRequest 3개: Store, Update, Reorder
- Process 모델에 steps() HasMany 관계 추가
- ProcessService eager-load에 steps 추가 (5곳)
- Nested routes: /processes/{processId}/steps
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,14 @@ public function items(): BelongsToMany
|
||||
->orderByPivot('priority');
|
||||
}
|
||||
|
||||
/**
|
||||
* 공정 단계
|
||||
*/
|
||||
public function steps(): HasMany
|
||||
{
|
||||
return $this->hasMany(ProcessStep::class)->orderBy('sort_order');
|
||||
}
|
||||
|
||||
/**
|
||||
* 작업지시들
|
||||
*/
|
||||
|
||||
42
app/Models/ProcessStep.php
Normal file
42
app/Models/ProcessStep.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ProcessStep extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'process_id',
|
||||
'step_code',
|
||||
'step_name',
|
||||
'is_required',
|
||||
'needs_approval',
|
||||
'needs_inspection',
|
||||
'is_active',
|
||||
'sort_order',
|
||||
'connection_type',
|
||||
'connection_target',
|
||||
'completion_type',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_required' => 'boolean',
|
||||
'needs_approval' => 'boolean',
|
||||
'needs_inspection' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* 공정
|
||||
*/
|
||||
public function process(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Process::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user