26 lines
751 B
Python
26 lines
751 B
Python
from sqlalchemy import Column, ForeignKey, String, Table
|
|
from sqlalchemy.orm import Mapped, relationship
|
|
|
|
from ..db import Base, db
|
|
from .stop import _Stop
|
|
|
|
user_last_stop_search_stops_associations_table = Table(
|
|
"user_last_stop_search_stops_associations_table",
|
|
Base.metadata,
|
|
Column("user_mxid", ForeignKey("user_last_stop_search_results.user_mxid")),
|
|
Column("stop_id", ForeignKey("_stops.id")),
|
|
)
|
|
|
|
|
|
class UserLastStopSearchResults(Base):
|
|
|
|
db = db
|
|
|
|
__tablename__ = "user_last_stop_search_results"
|
|
|
|
user_mxid = Column(String, primary_key=True)
|
|
request_content = Column(String, nullable=False)
|
|
stops: Mapped[list[_Stop]] = relationship(
|
|
_Stop, secondary=user_last_stop_search_stops_associations_table
|
|
)
|