初始版本
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
"""
|
||||
文件上传模型
|
||||
"""
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
from sqlmodel import SQLModel, Field, Relationship
|
||||
from .user import User
|
||||
|
||||
|
||||
class Upload(SQLModel, table=True):
|
||||
"""文件上传记录表"""
|
||||
__tablename__ = "uploads"
|
||||
|
||||
id: Optional[int] = Field(default=None, primary_key=True)
|
||||
filename: str = Field(max_length=200)
|
||||
stored_path: str = Field(max_length=300)
|
||||
file_size: int # 字节数
|
||||
mime_type: str = Field(max_length=100)
|
||||
uploaded_at: datetime = Field(default_factory=datetime.now)
|
||||
expires_at: Optional[datetime] = Field(default=None)
|
||||
user_id: int = Field(foreign_key="users.id", index=True)
|
||||
|
||||
# 关系
|
||||
user: Optional[User] = Relationship()
|
||||
|
||||
Reference in New Issue
Block a user