Uprava razeni letu
This commit is contained in:
@@ -215,8 +215,8 @@ class Event(BaseModel):
|
|||||||
id: Mapped[int] = mapped_column(primary_key=True)
|
id: Mapped[int] = mapped_column(primary_key=True)
|
||||||
name: Mapped[str] = mapped_column(String(128), nullable=False)
|
name: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||||
description: Mapped[str] = mapped_column(Text, nullable=False)
|
description: Mapped[str] = mapped_column(Text, nullable=False)
|
||||||
event_from: Mapped[datetime] = mapped_column(DateTime, nullable=True)
|
date_from: Mapped[datetime] = mapped_column(DateTime, nullable=True)
|
||||||
event_to: 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)
|
organization_id: Mapped[int] = mapped_column(Integer, ForeignKey('organization.id'), nullable=True)
|
||||||
is_public: Mapped[bool] = mapped_column(Boolean, server_default='0')
|
is_public: Mapped[bool] = mapped_column(Boolean, server_default='0')
|
||||||
created_by_id: Mapped[int] = mapped_column(Integer, ForeignKey('user.id'))
|
created_by_id: Mapped[int] = mapped_column(Integer, ForeignKey('user.id'))
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class FlightsLoader:
|
|||||||
query = (
|
query = (
|
||||||
select(Flight, rel_column)
|
select(Flight, rel_column)
|
||||||
.filter(rel_column.in_(ids))
|
.filter(rel_column.in_(ids))
|
||||||
|
.order_by(Flight.takeoff_datetime.desc())
|
||||||
)
|
)
|
||||||
|
|
||||||
for table in self.extra_join:
|
for table in self.extra_join:
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ def get_base_query(user_id: int):
|
|||||||
select(models.Event)
|
select(models.Event)
|
||||||
.filter(models.Event.created_by_id == user_id)
|
.filter(models.Event.created_by_id == user_id)
|
||||||
.filter(models.Event.deleted.is_(False))
|
.filter(models.Event.deleted.is_(False))
|
||||||
.order_by(models.Event.name)
|
.order_by(models.Event.date_from.desc(), models.Event.id.desc())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user