From a94cdf6eed756038125ffe68557030c472f3d930 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Thu, 19 Mar 2026 10:33:58 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[item-master]=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20422=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - field_key regex를 숫자 시작도 허용하도록 변경 (기존 데이터 39건 호환) - Handler.php 422 응답에 errors 최상위 필드 추가 (프론트엔드 호환) --- app/Exceptions/Handler.php | 1 + app/Http/Requests/ItemMaster/IndependentFieldStoreRequest.php | 2 +- app/Http/Requests/ItemMaster/ItemFieldStoreRequest.php | 2 +- app/Http/Requests/ItemMaster/ItemFieldUpdateRequest.php | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 3928ffed..671d3b3b 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -84,6 +84,7 @@ public function render($request, Throwable $exception) return response()->json([ 'success' => false, 'message' => '입력값 검증 실패', + 'errors' => $exception->errors(), 'error' => [ 'code' => 422, 'details' => $exception->errors(), diff --git a/app/Http/Requests/ItemMaster/IndependentFieldStoreRequest.php b/app/Http/Requests/ItemMaster/IndependentFieldStoreRequest.php index 52acba9f..3350d6b2 100644 --- a/app/Http/Requests/ItemMaster/IndependentFieldStoreRequest.php +++ b/app/Http/Requests/ItemMaster/IndependentFieldStoreRequest.php @@ -16,7 +16,7 @@ public function rules(): array return [ 'group_id' => 'nullable|integer', 'field_name' => 'required|string|max:255', - 'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z][a-zA-Z0-9_]*$/', + 'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z0-9][a-zA-Z0-9_]*$/', 'field_type' => 'required|in:textbox,number,dropdown,checkbox,date,textarea', 'is_required' => 'nullable|boolean', 'default_value' => 'nullable|string', diff --git a/app/Http/Requests/ItemMaster/ItemFieldStoreRequest.php b/app/Http/Requests/ItemMaster/ItemFieldStoreRequest.php index 9092538e..ecaaadd5 100644 --- a/app/Http/Requests/ItemMaster/ItemFieldStoreRequest.php +++ b/app/Http/Requests/ItemMaster/ItemFieldStoreRequest.php @@ -16,7 +16,7 @@ public function rules(): array return [ 'group_id' => 'nullable|integer|min:1', // 계층번호 'field_name' => 'required|string|max:255', - 'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z][a-zA-Z0-9_]*$/', + 'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z0-9][a-zA-Z0-9_]*$/', 'field_type' => 'required|in:textbox,number,dropdown,checkbox,date,textarea', 'is_required' => 'nullable|boolean', 'default_value' => 'nullable|string', diff --git a/app/Http/Requests/ItemMaster/ItemFieldUpdateRequest.php b/app/Http/Requests/ItemMaster/ItemFieldUpdateRequest.php index cd919314..51c5236f 100644 --- a/app/Http/Requests/ItemMaster/ItemFieldUpdateRequest.php +++ b/app/Http/Requests/ItemMaster/ItemFieldUpdateRequest.php @@ -15,7 +15,7 @@ public function rules(): array { return [ 'field_name' => 'sometimes|string|max:255', - 'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z][a-zA-Z0-9_]*$/', + 'field_key' => 'nullable|string|max:80|regex:/^[a-zA-Z0-9][a-zA-Z0-9_]*$/', 'field_type' => 'sometimes|in:textbox,number,dropdown,checkbox,date,textarea', 'is_required' => 'nullable|boolean', 'default_value' => 'nullable|string',