27 lines
837 B
TypeScript
27 lines
837 B
TypeScript
import type { UserProfile } from '../user';
|
||
import type { BaseEntity, BaseStats } from '../common';
|
||
|
||
export type PostType = 'question' | 'article';
|
||
|
||
// 不搞fallback,统一用原子组件作为fallback
|
||
export type PostContent =
|
||
| { type: 'text'; value: string }
|
||
| { type: 'image'; src: string }
|
||
| { type: 'video'; src: string};
|
||
|
||
|
||
export interface PostComment extends BaseEntity {
|
||
author: UserProfile; // 作者信息
|
||
content: string; // 评论内容(暂时只支持文字评论)
|
||
parentId?: string; // 父评论ID,用于嵌套评论
|
||
}
|
||
|
||
// 帖子接口
|
||
export interface Post extends BaseEntity, BaseStats{
|
||
title: string; // 标题
|
||
// 没有标签数组
|
||
content: PostContent[]; // 内容(文字、图片等)
|
||
type: PostType; // 帖子类型:提问或文章
|
||
author: UserProfile; // 作者信息
|
||
}
|