Преглед изворни кода

🗑️ chore(api): 删除home.ts文件

- 移除客户端api目录下的home.ts文件
- 清理相关的类型定义和API方法
- 移除hono客户端和axiosFetch依赖引用
yourname пре 8 месеци
родитељ
комит
ac9f299cae
1 измењених фајлова са 0 додато и 113 уклоњено
  1. 0 113
      src/client/api/home.ts

+ 0 - 113
src/client/api/home.ts

@@ -1,113 +0,0 @@
-import { hc } from 'hono/client';
-import type { HomeRoutes } from '@/server/api';
-import { axiosFetch } from './utils';
-
-export const homeClient = hc<HomeRoutes>('/api/v1', {
-  fetch: axiosFetch,
-}).api.v1.home;
-
-// 类型定义
-export type HomeData = {
-  banners: PolicyNews[];
-  recommendedJobs: Job[];
-  hotKnowledge: SilverKnowledge[];
-  timeBankActivities: TimeBankActivity[];
-  userStats: UserStats;
-};
-
-// 导出类型以便前端使用
-export type { PolicyNews } from '@/server/modules/silver-users/policy-news.entity';
-export type { Job } from '@/server/modules/silver-jobs/job.entity';
-export type { SilverKnowledge } from '@/server/modules/silver-users/silver-knowledge.entity';
-export type { SilverTimeBank } from '@/server/modules/silver-users/silver-time-bank.entity';
-
-interface PolicyNews {
-  id: number;
-  newsTitle: string;
-  newsContent: string;
-  images: string | null;
-  summary: string | null;
-  category: string | null;
-  viewCount: number;
-  createdAt: Date;
-}
-
-interface Job {
-  id: number;
-  title: string;
-  description: string;
-  salaryRange: string | null;
-  location: string | null;
-  company: {
-    id: number;
-    name: string;
-    logo: string | null;
-  } | null;
-  createdAt: Date;
-}
-
-interface SilverKnowledge {
-  id: number;
-  title: string;
-  content: string;
-  coverImage: string | null;
-  viewCount: number;
-  category: {
-    id: number;
-    name: string;
-  } | null;
-  createdAt: Date;
-}
-
-interface TimeBankActivity {
-  id: number;
-  workType: number;
-  organization: string;
-  workHours: number;
-  earnedPoints: number;
-  workDate: Date;
-}
-
-interface UserStats {
-  pointBalance: number;
-  timeBankHours: number;
-  publishedCount: number;
-  favoriteCount: number;
-}
-
-// API方法
-export const homeApi = {
-  /**
-   * 获取首页数据
-   */
-  async getHomeData(limit?: number) {
-    const response = await homeClient.$get({
-      query: limit ? { limit } : undefined
-    });
-    
-    if (response.status !== 200) {
-      throw new Error('获取首页数据失败');
-    }
-    
-    return response.json();
-  },
-
-  /**
-   * 搜索功能
-   */
-  async search(keyword: string, type: 'jobs' | 'knowledge' | 'companies' | 'all' = 'all', limit: number = 10) {
-    const response = await homeClient.search.$get({
-      query: {
-        keyword,
-        type,
-        limit
-      }
-    });
-    
-    if (response.status !== 200) {
-      throw new Error('搜索失败');
-    }
-    
-    return response.json();
-  }
-};