feat: modules and module-editor pages
This commit is contained in:
@ -1,9 +1,10 @@
|
||||
import enum
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
from sqlalchemy import Table, Column, ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from models import AttributeValue, Attribute
|
||||
from models.base import BaseModel
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -31,8 +32,9 @@ class Module(BaseModel):
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
key: Mapped[str] = mapped_column(unique=True)
|
||||
label: Mapped[str] = mapped_column()
|
||||
description: Mapped[str] = mapped_column()
|
||||
description: Mapped[Optional[str]] = mapped_column()
|
||||
is_deleted: Mapped[bool] = mapped_column(default=False)
|
||||
is_built_in: Mapped[bool] = mapped_column(default=False, server_default="0")
|
||||
|
||||
depends_on: Mapped[list["Module"]] = relationship(
|
||||
secondary=module_dependencies,
|
||||
@ -61,6 +63,14 @@ class Module(BaseModel):
|
||||
lazy="immediate", backref="module", cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
attributes: Mapped[list["Attribute"]] = relationship(
|
||||
secondary="module_attribute", back_populates="modules"
|
||||
)
|
||||
|
||||
attribute_values: Mapped[list["AttributeValue"]] = relationship(
|
||||
lazy="noload", back_populates="module"
|
||||
)
|
||||
|
||||
|
||||
class DeviceType(enum.StrEnum):
|
||||
MOBILE = "mobile"
|
||||
|
||||
Reference in New Issue
Block a user