feat(api): 添加热门卡片与榜单接口及实现
- 新增热门帖子、热门作者、榜单接口及实现 - 新增api-documentation,更好的ai协作 - 修复types没有导出的问题 BREAKING CHANGES: 1.0.0->1.1.0(latest)
This commit is contained in:
41
types/post/base.ts
Normal file
41
types/post/base.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import type {User} from '../user/base';
|
||||
import type {PostType} from './enum';
|
||||
|
||||
// 基础实体接口
|
||||
export interface BaseEntity {
|
||||
id: string; // 唯一标识符
|
||||
createdAt: Date; // 创建时间
|
||||
updatedAt: Date; // 更新时间
|
||||
}
|
||||
|
||||
// 用户基础信息接口
|
||||
export interface BaseUser {
|
||||
user: User;
|
||||
}
|
||||
|
||||
export interface PostComment extends BaseEntity {
|
||||
authorId: string; // 作者ID
|
||||
author: BaseUser; // 作者信息
|
||||
content: string; // 评论内容
|
||||
parentId?: string; // 父评论ID,用于嵌套评论
|
||||
}
|
||||
|
||||
// 实体内容和统计信息基础接口
|
||||
export interface BaseEntityContent {
|
||||
title?: string; // 标题
|
||||
excerpt: string; // 摘要
|
||||
tags?: string[]; // 标签数组
|
||||
metadata?: Record<string, unknown>; // 元数据
|
||||
stars: number; // 收藏数
|
||||
likes: number; // 点赞数
|
||||
comments: number; // 评论数
|
||||
}
|
||||
|
||||
// 帖子接口
|
||||
export interface Post extends BaseEntity, BaseEntityContent {
|
||||
type: PostType; // 帖子类型:提问或文章
|
||||
authorId: string; // 作者ID
|
||||
author: BaseUser; // 作者信息
|
||||
images?: string[]; // 图片数组
|
||||
publishedAt?: Date; // 发布时间
|
||||
}
|
||||
Reference in New Issue
Block a user