Compare commits

..

2 Commits

4 changed files with 38 additions and 1 deletions

View File

@ -4,6 +4,7 @@
<div class="card-body"> <div class="card-body">
<h3 class="card-title">{{ task.name }}</h3> <h3 class="card-title">{{ task.name }}</h3>
<ul class="list-group list-group-flush"> <ul class="list-group list-group-flush">
<li class="list-group-item">Дата и время: {{ task.datetime }}</li>
<li class="list-group-item">Статус: {{ task.status }}</li> <li class="list-group-item">Статус: {{ task.status }}</li>
<li class="list-group-item">Сообщение: {{ task.status_message }}</li> <li class="list-group-item">Сообщение: {{ task.status_message }}</li>
<li class="list-group-item">Действие: {{ task.type }}</li> <li class="list-group-item">Действие: {{ task.type }}</li>

View File

@ -1,4 +1,6 @@
from sqlalchemy import Integer import datetime
from sqlalchemy import Integer, DateTime
from sqlalchemy.schema import Column, ForeignKey from sqlalchemy.schema import Column, ForeignKey
from sqlalchemy.orm import Mapped, mapped_column, relationship from sqlalchemy.orm import Mapped, mapped_column, relationship
from app.extensions import db from app.extensions import db
@ -11,6 +13,7 @@ class Task(db.Model):
session_id = Column(Integer, ForeignKey("session.id")) session_id = Column(Integer, ForeignKey("session.id"))
session: Mapped['Session'] = relationship("Session", back_populates="tasks") 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: Mapped[str]
status_message: Mapped[str] status_message: Mapped[str]
type: Mapped[str] type: Mapped[str]

View File

@ -0,0 +1,32 @@
"""Added datetime to task
Revision ID: cdd471f48b0d
Revises: af22ea98e0da
Create Date: 2024-02-03 11:36:03.826063
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cdd471f48b0d'
down_revision = 'af22ea98e0da'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('task', schema=None) as batch_op:
batch_op.add_column(sa.Column('datetime', sa.DateTime(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('task', schema=None) as batch_op:
batch_op.drop_column('datetime')
# ### end Alembic commands ###

View File

@ -30,6 +30,7 @@ PyQt5==5.15.10
PyQt5-Qt5==5.15.2 PyQt5-Qt5==5.15.2
PyQt5-sip==12.13.0 PyQt5-sip==12.13.0
python-dateutil==2.8.2 python-dateutil==2.8.2
python-dotenv==1.0.1
redis==5.0.1 redis==5.0.1
rsa==4.9 rsa==4.9
six==1.16.0 six==1.16.0