fix(models): disambiguate repair estimate user relationships
This commit is contained in:
parent
46eeaa1f2e
commit
7835d3ca75
4 changed files with 31 additions and 5 deletions
|
|
@ -40,7 +40,16 @@ class RepairEstimate(Base):
|
|||
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
||||
|
||||
repair = relationship("Repair", lazy="joined")
|
||||
created_by = relationship("User", lazy="joined")
|
||||
created_by = relationship(
|
||||
"User",
|
||||
foreign_keys="RepairEstimate.created_by_user_id",
|
||||
lazy="joined",
|
||||
)
|
||||
accounting_transferred_by = relationship(
|
||||
"User",
|
||||
foreign_keys="RepairEstimate.accounting_transferred_by_user_id",
|
||||
lazy="joined",
|
||||
)
|
||||
items: Mapped[list["RepairEstimateItem"]] = relationship(
|
||||
back_populates="estimate",
|
||||
cascade="all, delete-orphan",
|
||||
|
|
@ -92,4 +101,8 @@ class RepairEstimateEvent(Base):
|
|||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
estimate: Mapped[RepairEstimate] = relationship(back_populates="events")
|
||||
actor = relationship("User", lazy="joined")
|
||||
actor = relationship(
|
||||
"User",
|
||||
foreign_keys="RepairEstimateEvent.actor_user_id",
|
||||
lazy="joined",
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue