feat: [material] 부적합관리 결재 연동 구현
- Migration: approval_id FK 추가
- Model: approval() BelongsTo 관계
- Service: submitForApproval() 결재상신 (결재문서+결재선 생성)
- ApprovalService: 승인→CLOSED, 반려/회수→approval_id 해제
- Controller: POST /{id}/submit-approval 엔드포인트
- Route: submit-approval 라우트 등록
This commit is contained in:
@@ -66,4 +66,19 @@ public function changeStatus(Request $request, int $id): JsonResponse
|
||||
return $this->service->changeStatus($id, $request->input('status'));
|
||||
}, __('message.updated'));
|
||||
}
|
||||
|
||||
public function submitApproval(Request $request, int $id): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
'title' => 'nullable|string|max:200',
|
||||
'form_id' => 'nullable|integer',
|
||||
'steps' => 'required|array|min:1',
|
||||
'steps.*.approver_id' => 'required|integer',
|
||||
'steps.*.step_type' => 'nullable|string|in:approval,agreement,reference',
|
||||
]);
|
||||
|
||||
return ApiResponse::handle(function () use ($request, $id) {
|
||||
return $this->service->submitForApproval($id, $request->all());
|
||||
}, __('message.created'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user