feat: Add orm for Tools and clean up Tool logic (#1935)

This commit is contained in:
Matthew Zhou
2024-10-25 14:25:40 -07:00
committed by GitHub
parent 150240c7a7
commit d74406af41
37 changed files with 833 additions and 789 deletions

View File

@@ -55,7 +55,6 @@ class OrganizationMixin(Base):
__abstract__ = True
# Changed _organization_id to store string (still a valid UUID4 string)
_organization_id: Mapped[str] = mapped_column(String, ForeignKey("organization._id"))
@property
@@ -65,3 +64,19 @@ class OrganizationMixin(Base):
@organization_id.setter
def organization_id(self, value: str) -> None:
_relation_setter(self, "organization", value)
class UserMixin(Base):
"""Mixin for models that belong to a user."""
__abstract__ = True
_user_id: Mapped[str] = mapped_column(String, ForeignKey("user._id"))
@property
def user_id(self) -> str:
return _relation_getter(self, "user")
@user_id.setter
def user_id(self, value: str) -> None:
_relation_setter(self, "user", value)