28 lines
1.2 KiB
Python
28 lines
1.2 KiB
Python
"""
|
||
分享链接模型
|
||
"""
|
||
from sqlalchemy import Column, BigInteger, String, DateTime, SmallInteger
|
||
from sqlalchemy.sql import func
|
||
|
||
from app.core.database import Base
|
||
|
||
|
||
class ShareLink(Base):
|
||
"""项目分享/文件分享链接"""
|
||
|
||
__tablename__ = "share_links"
|
||
|
||
id = Column(BigInteger, primary_key=True, autoincrement=True, comment="分享ID")
|
||
project_id = Column(BigInteger, nullable=False, index=True, comment="项目ID")
|
||
share_type = Column(String(20), nullable=False, index=True, comment="分享类型: project/file")
|
||
share_code = Column(String(64), nullable=False, unique=True, index=True, comment="公开分享码")
|
||
file_path = Column(String(500), comment="文件路径,仅文件分享使用")
|
||
access_pass = Column(String(100), comment="访问密码")
|
||
created_by = Column(BigInteger, index=True, comment="创建人ID")
|
||
status = Column(SmallInteger, default=1, index=True, comment="状态:0-禁用 1-启用")
|
||
created_at = Column(DateTime, server_default=func.now(), comment="创建时间")
|
||
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间")
|
||
|
||
def __repr__(self):
|
||
return f"<ShareLink(id={self.id}, type='{self.share_type}', code='{self.share_code}')>"
|