Some checks reported errors
continuous-integration/drone/push Build was killed
- 搭建 api、auth、utils 等逻辑模块 - 通过 tsc、eslint、vitest 测试验证 BREAKING CHANGE: 新镜像分支
125 lines
2.6 KiB
TypeScript
125 lines
2.6 KiB
TypeScript
import type { BaseEntityContent, Post, PostComment } from './base';
|
|
import type {
|
|
PostType,
|
|
PostSortBy,
|
|
CommentSortBy,
|
|
SortOrder
|
|
} from './enum';
|
|
|
|
// 创建帖子请求接口
|
|
export interface CreatePostRequest extends BaseEntityContent {
|
|
type: PostType; // 帖子类型:提问或文章
|
|
images?: string[]; // 图片
|
|
publishedAt?: Date; // 发布时间
|
|
}
|
|
|
|
// 创建帖子响应接口
|
|
export interface CreatePostResponse {
|
|
post: Post;
|
|
}
|
|
|
|
// 获取帖子列表请求接口
|
|
export interface GetPostsRequest {
|
|
page?: number; // 页码
|
|
limit?: number; // 每页数量
|
|
sortBy?: PostSortBy; // 帖子排序方式
|
|
type?: PostType; // 帖子类型:提问或文章
|
|
sortOrder?: SortOrder; // 排序方向
|
|
authorId?: string;
|
|
search?: string;
|
|
}
|
|
|
|
// 获取帖子列表响应接口
|
|
export interface GetPostsResponse {
|
|
data: Post[]; // 数据列表
|
|
total: number; // 总数
|
|
page: number; // 当前页码
|
|
limit: number; // 每页数量
|
|
hasMore: boolean; // 是否有更多数据
|
|
sortBy?: PostSortBy; // 帖子排序方式
|
|
}
|
|
|
|
// 获取帖子详情请求接口
|
|
export interface GetPostRequest {
|
|
postId: string;
|
|
}
|
|
|
|
// 获取帖子详情响应接口
|
|
export interface GetPostResponse {
|
|
post: Post;
|
|
}
|
|
|
|
// 点赞帖子请求接口
|
|
export interface LikePostRequest {
|
|
postId: string;
|
|
}
|
|
|
|
// 点赞帖子响应接口
|
|
export interface LikePostResponse {
|
|
success: boolean;
|
|
}
|
|
|
|
// 收藏帖子请求接口
|
|
export interface BookmarkPostRequest {
|
|
postId: string;
|
|
}
|
|
|
|
// 收藏帖子响应接口
|
|
export interface BookmarkPostResponse {
|
|
success: boolean;
|
|
}
|
|
|
|
// 创建评论请求接口
|
|
export interface CreateCommentRequest {
|
|
postId: string;
|
|
content: string;
|
|
parentId?: string;
|
|
}
|
|
|
|
// 创建评论响应接口
|
|
export interface CreateCommentResponse {
|
|
comment: PostComment;
|
|
}
|
|
|
|
|
|
// 获取评论列表请求接口
|
|
export interface GetCommentsRequest {
|
|
page?: number; // 页码
|
|
limit?: number; // 每页数量
|
|
sortOrder?: SortOrder; // 排序方向
|
|
postId: string;
|
|
parentId?: string;
|
|
sortBy?: CommentSortBy;
|
|
}
|
|
|
|
// 获取评论列表响应接口
|
|
export interface GetCommentsResponse {
|
|
data: PostComment[]; // 数据列表
|
|
total: number; // 总数
|
|
page: number; // 当前页码
|
|
limit: number; // 每页数量
|
|
hasMore: boolean; // 是否有更多数据
|
|
}
|
|
|
|
// 点赞评论请求接口
|
|
export interface LikeCommentRequest {
|
|
commentId: string;
|
|
}
|
|
|
|
// 点赞评论响应接口
|
|
export interface LikeCommentResponse {
|
|
success: boolean;
|
|
}
|
|
|
|
// 后面全部暂时不考虑
|
|
// 删除帖子请求接口
|
|
export interface DeletePostRequest {
|
|
postId: string;
|
|
}
|
|
|
|
// 删除帖子响应接口
|
|
export interface DeletePostResponse {
|
|
success: boolean;
|
|
}
|
|
|