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:
parent
ecf60aac1d
commit
7a117a018c
@ -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`).
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user