23 lines
882 B
Python
23 lines
882 B
Python
import datetime
|
|
|
|
from sqlalchemy import Integer, DateTime
|
|
from sqlalchemy.schema import Column, ForeignKey
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from app.extensions import db
|
|
|
|
class Task(db.Model):
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
task_id: Mapped[str] = mapped_column(nullable=True)
|
|
|
|
name: Mapped[str] = mapped_column(unique=True)
|
|
|
|
session_id = Column(Integer, ForeignKey("session.id"))
|
|
session: Mapped['Session'] = relationship("Session", back_populates="tasks")
|
|
datetime: Mapped[DateTime] = Column(DateTime, default=datetime.datetime.utcnow().strftime("%d.%m.%y %H:%M"))
|
|
status: Mapped[str]
|
|
status_message: Mapped[str]
|
|
type: Mapped[str]
|
|
|
|
url: Mapped[str] = mapped_column(nullable=True)
|
|
message: Mapped[str] = mapped_column(nullable=True)
|
|
file: Mapped[str] = mapped_column(nullable=True) |