Feat: Add tag management system

- Add tag CRUD APIs (single file and batch operations)
  - Add tag autocomplete endpoint
  - Add tag search support in file listing
  - Update database schema with tags column
  - Add tag validation and normalization utilities
  - Initialize Tags:[] for all new uploads
This commit is contained in:
sean908
2025-10-10 14:43:11 +08:00
parent aea62a3387
commit a86e8b522d
8 changed files with 663 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ CREATE TABLE IF NOT EXISTS files (
tg_chat_id TEXT, -- Telegram聊天ID (从metadata中提取)
tg_bot_token TEXT, -- Telegram Bot Token (从metadata中提取)
is_chunked BOOLEAN DEFAULT FALSE, -- 是否为分块文件
tags TEXT, -- 标签 (从metadata中提取JSON数组格式)
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
@@ -32,6 +33,7 @@ CREATE INDEX IF NOT EXISTS idx_files_channel ON files(channel);
CREATE INDEX IF NOT EXISTS idx_files_file_type ON files(file_type);
CREATE INDEX IF NOT EXISTS idx_files_upload_ip ON files(upload_ip);
CREATE INDEX IF NOT EXISTS idx_files_created_at ON files(created_at DESC);
CREATE INDEX IF NOT EXISTS idx_files_tags ON files(tags);
-- 2. 系统配置表 - 存储各种系统配置
CREATE TABLE IF NOT EXISTS settings (