- Refactored AdminSummaryData and AdminSummaryResponse classes for better clarity. - Added OAUTH type to SettingsType enum. - Cleaned up imports in webdav.py. - Updated admin router to improve summary data retrieval and response handling. - Enhanced file management routes with better condition handling and user storage updates. - Improved group management routes by optimizing data retrieval. - Refined task management routes for better condition handling. - Updated user management routes to streamline access token retrieval. - Implemented a new captcha verification structure with abstract base class. - Removed deprecated env.md file and replaced with a new structured version. - Introduced a unified OAuth2.0 client base class for GitHub and QQ integrations. - Enhanced password management with improved hashing strategies. - Added detailed comments and documentation throughout the codebase for clarity.
33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
|
|
from typing import TYPE_CHECKING
|
|
from uuid import UUID
|
|
|
|
from sqlmodel import Field, Relationship, UniqueConstraint
|
|
|
|
from .base import SQLModelBase
|
|
from .mixin import TableBaseMixin
|
|
|
|
if TYPE_CHECKING:
|
|
from .user import User
|
|
|
|
class WebDAV(SQLModelBase, TableBaseMixin):
|
|
"""WebDAV账户模型"""
|
|
|
|
__table_args__ = (UniqueConstraint("name", "user_id", name="uq_webdav_name_user"),)
|
|
|
|
name: str = Field(max_length=255, description="WebDAV账户名")
|
|
password: str = Field(max_length=255, description="WebDAV密码")
|
|
root: str = Field(default="/", sa_column_kwargs={"server_default": "'/'"}, description="根目录路径")
|
|
readonly: bool = Field(default=False, description="是否只读")
|
|
use_proxy: bool = Field(default=False, description="是否使用代理下载")
|
|
|
|
# 外键
|
|
user_id: UUID = Field(
|
|
foreign_key="user.id",
|
|
index=True,
|
|
ondelete="CASCADE"
|
|
)
|
|
"""所属用户UUID"""
|
|
|
|
# 关系
|
|
user: "User" = Relationship(back_populates="webdavs") |