Skip to content

models#

Data(base) Models

AccessToken #

Bases: SQLAlchemyBaseAccessTokenTableUUID, UpdatedAtMixin, Base

FastAPI Users - Access Token Model

Source code in zoo/models/users.py
class AccessToken(SQLAlchemyBaseAccessTokenTableUUID, UpdatedAtMixin, Base):
    """
    FastAPI Users - Access Token Model
    """

    __tablename__ = "access_token"

Animals #

Bases: IDMixin, CreatedUpdatedMixin, DeletedAtMixin, Base

Animals Database Model

Source code in zoo/models/animals.py
class Animals(IDMixin, CreatedUpdatedMixin, DeletedAtMixin, Base):
    """
    Animals Database Model
    """

    __tablename__ = "animals"

    name: Mapped[str]
    description: Mapped[str] = mapped_column(default=None, nullable=True)
    species: Mapped[str] = mapped_column(default=None, nullable=True)
    exhibit_id: Mapped[int] = mapped_column(
        ForeignKey("exhibits.id"), nullable=True, default=None
    )

    exhibit: Mapped["Exhibits"] = relationship(back_populates="animals")

Exhibits #

Bases: IDMixin, CreatedUpdatedMixin, DeletedAtMixin, Base

Exhibits Database Model

Source code in zoo/models/exhibits.py
class Exhibits(IDMixin, CreatedUpdatedMixin, DeletedAtMixin, Base):
    """
    Exhibits Database Model
    """

    __tablename__ = "exhibits"

    name: Mapped[str]
    description: Mapped[str] = mapped_column(default=None, nullable=True)
    location: Mapped[str] = mapped_column(default=None, nullable=True)

    animals: Mapped[List["Animals"]] = relationship(back_populates="exhibit")
    staff: Mapped[List["Staff"]] = relationship(back_populates="exhibit")

Staff #

Bases: Base, IDMixin, DeletedAtMixin, CreatedUpdatedMixin

Staff Database Model

Source code in zoo/models/staff.py
class Staff(Base, IDMixin, DeletedAtMixin, CreatedUpdatedMixin):
    """
    Staff Database Model
    """

    __tablename__ = "staff"

    id: Mapped[int] = mapped_column(primary_key=True)  # noqa: A003
    name: Mapped[str]
    job_title: Mapped[str] = mapped_column(default=None, nullable=True)
    email: Mapped[str] = mapped_column(default=None, nullable=True)
    phone: Mapped[str] = mapped_column(default=None, nullable=True)
    notes: Mapped[str] = mapped_column(default=None, nullable=True)
    exhibit_id: Mapped[int] = mapped_column(
        ForeignKey("exhibits.id"), nullable=True, default=None
    )

    exhibit: Mapped["Exhibits"] = relationship(back_populates="staff")

User #

Bases: SQLAlchemyBaseUserTableUUID, CreatedUpdatedMixin, Base

FastAPI Users - User Model

Source code in zoo/models/users.py
class User(SQLAlchemyBaseUserTableUUID, CreatedUpdatedMixin, Base):
    """
    FastAPI Users - User Model
    """