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:
@@ -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,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user