Adding sync with imported parts

This commit is contained in:
Ian Roddis committed 2026-07-02 12:55:13 -03:00
1 parent 00fb43c8ed
commit c320595423
11 files changed
+300 -4

No files matched your search

+7
View File
@@ -2,6 +2,8 @@ from sqlalchemy import ForeignKey, String
from sqlalchemy.orm import Mapped, mapped_column, relationship
from app.core.database import Base
from app.models.associations import augmented_part_imported_parts
from app.models.imported_part import ImportedPart
from app.models.manufacturer import Manufacturer
from app.models.part_colour import PartColour
from app.models.part_type import PartType
@@ -31,6 +33,11 @@ class AugmentedPart(Base):
ForeignKey("sub_part_types.id", ondelete="SET NULL"), nullable=True, default=None
)
# linked imported parts — not eagerly loaded; used by sync service only
imported_parts: Mapped[list[ImportedPart]] = relationship(
secondary=augmented_part_imported_parts, lazy="select"
)
colour: Mapped[PartColour] = relationship(lazy="selectin")
manufacturer: Mapped[Manufacturer] = relationship(lazy="selectin")
scope_model: Mapped[ScopeModel | None] = relationship(lazy="selectin")