37 lines
899 B
TypeScript
37 lines
899 B
TypeScript
// ── Auth domain types ─────────────────────────────────────────────────────────
|
|
|
|
export type Role = 'trader' | 'viewer' | 'admin';
|
|
|
|
export interface User {
|
|
id: string;
|
|
email: string;
|
|
role: Role;
|
|
createdAt: string;
|
|
lastLogin: string | null;
|
|
}
|
|
|
|
/** Full user row including password hash — only used internally by UserStore/AuthService. */
|
|
export interface UserRow {
|
|
id: string;
|
|
email: string;
|
|
password_hash: string;
|
|
role: Role;
|
|
created_at: string;
|
|
last_login: string | null;
|
|
}
|
|
|
|
/** Payload embedded in the JWT. */
|
|
export interface TokenPayload {
|
|
sub: string; // user id
|
|
email: string;
|
|
role: Role;
|
|
iat?: number;
|
|
exp?: number;
|
|
}
|
|
|
|
/** Response body for successful login / register. */
|
|
export interface AuthResponse {
|
|
token: string;
|
|
user: User;
|
|
}
|