// 通用响应类型 export interface ApiResponse { success: boolean; data?: T; message?: string; error?: string; } // 分页类型 export interface Pagination { page: number; pageSize: number; total: number; totalPages: number; } // 分页响应类型 export interface PaginatedResponse extends ApiResponse { pagination: Pagination; } // 查询参数类型 export interface QueryParams { page?: number; pageSize?: number; sortBy?: string; sortOrder?: 'ASC' | 'DESC'; [key: string]: any; } // 启用/禁用状态枚举 export enum EnableStatus { DISABLED = 0, // 禁用 ENABLED = 1 // 启用 } // 启用/禁用状态中文映射 export const EnableStatusNameMap: Record = { [EnableStatus.DISABLED]: '禁用', [EnableStatus.ENABLED]: '启用' }; // 删除状态枚举 export enum DeleteStatus { NOT_DELETED = 0, // 未删除 DELETED = 1 // 已删除 } // 删除状态中文映射 export const DeleteStatusNameMap: Record = { [DeleteStatus.NOT_DELETED]: '未删除', [DeleteStatus.DELETED]: '已删除' }; // 用户类型枚举 export enum UserType { ADMIN = 'admin', // 管理员 EMPLOYER = 'employer', // 企业用户 TALENT = 'talent' // 人才用户 } // 用户类型中文映射 export const TypeNameMap: Record = { [UserType.ADMIN]: '管理员', [UserType.EMPLOYER]: '企业用户', [UserType.TALENT]: '人才用户' }; // 启用/禁用状态枚举(反向定义) export enum DisabledStatus { DISABLED = 1, // 禁用 ENABLED = 0 // 启用 } // 启用/禁用状态中文映射 export const DisabledStatusNameMap: Record = { [DisabledStatus.DISABLED]: '禁用', [DisabledStatus.ENABLED]: '启用' }; // 认证上下文类型 export interface AuthContextType { user: T | null; token: string | null; login: (username: string, password: string, latitude?: number, longitude?: number) => Promise; logout: () => Promise; isAuthenticated: boolean; isLoading: boolean; } // 全局配置常量 export interface GlobalConfig { OSS_BASE_URL: string; APP_NAME: string; } // JWT Payload 类型 export interface JWTPayload { id: number; username: string; roles?: string[]; openid?: string; tenantId?: number; // 租户ID,用于多租户场景 personId?: number; // 关联人员ID(如残疾人ID) userType?: UserType; // 用户类型 } // Hono 认证上下文类型 export type AuthContext = { Variables: { user: any; // 用户类型将在具体模块中定义 token: string; tenantId?: number; // 租户ID,用于多租户场景 } }; // 企业用户基本信息接口 export interface EnterpriseUserBase { id: number; username: string; email?: string | null; phone?: string | null; realName?: string | null; status?: number; roles?: any[]; companyId?: number | null; company?: { id: number; companyName: string; contactPerson?: string | null; contactPhone?: string | null; contactEmail?: string | null; address?: string | null; status: number; createTime: Date; updateTime: Date; } | null; } // 企业认证上下文类型 export type EnterpriseAuthContext = { Variables: { user: EnterpriseUserBase; token: string; } }; // 人才用户基本信息接口 export interface TalentUserBase { id: number; username: string; userType: UserType.TALENT; personId: number | null; phone?: string | null; nickname?: string | null; name?: string | null; avatarFileId?: number | null; isDisabled?: number | null; createdAt?: Date; updatedAt?: Date; personInfo?: { id: number; name: string; gender: string; idCard: string; disabilityId: string; disabilityType: string; disabilityLevel: string; phone: string; province: string; city: string; district: string | null; detailedAddress: string | null; birthDate: Date | null; idAddress: string; idValidDate: Date | null; disabilityValidDate: Date | null; canDirectContact: number; isMarried: number | null; nation: string | null; jobStatus: number; specificDisability: string | null; isInBlackList: number; createTime: Date; updateTime: Date; } | null; } // 人才认证上下文类型 export type TalentAuthContext = { Variables: { user: TalentUserBase; token: string; } };