Initial commit

This commit is contained in:
2026-03-14 18:24:33 +08:00
commit 890c33f510
67 changed files with 13080 additions and 0 deletions

132
src/types/index.ts Normal file
View File

@@ -0,0 +1,132 @@
// API通用响应类型
export interface ApiResponse<T> {
code: number
message: string
data: T
}
export interface PaginatedResponse<T> {
list: T[]
total: number
page: number
page_size: number
total_pages: number
}
// 用户状态
export type UserStatus = 'active' | 'banned' | 'deleted'
// 帖子状态
export type PostStatus = 'pending' | 'published' | 'rejected' | 'deleted'
// 评论状态
export type CommentStatus = 'pending' | 'published' | 'rejected' | 'deleted'
// 用户角色
export interface Role {
id: string
name: string
description?: string
permissions?: string[]
created_at: string
updated_at: string
}
// 用户
export interface User {
id: string
username: string
nickname: string
email: string
avatar?: string
status: UserStatus
roles: Role[]
created_at: string
updated_at: string
}
// 帖子
export interface Post {
id: string
title: string
content: string
author: User
status: PostStatus
like_count: number
comment_count: number
view_count: number
created_at: string
updated_at: string
}
// 评论
export interface Comment {
id: string
content: string
author: User
post_id: string
post_title?: string
status: CommentStatus
like_count: number
created_at: string
updated_at: string
}
// 群组
export interface Group {
id: string
name: string
description?: string
avatar?: string
owner_id: string
member_count: number
created_at: string
updated_at: string
}
// 敏感词分类
export type SensitiveWordCategory = 'politics' | 'porn' | 'violence' | 'ad' | 'gambling' | 'fraud' | 'other'
// 敏感词级别
export type SensitiveWordLevel = 'low' | 'medium' | 'high'
// 敏感词
export interface SensitiveWord {
id: string
word: string
category: SensitiveWordCategory
level: SensitiveWordLevel
status: 'active' | 'inactive'
created_at: string
updated_at: string
}
// 认证相关类型
export interface LoginRequest {
username: string
password: string
}
export interface LoginResponse {
user: User
token: string
refresh_token: string
}
// Dashboard统计
export interface DashboardStats {
total_users: number
today_posts: number
pending_review: number
active_users: number
}
export interface UserActivityData {
date: string
count: number
}
export interface ContentDistribution {
name: string
value: number
}