migrate Article type from blog

This commit is contained in:
Timi
2025-07-22 12:58:22 +08:00
parent 04ac9d4753
commit 3546e88f2c
2 changed files with 88 additions and 0 deletions

View File

@ -34,6 +34,7 @@ import "./assets/style/timi-web.less";
export * from "./components";
export * from "./types/Model";
export * from "./types/Article";
export * from "./types/User";
export * from "./types/Comment";
export * from "./types/Setting";

87
src/types/Article.ts Normal file
View File

@ -0,0 +1,87 @@
import { AttachmentView, Model } from "timi-web";
// 文章
export type Article<E extends ArticleMusicExtendData | ArticleSoftwareExtendData> = {
title?: string;
type: ArticleType;
digest?: string;
data?: string;
extendData?: E;
reads: number;
likes: number;
showComment: boolean;
canComment: boolean;
canRanking: boolean;
} & Model;
export type ArticleView<E extends ArticleMusicExtendData | ArticleSoftwareExtendData> = {
comments?: number;
attachmentList: AttachmentView[];
} & Article<E>;
export enum ArticleType {
/** 公版 */
PUBLIC,
/** 音乐 */
MUSIC,
/** 软件 */
SOFTWARE
}
export enum ArticleAttachType {
COVER,
}
export type ArticleMusicExtendData = {
title: string;
list: ArticleMusicItem[];
info: {
key: string;
value: string;
}[];
}
export type ArticleSoftwareExtendData = {
url?: string;
downloads: ArticleSoftwareDownload[];
format: string;
runtime: ArticleSoftwareRuntime[];
size: number;
version: string;
password?: string;
}
export enum ArticleSoftwareDownloadType {
TIMI_MONGO,
TIMI_COS,
URL
}
export enum ArticleSoftwareRuntime {
JVM,
WINDOWS,
LINUX,
MAC_OS
}
export type ArticleSoftwareDownload = {
type: ArticleSoftwareDownloadType;
value: string;
}
export type ArticleMusicItem = {
title: string;
audio?: string;
video?: string;
}