feat: deal attributes with select and options
This commit is contained in:
@ -8,8 +8,7 @@ from models.base import BaseModel
|
||||
from models.mixins import IdMixin, SoftDeleteMixin
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from models import Module, Deal
|
||||
|
||||
from models import Module, Deal, AttributeSelect
|
||||
|
||||
module_attribute = Table(
|
||||
"module_attribute",
|
||||
@ -51,6 +50,12 @@ class Attribute(BaseModel, IdMixin, SoftDeleteMixin):
|
||||
lazy="joined",
|
||||
)
|
||||
|
||||
select_id: Mapped[Optional[int]] = mapped_column(ForeignKey("attribute_selects.id"))
|
||||
select: Mapped[Optional["AttributeSelect"]] = relationship(
|
||||
back_populates="attributes",
|
||||
lazy="joined",
|
||||
)
|
||||
|
||||
modules: Mapped[list["Module"]] = relationship(
|
||||
secondary=module_attribute,
|
||||
back_populates="attributes",
|
||||
|
||||
Reference in New Issue
Block a user