feat: add webapp clean up

This commit is contained in:
GareArc 2025-04-10 15:19:28 -04:00
parent 4105c8ff70
commit 4785c061a9
2 changed files with 14 additions and 0 deletions

View File

@ -317,6 +317,10 @@ class AppService:
db.session.delete(app)
db.session.commit()
# clean up web app settings
if FeatureService.get_system_features().webapp_auth.enabled:
EnterpriseService.cleanup_webapp(app.id)
# Trigger asynchronous deletion of app and related data
remove_app_and_related_data_task.delay(tenant_id=app.tenant_id, app_id=app.id)

View File

@ -58,3 +58,13 @@ class EnterpriseService:
response = EnterpriseRequest.send_request("POST", "/webapp/access-mode", json=data)
return response.get("result", False)
@classmethod
def cleanup_webapp(cls, app_id: str):
if not app_id:
raise ValueError("app_id must be provided.")
body = {
"appId": app_id
}
EnterpriseRequest.send_request("DELETE", "/webapp/clean", json=body)