mirror of
https://github.com/open-webui/open-webui
synced 2024-11-25 21:38:43 +00:00
chore: delete user backend refac
This commit is contained in:
parent
7fade0bb2f
commit
48cc2c5053
@ -153,5 +153,14 @@ class ChatTable:
|
||||
except:
|
||||
return False
|
||||
|
||||
def delete_chats_by_user_id(self, user_id: str) -> bool:
|
||||
try:
|
||||
query = Chat.delete().where(Chat.user_id == user_id)
|
||||
query.execute() # Remove the rows, return number of rows removed.
|
||||
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
Chats = ChatTable(DB)
|
||||
|
@ -115,14 +115,16 @@ class UsersTable:
|
||||
def delete_user_by_id(self, id: str) -> bool:
|
||||
try:
|
||||
# Delete User Chats
|
||||
query = Chat.delete().where(Chat.user_id == id)
|
||||
query.execute() # Remove the rows, return number of rows removed.
|
||||
result = Chat.delete_chats_by_user_id(id)
|
||||
|
||||
# Delete User
|
||||
query = User.delete().where(User.id == id)
|
||||
query.execute() # Remove the rows, return number of rows removed.
|
||||
if result:
|
||||
# Delete User
|
||||
query = User.delete().where(User.id == id)
|
||||
query.execute() # Remove the rows, return number of rows removed.
|
||||
|
||||
return True
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except:
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user