feat(api): 添加热门卡片与榜单接口及实现

- 新增热门帖子、热门作者、榜单接口及实现
- 新增api-documentation,更好的ai协作
- 修复types没有导出的问题

BREAKING CHANGES: 1.0.0->1.1.0(latest)
This commit is contained in:
tobegold574
2025-11-18 22:29:40 +08:00
parent c3a8a525cb
commit a0c907beed
28 changed files with 1074 additions and 15 deletions

View File

@@ -1,10 +0,0 @@
# Types 模块
## 架构设计
Types模块用于定义前端数据模型提供给其他模块进行API或行为封装。
## 包含
1. **chat**
- 包

View File

@@ -111,6 +111,33 @@ export interface LikeCommentResponse {
success: boolean;
}
// 获取热门帖子请求接口
export interface GetHotPostsRequest {
limit?: number; // 每页数量
days?: number; // 统计天数默认7天
}
// 获取热门帖子响应接口
export interface GetHotPostsResponse {
data: Post[]; // 数据列表
total: number; // 总数
}
// 获取帖子榜单请求接口
export interface GetPostRankingRequest {
limit?: number; // 每页数量
period?: 'day' | 'week' | 'month'; // 统计周期
type?: 'views' | 'likes' | 'comments'; // 排序类型
}
// 获取帖子榜单响应接口
export interface GetPostRankingResponse {
data: Post[]; // 数据列表
total: number; // 总数
period: 'day' | 'week' | 'month'; // 统计周期
type: 'views' | 'likes' | 'comments'; // 排序类型
}
// 后面全部暂时不考虑
// 删除帖子请求接口
export interface DeletePostRequest {

28
types/user/api.ts Normal file
View File

@@ -0,0 +1,28 @@
import type { User } from './base';
// 获取热门作者请求接口
export interface GetHotAuthorsRequest {
limit?: number; // 每页数量
days?: number; // 统计天数默认30天
}
// 获取热门作者响应接口
export interface GetHotAuthorsResponse {
data: User[]; // 数据列表
total: number; // 总数
}
// 获取作者榜单请求接口
export interface GetAuthorRankingRequest {
limit?: number; // 每页数量
period?: 'day' | 'week' | 'month'; // 统计周期
type?: 'posts' | 'views' | 'likes'; // 排序类型
}
// 获取作者榜单响应接口
export interface GetAuthorRankingResponse {
data: User[]; // 数据列表
total: number; // 总数
period: 'day' | 'week' | 'month'; // 统计周期
type: 'posts' | 'views' | 'likes'; // 排序类型
}

View File

@@ -2,3 +2,4 @@ export * from './base';
export * from './profile';
export * from './search';
export * from './enum';
export * from './api';