- Add ChromaticColor (17 Tailwind colors) and NeutralColor (5 grays) enums - Add ThemePreset table with flat color columns and unique name constraint - Add admin theme endpoints (CRUD + set default) at /api/v1/admin/theme - Add public theme listing at /api/v1/site/themes - Add user theme settings (PATCH /theme) with color snapshot on User model - User.color_* columns store per-user overrides; fallback to default preset then builtin - Initialize default theme preset in migration - Remove legacy defaultTheme/themes settings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
869 B
Python
36 lines
869 B
Python
from enum import StrEnum
|
|
from typing import TYPE_CHECKING
|
|
from uuid import UUID
|
|
|
|
from sqlmodel import Field, Relationship
|
|
|
|
from .base import SQLModelBase
|
|
from .mixin import TableBaseMixin
|
|
|
|
if TYPE_CHECKING:
|
|
from .share import Share
|
|
|
|
|
|
class ReportReason(StrEnum):
|
|
"""举报原因枚举"""
|
|
# [TODO] 补充具体举报原因
|
|
pass
|
|
|
|
|
|
class Report(SQLModelBase, TableBaseMixin):
|
|
"""举报模型"""
|
|
|
|
reason: int = Field(default=0, sa_column_kwargs={"server_default": "0"})
|
|
"""举报原因 [TODO] 待定义枚举"""
|
|
description: str | None = Field(default=None, max_length=255, description="补充描述")
|
|
|
|
# 外键
|
|
share_id: UUID = Field(
|
|
foreign_key="share.id",
|
|
index=True,
|
|
ondelete="CASCADE"
|
|
)
|
|
"""被举报的分享ID"""
|
|
|
|
# 关系
|
|
share: "Share" = Relationship(back_populates="reports") |