You've already forked DataMate
* refactor: remove db table management from LS adapter (mv to scripts later); change adapter to use the same MySQL DB as other modules. * refactor: Rename LS Adapter module to datamate-python
25 lines
1019 B
Python
25 lines
1019 B
Python
from sqlalchemy import Column, String, JSON, TIMESTAMP
|
|
from sqlalchemy.sql import func
|
|
from app.db.database import Base
|
|
import uuid
|
|
|
|
class AnnotationTemplate(Base):
|
|
"""标注模板模型"""
|
|
|
|
__tablename__ = "t_dm_annotation_templates"
|
|
|
|
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()), comment="UUID主键ID")
|
|
name = Column(String(32), nullable=False, comment="模板名称")
|
|
description = Column(String(255), nullable=True, comment="模板描述")
|
|
configuration = Column(JSON, nullable=True, comment="配置信息(JSON格式)")
|
|
created_at = Column(TIMESTAMP, server_default=func.current_timestamp(), comment="创建时间")
|
|
deleted_at = Column(TIMESTAMP, nullable=True, comment="删除时间(软删除)")
|
|
|
|
def __repr__(self):
|
|
return f"<AnnotationTemplate(id={self.id}, name={self.name})>"
|
|
|
|
@property
|
|
def is_deleted(self) -> bool:
|
|
"""检查是否已被软删除"""
|
|
return self.deleted_at is not None
|