Uprava razeni letu

This commit is contained in:
Michal Kváček
2023-09-25 06:26:16 +02:00
parent 2c53a8ffa3
commit 22a28ae70e
3 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -215,8 +215,8 @@ class Event(BaseModel):
id: Mapped[int] = mapped_column(primary_key=True)
name: Mapped[str] = mapped_column(String(128), nullable=False)
description: Mapped[str] = mapped_column(Text, nullable=False)
event_from: Mapped[datetime] = mapped_column(DateTime, nullable=True)
event_to: Mapped[datetime] = mapped_column(DateTime, nullable=True)
date_from: Mapped[datetime] = mapped_column(DateTime, nullable=True)
date_to: Mapped[datetime] = mapped_column(DateTime, nullable=True)
organization_id: Mapped[int] = mapped_column(Integer, ForeignKey('organization.id'), nullable=True)
is_public: Mapped[bool] = mapped_column(Boolean, server_default='0')
created_by_id: Mapped[int] = mapped_column(Integer, ForeignKey('user.id'))
+1
View File
@@ -20,6 +20,7 @@ class FlightsLoader:
query = (
select(Flight, rel_column)
.filter(rel_column.in_(ids))
.order_by(Flight.takeoff_datetime.desc())
)
for table in self.extra_join:
+1 -1
View File
@@ -24,7 +24,7 @@ def get_base_query(user_id: int):
select(models.Event)
.filter(models.Event.created_by_id == user_id)
.filter(models.Event.deleted.is_(False))
.order_by(models.Event.name)
.order_by(models.Event.date_from.desc(), models.Event.id.desc())
)