diff --git a/api/src/api/models.py b/api/src/api/models.py index 60c19b7..39a1edb 100644 --- a/api/src/api/models.py +++ b/api/src/api/models.py @@ -1,6 +1,7 @@ """Describes models used in the project""" -from typing import List +from typing import List, Union +from api.databases import Base from geoalchemy2 import Geography from sqlalchemy import ( Boolean, @@ -14,14 +15,10 @@ Text, Time, ) -from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship +from sqlalchemy.orm import Mapped, mapped_column, relationship from sqlalchemy.types import LargeBinary -class Base(DeclarativeBase): - pass - - class City(Base): """City model""" @@ -52,7 +49,7 @@ class RoutePoint(Base): id = Column(Integer, primary_key=True) route: Mapped[int] = mapped_column(ForeignKey("routes.id")) city: Mapped[int] = mapped_column(ForeignKey("cities.id")) - restriction: Mapped[int | None] = mapped_column( + restriction: Mapped[Union[int, None]] = mapped_column( ForeignKey("route_point_restrictions.id") ) name = Column(String) diff --git a/api/src/auth/models.py b/api/src/auth/models.py index ba839eb..6342086 100644 --- a/api/src/auth/models.py +++ b/api/src/auth/models.py @@ -9,6 +9,10 @@ class User(SQLAlchemyBaseUserTable[int], Base): + """User model""" + + __tablename__ = "users" + id = Column(Integer, primary_key=True) nickname = Column(String, unique=True, nullable=False) created_at = Column(