mirror of
https://github.com/open-webui/computer.git
synced 2026-11-28 16:11:44 -05:00
refac
This commit is contained in:
1 parent
0fddcba26d
commit
07e7b7623b
13 files changed
+592
-209
No files matched your search
@@ -97,6 +97,21 @@ class Workspace(Base):
|
||||
await db.commit()
|
||||
return result.rowcount > 0
|
||||
|
||||
@staticmethod
|
||||
async def delete_by_paths(user_id: str, paths: list[str]) -> int:
|
||||
"""Delete workspaces by path. Returns the number of deleted rows."""
|
||||
if not paths:
|
||||
return 0
|
||||
async with await get_db() as db:
|
||||
result = await db.execute(
|
||||
delete(Workspace).where(
|
||||
Workspace.user_id == user_id,
|
||||
Workspace.path.in_(paths),
|
||||
)
|
||||
)
|
||||
await db.commit()
|
||||
return result.rowcount or 0
|
||||
|
||||
@staticmethod
|
||||
async def delete_by_user(user_id: str) -> None:
|
||||
"""Delete all workspaces for a user."""
|
||||
|
||||
Reference in new issue
Block a user