from __future__ import annotations from typing import TYPE_CHECKING from sqlalchemy import ForeignKey, Integer from sqlalchemy.orm import Mapped, mapped_column, relationship from fooder.domain.base import Base, CommonMixin, EntryMacrosMixin from fooder.domain.product import Product if TYPE_CHECKING: from fooder.domain.preset import Preset class PresetEntry(Base, CommonMixin, EntryMacrosMixin): """PresetEntry.""" grams: Mapped[float] product_id: Mapped[int] = mapped_column( Integer, ForeignKey("product.id"), index=True ) product: Mapped[Product] = relationship(lazy="selectin") preset_id: Mapped[int] = mapped_column(Integer, ForeignKey("preset.id"), index=True) preset: Mapped[Preset] = relationship(back_populates="entries")