Coverage for app/models/Probe.py: 100%
13 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-16 20:06 +0000
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-16 20:06 +0000
1import uuid
3from sqlalchemy import UUID, CheckConstraint, Enum, Integer
4from sqlalchemy.orm import Mapped, mapped_column, relationship
6from app.models.Base import Base
7from app.schemas.direction import Direction
10class Probe(Base):
11 __tablename__ = "probe"
13 id: Mapped[uuid.UUID] = mapped_column(
14 UUID(as_uuid=True), primary_key=True, default=uuid.uuid4
15 )
16 x: Mapped[int] = mapped_column(Integer, nullable=False)
17 y: Mapped[int] = mapped_column(Integer, nullable=False)
18 direction: Mapped[Direction] = mapped_column(
19 Enum(Direction, name="direction"), nullable=False
20 )
22 grid: Mapped["Grid"] = relationship( # type: ignore # noqa: F821
23 "Grid", back_populates="probe", uselist=False, lazy="selectin"
24 )
26 __table_args__ = (
27 CheckConstraint("x >= 0", name="check_valid_probe_x_position"),
28 CheckConstraint("y >= 0", name="check_valid_probe_y_position"),
29 )