feat: 应用自动更新系统 + 草稿箱删除 + 分类缓存优化
- 新增 Tauri 自动更新(updater 插件) - Rust: 集成 tauri-plugin-updater + tauri-plugin-process - 后端: app_releases / release_packages 表 + /update/check API - 前端: UpdateDialog 组件 + useUpdater hook + SystemUpdate 手动检查 - 发版脚本: scripts/publish_release.py(扫描 .sig → 上传七牛云 → 写入数据库) - 配置 test 环境域名 dev.tapi.meijiaka.cn - 草稿箱删除功能 - DraftListItem 添加删除按钮 - MyWorks 添加删除确认弹窗 + localProjectApi.deleteProject 调用 - 创作主题分类本地缓存 - scriptApi.getCategoriesCached() 先读 localStorage 再静默刷新 - TermsModal tab 居中 - 更新应用图标(Big Sur 风格圆角矩形) - 清理: 删除未使用文件 create_user.py / video-replace-mvp.py / DEPS_*.md
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
"""
|
||||
应用更新模型
|
||||
============
|
||||
|
||||
Tauri updater 插件所需的数据结构。
|
||||
"""
|
||||
|
||||
from datetime import UTC, datetime
|
||||
|
||||
from sqlalchemy import Boolean, BigInteger, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.db.session import Base
|
||||
|
||||
|
||||
class AppRelease(Base):
|
||||
"""应用版本发布记录"""
|
||||
|
||||
__tablename__ = "app_releases"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
version: Mapped[str] = mapped_column(String(20), unique=True, nullable=False, index=True)
|
||||
release_date: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False)
|
||||
notes: Mapped[str] = mapped_column(Text, nullable=False, default="")
|
||||
mandatory: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), default=lambda: datetime.now(UTC), nullable=False
|
||||
)
|
||||
|
||||
packages: Mapped[list["ReleasePackage"]] = relationship(
|
||||
"ReleasePackage",
|
||||
back_populates="release",
|
||||
cascade="all, delete-orphan",
|
||||
lazy="selectin",
|
||||
)
|
||||
|
||||
|
||||
class ReleasePackage(Base):
|
||||
"""平台安装包信息"""
|
||||
|
||||
__tablename__ = "release_packages"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
release_id: Mapped[int] = mapped_column(
|
||||
Integer,
|
||||
ForeignKey("app_releases.id", ondelete="CASCADE"),
|
||||
nullable=False,
|
||||
)
|
||||
platform: Mapped[str] = mapped_column(String(20), nullable=False)
|
||||
architecture: Mapped[str] = mapped_column(String(20), nullable=False)
|
||||
filename: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
file_url: Mapped[str] = mapped_column(String(500), nullable=False)
|
||||
file_size: Mapped[int] = mapped_column(BigInteger, nullable=False)
|
||||
signature: Mapped[str] = mapped_column(Text, nullable=False)
|
||||
download_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), default=lambda: datetime.now(UTC), nullable=False
|
||||
)
|
||||
|
||||
release: Mapped["AppRelease"] = relationship("AppRelease", back_populates="packages")
|
||||
|
||||
__table_args__ = (
|
||||
UniqueConstraint("release_id", "platform", "architecture", name="uix_pkg_platform_arch"),
|
||||
)
|
||||
Reference in New Issue
Block a user