chore: save session state – feature/phase-1 ready to implement
- Update session-context.md with exact resume point for next session - Update settings.local.json with broader git permissions - feature/grundstruktur merged to develop - PAT authentication configured Version: 0.2.3
This commit is contained in:
40
backend/app/models/planting.py
Normal file
40
backend/app/models/planting.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import uuid
|
||||
from datetime import date, datetime, timezone
|
||||
|
||||
from sqlalchemy import Date, DateTime, ForeignKey, Integer, Numeric, Text, func
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.db.base import Base
|
||||
|
||||
|
||||
class BedPlanting(Base):
|
||||
__tablename__ = "bed_plantings"
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(
|
||||
primary_key=True, default=uuid.uuid4, index=True
|
||||
)
|
||||
bed_id: Mapped[uuid.UUID] = mapped_column(
|
||||
ForeignKey("beds.id", ondelete="CASCADE"),
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
plant_id: Mapped[uuid.UUID] = mapped_column(
|
||||
ForeignKey("plants.id", ondelete="RESTRICT"),
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
area_m2: Mapped[float | None] = mapped_column(Numeric(5, 2), nullable=True)
|
||||
count: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
planted_date: Mapped[date | None] = mapped_column(Date, nullable=True)
|
||||
removed_date: Mapped[date | None] = mapped_column(Date, nullable=True)
|
||||
notes: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
server_default=func.now(),
|
||||
nullable=False,
|
||||
)
|
||||
|
||||
# Relationships
|
||||
bed: Mapped["Bed"] = relationship("Bed", back_populates="plantings") # noqa: F821
|
||||
plant: Mapped["Plant"] = relationship("Plant", back_populates="plantings") # noqa: F821
|
||||
Reference in New Issue
Block a user