Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(api): remove InstalledApp implicit-session accessor (#42000)

nehal-a2zcd031ab42311
diff --git a/api/models/model.py b/api/models/model.py
index 93eb4e6f850..216fed2be6a 100644
--- a/api/models/model.py
+++ b/api/models/model.py
@@ -1006,10 +1006,6 @@ class InstalledApp(TypeBase):
sa.DateTime, nullable=False, server_default=func.current_timestamp(), init=False
)
- @property
- def app(self) -> App | None:
- return self.app_with_session(session=db.session())
-
def app_with_session(self, *, session: Session) -> App | None:
return session.scalar(select(App).where(App.id == self.app_id))
diff --git a/api/tests/unit_tests/controllers/console/explore/test_wraps.py b/api/tests/unit_tests/controllers/console/explore/test_wraps.py
index 71027ae6d52..53f87e22c5f 100644
--- a/api/tests/unit_tests/controllers/console/explore/test_wraps.py
+++ b/api/tests/unit_tests/controllers/console/explore/test_wraps.py
@@ -128,8 +128,9 @@ def test_installed_app_required_success(
result = view(installed_app.id)
assert result.id == installed_app.id
- assert result.app is not None
- assert result.app.id == app.id
+ app_model = result.app_with_session(session=sqlite_session)
+ assert app_model is not None
+ assert app_model.id == app.id
def test_user_allowed_to_access_app_denied():