| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- // 通用响应类型
- export interface ApiResponse<T = any> {
- success: boolean;
- data?: T;
- message?: string;
- error?: string;
- }
- // 分页类型
- export interface Pagination {
- page: number;
- pageSize: number;
- total: number;
- totalPages: number;
- }
- // 分页响应类型
- export interface PaginatedResponse<T = any> extends ApiResponse<T[]> {
- 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, string> = {
- [EnableStatus.DISABLED]: '禁用',
- [EnableStatus.ENABLED]: '启用'
- };
- // 删除状态枚举
- export enum DeleteStatus {
- NOT_DELETED = 0, // 未删除
- DELETED = 1 // 已删除
- }
- // 删除状态中文映射
- export const DeleteStatusNameMap: Record<DeleteStatus, string> = {
- [DeleteStatus.NOT_DELETED]: '未删除',
- [DeleteStatus.DELETED]: '已删除'
- };
- // 用户类型枚举
- export enum UserType {
- ADMIN = 'admin', // 管理员
- EMPLOYER = 'employer', // 企业用户
- TALENT = 'talent' // 人才用户
- }
- // 用户类型中文映射
- export const TypeNameMap: Record<UserType, string> = {
- [UserType.ADMIN]: '管理员',
- [UserType.EMPLOYER]: '企业用户',
- [UserType.TALENT]: '人才用户'
- };
- // 启用/禁用状态枚举(反向定义)
- export enum DisabledStatus {
- DISABLED = 1, // 禁用
- ENABLED = 0 // 启用
- }
- // 启用/禁用状态中文映射
- export const DisabledStatusNameMap: Record<DisabledStatus, string> = {
- [DisabledStatus.DISABLED]: '禁用',
- [DisabledStatus.ENABLED]: '启用'
- };
- // 认证上下文类型
- export interface AuthContextType<T> {
- user: T | null;
- token: string | null;
- login: (username: string, password: string, latitude?: number, longitude?: number) => Promise<void>;
- logout: () => Promise<void>;
- 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;
- }
- };
|