CI / backend-tests (push) Failing after 35s
1. passlib 1.7.4 liest bcrypt.__about__.__version__, das bcrypt>=4.1 entfernt hat - führte zu irreführendem "password cannot be longer than 72 bytes". Fix: bcrypt<4.1 pinnen. 2. Globaler async engine in conftest.py + pytest-asyncios default function-scoped Event-Loop führte zu "Task ... attached to a different loop" bei asyncpg. Fix: session-weiter Loop-Scope für Fixtures und Tests. Erster echter CI-Lauf (Host-Runner ohne Docker) kam bis zum pytest-Schritt durch, beide Fehler dort aufgedeckt. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L85hmKbvX7Cqkq47KnQhFt
36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
import enum
|
|
|
|
from sqlalchemy import ForeignKey, String
|
|
from sqlalchemy.dialects.postgresql import ENUM as PgEnum
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db.base import Base
|
|
|
|
|
|
class ObjektStatus(str, enum.Enum):
|
|
aktiv = "aktiv"
|
|
ausser_dienst = "ausser_dienst"
|
|
|
|
|
|
objekt_status_pg = PgEnum(ObjektStatus, name="objekt_status", create_type=False)
|
|
|
|
|
|
class Objekt(Base):
|
|
"""Sprint 2 (Prompt 08/09/10): Objekt referenziert eine konkrete Beladungsvorlagen-
|
|
Version. Sollmenge-Auflösung/Duplizieren siehe app/services/objekte.py."""
|
|
|
|
__tablename__ = "objekt"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
code: Mapped[str] = mapped_column(String, unique=True, nullable=False)
|
|
name: Mapped[str] = mapped_column(String, nullable=False)
|
|
objekttyp_id: Mapped[int] = mapped_column(ForeignKey("objekttyp.id"), nullable=False)
|
|
vorlage_id: Mapped[int | None] = mapped_column(ForeignKey("beladungsvorlage.id"))
|
|
standort_id: Mapped[int] = mapped_column(ForeignKey("standort.id"), nullable=False)
|
|
status: Mapped[ObjektStatus] = mapped_column(
|
|
objekt_status_pg, nullable=False, default=ObjektStatus.aktiv
|
|
)
|
|
zustaendiger_server_id: Mapped[int] = mapped_column(
|
|
ForeignKey("systemknoten.id"), nullable=False
|
|
)
|