fix(mobile): declare roleCode on AuthUser so admin/manager land on tabs home, not visitor tickets

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
zio 2026-07-13 05:16:35 +09:00
parent ecf60aac1d
commit 7a117a018c
3 changed files with 9 additions and 5 deletions

View File

@ -17,7 +17,7 @@ React Native + Expo(expo-router, TypeScript) 모바일 앱. 조회·승인·현
## 역할별 랜딩 ## 역할별 랜딩
- `lib/roleTrack.ts` — 웹 `src/frontend/src/lib/roleTrack.ts` 패리티(우선순위 admin>ops>business>agency>visitor, 미판정=visitor 기본). - `lib/roleTrack.ts` — 웹 `src/frontend/src/lib/roleTrack.ts` 패리티(우선순위 admin>ops>business>agency>visitor, 미판정=visitor 기본).
- 로그인 응답 user에 roleCode가 없어 `hallManager`를 ops 신호로 사용(roleCode 아는 호출부는 옵션 전달). - 로그인 응답 user`roleCode`(app_user.role_code, 웹 `LoginResponse.user`와 동일 shape)를 반환한다 — `ADMIN`/`MANAGER` 우선 판정, 누락 시 `hallManager`를 ops 신호로 폴백(관람객 계정은 roleCode null → workspaces myRole로 판정).
- 모바일 랜딩 매핑: admin/ops/business→`/(tabs)` 홈 · agency(장치·시공)→`/(tabs)/field` · visitor(관람객)→`/tickets`. - 모바일 랜딩 매핑: admin/ops/business→`/(tabs)` 홈 · agency(장치·시공)→`/(tabs)/field` · visitor(관람객)→`/tickets`.
- 콜드 부팅 시 workspaces 미복원 misroute 방지 위해 로그인 시 계산한 랜딩 경로를 secure-store에 지속(`AuthContext`). - 콜드 부팅 시 workspaces 미복원 misroute 방지 위해 로그인 시 계산한 랜딩 경로를 secure-store에 지속(`AuthContext`).

View File

@ -3,8 +3,8 @@
* 우선순위: admin > ops > business > agency > visitor. visitor() . * 우선순위: admin > ops > business > agency > visitor. visitor() .
* *
* ( ): * ( ):
* · user(AuthUser) roleCode가 hallManager=true를 ops . * · roleCode는 /api/auth/login (AuthUser.roleCode).
* (roleCode를 /api/auth/me의 MePrincipal.roleCode ) * roleCode('ADMIN'/'MANAGER') , hallManager=true를 ops .
* · (/admin·/contractor/dashboard·/visitor·/home) . * · (/admin·/contractor/dashboard·/visitor·/home) .
*/ */
import type { AuthUser, EventRole, WorkspaceDto } from './types'; import type { AuthUser, EventRole, WorkspaceDto } from './types';
@ -26,9 +26,9 @@ export function trackOf(role: EventRole | null | undefined): Track {
} }
} }
/** 랜딩 판정 입력 — 로그인 응답 user + workspaces. roleCode는 알 때만(옵션). */ /** 랜딩 판정 입력 — 로그인 응답 user(roleCode 포함) + workspaces. */
export interface LandingInput { export interface LandingInput {
user?: (AuthUser & { roleCode?: string | null }) | null; user?: AuthUser | null;
workspaces?: WorkspaceDto[] | null; workspaces?: WorkspaceDto[] | null;
} }

View File

@ -54,6 +54,10 @@ export interface AuthUser {
userId: string; userId: string;
displayName: string; displayName: string;
hallManager: boolean; hallManager: boolean;
// 전역 역할(app_user.role_code — 'ADMIN' | 'MANAGER' | …). 공유 백엔드 /api/auth/login 이
// 웹과 동일하게 반환한다(웹 LoginResponse.user 와 동일 shape). 관람객 등 미지정 계정은 null/undefined.
// 역할별 랜딩 판정(roleTrack.resolveLandingTrack)이 admin/ops 우선순위 결정에 사용.
roleCode?: string | null;
} }
export interface LoginResponse { export interface LoginResponse {
accessToken: string; accessToken: string;