Added leftServer handling to members list #130

This commit is contained in:
2023-02-18 12:14:04 +01:00
parent afff27b273
commit 7d67b08ce6
11 changed files with 97 additions and 43 deletions

View File

@@ -31,7 +31,9 @@ class ServerFilter(FilterABC):
query = query.where(lambda x: x.id == self._id)
if self._discord_id is not None:
query = query.where(lambda x: x.discord_id == self._discord_id)
query = query.where(
lambda x: x.discord_id == self._discord_id or str(self._discord_id) in str(x.discord_id)
)
if self._name is not None:

View File

@@ -73,7 +73,7 @@ class UserFilter(FilterABC):
def filter(self, query: List[User]) -> List[User]:
if self._id is not None:
query = query.where(lambda x: x.id == self._id or str(self._id) in str(x.id))
query = query.where(lambda x: x.id == self._id)
if self._discord_id is not None:
query = query.where(

View File

@@ -91,5 +91,6 @@ class UserQuery(DataQueryABC):
def resolve_server(user: User, *_):
return user.server
def resolve_left_server(self, user: User, *_):
return self._ujs.find_active_user_joined_server_by_user_id(user.id) is None
@staticmethod
def resolve_left_server(user: User, *_):
return user.left_server