init: 初始化项目
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from sqlalchemy import String, Text, DateTime, ForeignKey
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
from app.core.database import Base
|
||||
from app.models.base import UUIDMixin
|
||||
|
||||
|
||||
class GenerationTask(Base, UUIDMixin):
|
||||
__tablename__ = "generation_tasks"
|
||||
|
||||
template_id: Mapped[uuid.UUID] = mapped_column(
|
||||
UUID(as_uuid=True), ForeignKey("templates.id", ondelete="CASCADE"), nullable=False, index=True
|
||||
)
|
||||
status: Mapped[str] = mapped_column(String(20), nullable=False, default="pending")
|
||||
result_file_path: Mapped[str | None] = mapped_column(String(500), nullable=True)
|
||||
error_msg: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
celery_task_id: Mapped[str | None] = mapped_column(String(100), nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True))
|
||||
finished_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
|
||||
template = relationship("Template")
|
||||
Reference in New Issue
Block a user