feat: 회원가입 API 응답에 메뉴 리스트 추가

주요 변경사항:
- 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와 동일한 메뉴 정보 구조 제공
This commit is contained in:
2025-11-10 09:44:22 +09:00
parent 92c60ff39f
commit c558606954
2 changed files with 25 additions and 1 deletions

View File

@@ -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,
];
});
}

View File

@@ -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")
* )
* )
* )
* )