修改部分问题

This commit is contained in:
2025-02-26 15:06:13 +08:00
parent 584c6c5364
commit 0301e41e96
4 changed files with 43 additions and 15 deletions

View File

@ -16,7 +16,9 @@ class ProjectType(DbCommon):
class ProjectInfo(DbCommon):
"""项目信息表"""
"""
项目信息表
"""
__tablename__ = "project_info"
project_no: Mapped[str] = mapped_column(String(32), unique=True, nullable=False)
project_name: Mapped[str] = mapped_column(String(32), unique=True, nullable=False)
@ -28,7 +30,9 @@ class ProjectInfo(DbCommon):
class ProjectLabel(DbCommon):
"""项目标签表"""
"""
项目标签表
"""
__tablename__ = "project_label"
label_name: Mapped[str] = mapped_column(String(32), unique=True, nullable=False)
project_id: Mapped[int] = mapped_column(Integer, nullable=False)
@ -36,7 +40,9 @@ class ProjectLabel(DbCommon):
class ProjectImage(DbCommon):
"""项目图片表"""
"""
项目图片表
"""
__tablename__ = "project_image"
file_name: Mapped[str] = mapped_column(String(64), nullable=False)
image_url: Mapped[str] = mapped_column(String(255), nullable=False)
@ -45,14 +51,18 @@ class ProjectImage(DbCommon):
class ProjectImgLeafer(DbCommon):
"""项目图片leafer表"""
"""
项目图片leafer表
"""
__tablename__ = "project_img_leafer"
image_id: Mapped[int] = mapped_column(Integer, nullable=False)
leafer: Mapped[dict] = mapped_column(JSON)
class ProjectImgLabel(DbCommon):
"""项目图片标签对应表一张图片对应多个label"""
"""
项目图片标签对应表一张图片对应多个label
"""
__tablename__ = "project_img_label"
image_id: Mapped[int] = mapped_column(Integer, nullable=False)
label_id: Mapped[int] = mapped_column(Integer, nullable=False)
@ -69,3 +79,13 @@ class ProjectTrain(DbCommon):
train_version: Mapped[str] = mapped_column(String(32), nullable=False)
best_pt: Mapped[str] = mapped_column(String(255), nullable=False)
last_pt: Mapped[str] = mapped_column(String(255), nullable=False)
class ProjectDetect(DbCommon):
"""
训练推理集合
"""
__tablename__ = "project_detect"
project_id: Mapped[str] = mapped_column(Integer, nullable=False)

View File

@ -1,5 +1,4 @@
import datetime
from datetime import datetime
from pydantic import BaseModel, Field
from typing import Optional
@ -8,7 +7,10 @@ class ProjectTrainOut(BaseModel):
"""项目训练版本信息表"""
id: Optional[int] = Field(None, description="训练id")
train_version: Optional[str] = Field(None, description="训练版本号")
create_time: Optional[datetime.datetime] = Field(None, description="训练时间")
create_time: Optional[datetime] = Field(None, description="训练时间")
class Config:
orm_mode = True
json_encoders = {
datetime: lambda v: v.strftime("%Y-%m-%d %H:%M:%S")
}