All checks were successful
Test / test (push) Successful in 1m45s
- Migrate SQLModel base classes, mixins, and database management to external sqlmodel-ext package; remove sqlmodels/base/, sqlmodels/mixin/, and sqlmodels/database.py - Add file viewer/editor system with WOPI protocol support for collaborative editing (OnlyOffice, Collabora) - Add enterprise edition license verification module (ee/) - Add Dockerfile multi-stage build with Cython compilation support - Add new dependencies: sqlmodel-ext, cryptography, whatthepatch Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
854 B
Python
36 lines
854 B
Python
|
||
from typing import TYPE_CHECKING
|
||
from uuid import UUID
|
||
|
||
from sqlmodel import Field, Relationship, Index
|
||
|
||
from sqlmodel_ext import SQLModelBase, TableBaseMixin
|
||
|
||
if TYPE_CHECKING:
|
||
from .object import Object
|
||
|
||
|
||
class SourceLink(SQLModelBase, TableBaseMixin):
|
||
"""链接模型"""
|
||
|
||
__table_args__ = (
|
||
Index("ix_sourcelink_object_name", "object_id", "name"),
|
||
)
|
||
|
||
name: str = Field(max_length=255)
|
||
"""链接名称"""
|
||
|
||
downloads: int = Field(default=0, sa_column_kwargs={"server_default": "0"})
|
||
"""通过此链接的下载次数"""
|
||
|
||
# 外键
|
||
object_id: UUID = Field(
|
||
foreign_key="object.id",
|
||
index=True,
|
||
ondelete="CASCADE"
|
||
)
|
||
"""关联的对象UUID(必须是文件类型)"""
|
||
|
||
# 关系
|
||
object: "Object" = Relationship(back_populates="source_links")
|
||
"""关联的对象""" |