Added more queries #162

This commit is contained in:
Sven Heidemann 2023-01-15 10:59:54 +01:00
parent 5efb1da0b8
commit ebcf876457
3 changed files with 20 additions and 20 deletions

View File

@ -5,11 +5,11 @@ from cpl_core.database import TableABC
class KnownUser(TableABC):
def __init__(
self,
dc_id: int,
created_at: datetime = None,
modified_at: datetime = None,
id=0,
self,
dc_id: int,
created_at: datetime = None,
modified_at: datetime = None,
id=0,
):
self._known_user_id = id
self._discord_id = dc_id

View File

@ -6,7 +6,7 @@ from bot_graphql.abc.filter_abc import FilterABC
class UserFilter(FilterABC):
def __init__(
self,
self,
):
FilterABC.__init__(self)
@ -18,18 +18,18 @@ class UserFilter(FilterABC):
self._level = None
def from_dict(self, values: dict):
if 'id' in values:
self._id = values['id']
if 'discord_id' in values:
self._discord_id = values['discord_id']
if 'name' in values:
self._name = values['name']
if 'xp' in values:
self._xp = values['xp']
if 'ontime' in values:
self._ontime = values['ontime']
if 'level' in values:
self._level = values['level']
if "id" in values:
self._id = values["id"]
if "discord_id" in values:
self._discord_id = values["discord_id"]
if "name" in values:
self._name = values["name"]
if "xp" in values:
self._xp = values["xp"]
if "ontime" in values:
self._ontime = values["ontime"]
if "level" in values:
self._level = values["level"]
def filter(self, query: List[User]) -> List[User]:
if self._id is not None:

View File

@ -19,8 +19,8 @@ class Query(QueryType):
self.set_field("servers", self.resolve_servers)
self.set_field("server_count", self.resolve_server_count)
self.set_field("known_users", self.resolve_servers)
self.set_field("known_users_count", self.resolve_server_count)
self.set_field("known_users", self.resolve_known_users)
self.set_field("known_user_count", self.resolve_known_users_count)
@FilterABC.resolve_filter_annotation
def resolve_servers(self, *_, filter: ServerFilter = None):