feat(reset): 以构造器模式重构

- 加了大文件传输自定义分片协议

BREAKING CHANGES: 0.1.0(latest)
This commit is contained in:
tobegold574
2025-11-30 20:27:53 +08:00
parent c5853847ae
commit 382e3aff21
82 changed files with 1421 additions and 7010 deletions

View File

@@ -1,44 +1,26 @@
import type {User} from '../user/base';
import type {PostType} from './enum';
import type { UserProfile } from '../user';
import type { BaseEntity, BaseStats } from '../common';
// 基础实体接口
export interface BaseEntity {
id: string; // 唯一标识符
createdAt: Date; // 创建时间
updatedAt: Date; // 更新时间
}
export type PostType = 'question' | 'article';
// 不搞fallback统一用原子组件作为fallback
export type PostContent =
| { type: 'text'; value: string }
| { type: 'image'; src: string }
| { type: 'video'; src: string};
// 用户基础信息接口
export interface BaseUser {
// 其实应该用profile的
user: User;
}
export interface PostComment extends BaseEntity {
// 这里没带postId如果后台管理需要就要带
// 重复了,而且评论没有数据(点赞、收藏等等
authorId: string; // 作者ID
author: BaseUser; // 作者信息
content: string; // 评论内容
author: UserProfile; // 作者信息
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 {
export interface Post extends BaseEntity, BaseStats{
title: string; // 标题
// 没有标签数组
content: PostContent[]; // 内容(文字、图片等)
type: PostType; // 帖子类型:提问或文章
authorId: string; // 作者ID
author: BaseUser; // 作者信息
images?: string[]; // 图片数组
publishedAt?: Date; // 发布时间
author: UserProfile; // 作者信息
}