mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Delete associated entries with an agent when it is deleted
This commit is contained in:
@@ -568,6 +568,10 @@ class AgentAdapters:
|
||||
@staticmethod
|
||||
async def adelete_agent_by_slug(agent_slug: str, user: KhojUser):
|
||||
agent = await AgentAdapters.aget_agent_by_slug(agent_slug, user)
|
||||
|
||||
async for entry in Entry.objects.filter(agent=agent).aiterator():
|
||||
await entry.adelete()
|
||||
|
||||
if agent:
|
||||
await agent.adelete()
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user