fix: 회원가입 메뉴 생성 오류 수정 및 검증 에러 처리 개선
주요 변경사항: - MenusStep.php: 존재하지 않는 컬럼(code, route_name, depth, description) 제거 - MenusStep.php: 실제 DB 스키마 컬럼(hidden, is_external, external_url) 추가 - RecipeRegistry.php: MenusStep 비활성화 (하이브리드 메뉴 생성 방식 도입) - Handler.php: ValidationException 처리 개선 (실제 에러 메시지 표시, 422 상태 코드) 기술 세부사항: - 하이브리드 접근: TenantBootstrapper(데이터) + MenuBootstrapService(메뉴) - HTTP 상태 코드 표준화: 422 Unprocessable Entity (validation 실패) - 실제 검증 에러 메시지 반환: errors 객체에 필드별 에러 정보 포함
This commit is contained in:
@@ -58,14 +58,22 @@ public function render($request, Throwable $exception)
|
||||
{
|
||||
|
||||
if ($request->expectsJson()) {
|
||||
// 400 Bad Request (예: ValidationException)
|
||||
if (
|
||||
$exception instanceof ValidationException ||
|
||||
$exception instanceof BadRequestHttpException
|
||||
) {
|
||||
// 422 Unprocessable Entity - Validation 실패
|
||||
if ($exception instanceof ValidationException) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '필수 파라미터 누락',
|
||||
'message' => '입력값 검증 실패',
|
||||
'data' => [
|
||||
'errors' => $exception->errors(),
|
||||
],
|
||||
], 422);
|
||||
}
|
||||
|
||||
// 400 Bad Request
|
||||
if ($exception instanceof BadRequestHttpException) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '잘못된 요청',
|
||||
'data' => null,
|
||||
], 400);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ public function steps(string $recipe = 'STANDARD'): array
|
||||
default => [ // STANDARD
|
||||
new CapabilityProfilesStep,
|
||||
new CategoriesStep,
|
||||
new MenusStep,
|
||||
// new MenusStep, // Disabled: Use MenuBootstrapService in RegisterService instead
|
||||
new SettingsStep,
|
||||
],
|
||||
};
|
||||
|
||||
@@ -49,14 +49,13 @@ public function run(int $tenantId): void
|
||||
'tenant_id' => $tenantId,
|
||||
'parent_id' => $newParentId,
|
||||
'name' => $menu->name,
|
||||
'code' => $menu->code ?? null,
|
||||
'icon' => $menu->icon ?? null,
|
||||
'url' => $menu->url ?? null,
|
||||
'route_name' => $menu->route_name ?? null,
|
||||
'sort_order' => $menu->sort_order ?? 0,
|
||||
'is_active' => $menu->is_active ?? 1,
|
||||
'depth' => $menu->depth ?? 0,
|
||||
'description' => $menu->description ?? null,
|
||||
'hidden' => $menu->hidden ?? 0,
|
||||
'is_external' => $menu->is_external ?? 0,
|
||||
'external_url' => $menu->external_url ?? null,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user