fix(backend): Deactivate graph on delete (#8947)

- Resolves #8945

### Changes 🏗️

- Call `on_graph_deactivate` on current active version in `DELETE
/api/graphs/{graph_id}` endpoint
This commit is contained in:
Reinier van der Leer 2024-12-11 20:52:07 +01:00 committed by GitHub
parent b16bf42fa3
commit abf73e8d66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -249,6 +249,13 @@ async def do_create_graph(
async def delete_graph(
graph_id: str, user_id: Annotated[str, Depends(get_user_id)]
) -> DeleteGraphResponse:
if active_version := await graph_db.get_graph(graph_id, user_id=user_id):
def get_credentials(credentials_id: str) -> "Credentials | None":
return integration_creds_manager.get(user_id, credentials_id)
await on_graph_deactivate(active_version, get_credentials)
return {"version_counts": await graph_db.delete_graph(graph_id, user_id=user_id)}