26 lines
458 B
TypeScript
26 lines
458 B
TypeScript
import type { DB } from '@/server/db'
|
|
|
|
/**
|
|
* 基础 Context - 所有请求都包含的上下文
|
|
*/
|
|
export interface BaseContext {
|
|
headers: Headers
|
|
}
|
|
|
|
/**
|
|
* 数据库 Context - 通过 db middleware 扩展
|
|
*/
|
|
export interface DBContext extends BaseContext {
|
|
db: DB
|
|
}
|
|
|
|
/**
|
|
* 认证 Context - 通过 auth middleware 扩展(未来使用)
|
|
*
|
|
* @example
|
|
* export interface AuthContext extends DBContext {
|
|
* userId: string
|
|
* user: User
|
|
* }
|
|
*/
|