orm filter -> where (#22801)

Signed-off-by: -LAN- <laipz8200@outlook.com>
Co-authored-by: -LAN- <laipz8200@outlook.com>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Asuka Minato
2025-07-24 01:57:45 +09:00
committed by GitHub
parent e64e7563f6
commit ef51678c73
161 changed files with 828 additions and 857 deletions

View File

@@ -153,11 +153,11 @@ class ApiToolProvider(Base):
def user(self) -> Account | None:
if not self.user_id:
return None
return db.session.query(Account).filter(Account.id == self.user_id).first()
return db.session.query(Account).where(Account.id == self.user_id).first()
@property
def tenant(self) -> Tenant | None:
return db.session.query(Tenant).filter(Tenant.id == self.tenant_id).first()
return db.session.query(Tenant).where(Tenant.id == self.tenant_id).first()
class ToolLabelBinding(Base):
@@ -223,11 +223,11 @@ class WorkflowToolProvider(Base):
@property
def user(self) -> Account | None:
return db.session.query(Account).filter(Account.id == self.user_id).first()
return db.session.query(Account).where(Account.id == self.user_id).first()
@property
def tenant(self) -> Tenant | None:
return db.session.query(Tenant).filter(Tenant.id == self.tenant_id).first()
return db.session.query(Tenant).where(Tenant.id == self.tenant_id).first()
@property
def parameter_configurations(self) -> list[WorkflowToolParameterConfiguration]:
@@ -235,7 +235,7 @@ class WorkflowToolProvider(Base):
@property
def app(self) -> App | None:
return db.session.query(App).filter(App.id == self.app_id).first()
return db.session.query(App).where(App.id == self.app_id).first()
class MCPToolProvider(Base):
@@ -280,11 +280,11 @@ class MCPToolProvider(Base):
)
def load_user(self) -> Account | None:
return db.session.query(Account).filter(Account.id == self.user_id).first()
return db.session.query(Account).where(Account.id == self.user_id).first()
@property
def tenant(self) -> Tenant | None:
return db.session.query(Tenant).filter(Tenant.id == self.tenant_id).first()
return db.session.query(Tenant).where(Tenant.id == self.tenant_id).first()
@property
def credentials(self) -> dict: