echoes/frontend/interface/api.ts
lsy e54c6b67c0 前端:实现开发模式动态主题
后端:自定义字段restful路由
2024-12-20 00:34:54 +08:00

80 lines
1.4 KiB
TypeScript

// 定义数据库表的字段接口
export interface User {
username: string;
avatarUrl?: string;
email: string;
passwordHash: string;
role: string;
createdAt: Date;
updatedAt: Date;
}
export interface Page {
id: number;
title: string;
content: string;
isEditor: boolean;
draftContent?: string;
template?: string;
status: string;
}
export interface Post {
id: number;
authorName: string;
coverImage?: string;
title?: string;
content: string;
status: string;
isEditor: boolean;
draftContent?: string;
createdAt: Date;
updatedAt: Date;
}
export interface Resource {
id: number;
authorId: string;
name: string;
sizeBytes: number;
storagePath: string;
mimeType: string;
category?: string;
description?: string;
createdAt: Date;
}
export interface CustomField {
targetType: "post" | "page";
targetId: number;
fieldType: string;
fieldKey: string;
fieldValue?: string;
}
export interface Taxonomy {
name: string;
slug: string;
type: "tag" | "category";
parentName?: string;
}
export interface PostTaxonomy {
postId: number;
taxonomyName: string;
}
// 用于前端展示的扩展接口
export interface PostDisplay extends Post {
taxonomies?: {
categories: Taxonomy[];
tags: Taxonomy[];
};
customFields?: CustomField[];
}
export interface PageDisplay extends Page {
customFields?: CustomField[];
}