From c558606954aa0fb4b17ea07b6cbc1a99b246c5b3 Mon Sep 17 00:00:00 2001 From: hskwon Date: Mon, 10 Nov 2025 09:44:22 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20?= =?UTF-8?q?API=20=EC=9D=91=EB=8B=B5=EC=97=90=20=EB=A9=94=EB=89=B4=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 주요 변경사항: - RegisterService.php: 생성된 메뉴 정보를 조회해서 응답에 포함 - RegisterApi.php: Swagger 문서에 menus 배열 스키마 추가 응답 구조: { user: {...}, tenant: {...}, menus: [ {id, parent_id, name, url, icon, sort_order, is_external, external_url} ] } 기술 세부사항: - 생성된 메뉴 ID 배열을 사용해 Menu::whereIn() 조회 - parent_id, sort_order 순서로 정렬 - 로그인 API와 동일한 메뉴 정보 구조 제공 --- app/Services/RegisterService.php | 10 +++++++++- app/Swagger/v1/RegisterApi.php | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/Services/RegisterService.php b/app/Services/RegisterService.php index 969cd87..9023ed6 100644 --- a/app/Services/RegisterService.php +++ b/app/Services/RegisterService.php @@ -106,7 +106,14 @@ public static function register(array $params): array // 10. Assign system_manager role to user $user->assignRole($role); - // 11. Return user and tenant data + // 11. Get created menus + $menus = Menu::whereIn('id', $menuIds) + ->orderBy('parent_id') + ->orderBy('sort_order') + ->get(['id', 'parent_id', 'name', 'url', 'icon', 'sort_order', 'is_external', 'external_url']) + ->toArray(); + + // 12. Return user, tenant, and menus data return [ 'user' => [ 'id' => $user->id, @@ -123,6 +130,7 @@ public static function register(array $params): array 'tenant_st_code' => $tenant->tenant_st_code, 'options' => $tenant->options, ], + 'menus' => $menus, ]; }); } diff --git a/app/Swagger/v1/RegisterApi.php b/app/Swagger/v1/RegisterApi.php index f809a90..4d06dcc 100644 --- a/app/Swagger/v1/RegisterApi.php +++ b/app/Swagger/v1/RegisterApi.php @@ -72,6 +72,22 @@ * @OA\Property(property="industry", type="string", example="IT/소프트웨어"), * nullable=true * ) + * ), + * @OA\Property( + * property="menus", + * type="array", + * description="생성된 테넌트의 기본 메뉴 목록 (9개: 대시보드, 기초정보관리, 제품관리, 거래처관리, BOM관리, 시스템관리, 사용자관리, 권한관리, 부서관리)", + * @OA\Items( + * type="object", + * @OA\Property(property="id", type="integer", example=1, description="메뉴 ID"), + * @OA\Property(property="parent_id", type="integer", example=null, nullable=true, description="상위 메뉴 ID (최상위 메뉴는 null)"), + * @OA\Property(property="name", type="string", example="대시보드", description="메뉴명"), + * @OA\Property(property="url", type="string", example="/dashboard", description="메뉴 URL"), + * @OA\Property(property="icon", type="string", example="dashboard", description="메뉴 아이콘"), + * @OA\Property(property="sort_order", type="integer", example=1, description="정렬 순서"), + * @OA\Property(property="is_external", type="integer", example=0, description="외부 링크 여부 (0: 내부, 1: 외부)"), + * @OA\Property(property="external_url", type="string", example=null, nullable=true, description="외부 링크 URL") + * ) * ) * ) * )