Fix: ensure InstalledApp deletion uses model instances instead of Row (#24942)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Yongtao Huang
2025-09-02 11:59:38 +08:00
committed by GitHub
parent 044f96bd93
commit 067b0d07c4
2 changed files with 12 additions and 8 deletions

View File

@@ -130,15 +130,19 @@ class InsertExploreAppApi(Resource):
app.is_public = False app.is_public = False
with Session(db.engine) as session: with Session(db.engine) as session:
installed_apps = session.execute( installed_apps = (
session.execute(
select(InstalledApp).where( select(InstalledApp).where(
InstalledApp.app_id == recommended_app.app_id, InstalledApp.app_id == recommended_app.app_id,
InstalledApp.tenant_id != InstalledApp.app_owner_tenant_id, InstalledApp.tenant_id != InstalledApp.app_owner_tenant_id,
) )
).all() )
.scalars()
.all()
)
for installed_app in installed_apps: for installed_app in installed_apps:
db.session.delete(installed_app) session.delete(installed_app)
db.session.delete(recommended_app) db.session.delete(recommended_app)
db.session.commit() db.session.commit()