15 lines
462 B
TypeScript
15 lines
462 B
TypeScript
import type { Request } from 'express';
|
|
|
|
/** 守卫核对账户后写入的身份,后续业务不能用客户端提交的 userId 替代它。 */
|
|
export interface AuthenticatedUser {
|
|
userId: string;
|
|
authVersion: number;
|
|
role: 'user' | 'admin';
|
|
}
|
|
|
|
/** 生命周期内共享的请求上下文;未经过中间件或鉴权时字段可能尚未赋值。 */
|
|
export type HttpRequest = Request & {
|
|
requestId?: string;
|
|
auth?: AuthenticatedUser;
|
|
};
|