Added more queries #162
This commit is contained in:
parent
5efb1da0b8
commit
ebcf876457
@ -5,11 +5,11 @@ from cpl_core.database import TableABC
|
|||||||
|
|
||||||
class KnownUser(TableABC):
|
class KnownUser(TableABC):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
dc_id: int,
|
dc_id: int,
|
||||||
created_at: datetime = None,
|
created_at: datetime = None,
|
||||||
modified_at: datetime = None,
|
modified_at: datetime = None,
|
||||||
id=0,
|
id=0,
|
||||||
):
|
):
|
||||||
self._known_user_id = id
|
self._known_user_id = id
|
||||||
self._discord_id = dc_id
|
self._discord_id = dc_id
|
||||||
|
@ -6,7 +6,7 @@ from bot_graphql.abc.filter_abc import FilterABC
|
|||||||
|
|
||||||
class UserFilter(FilterABC):
|
class UserFilter(FilterABC):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
):
|
):
|
||||||
FilterABC.__init__(self)
|
FilterABC.__init__(self)
|
||||||
|
|
||||||
@ -18,18 +18,18 @@ class UserFilter(FilterABC):
|
|||||||
self._level = None
|
self._level = None
|
||||||
|
|
||||||
def from_dict(self, values: dict):
|
def from_dict(self, values: dict):
|
||||||
if 'id' in values:
|
if "id" in values:
|
||||||
self._id = values['id']
|
self._id = values["id"]
|
||||||
if 'discord_id' in values:
|
if "discord_id" in values:
|
||||||
self._discord_id = values['discord_id']
|
self._discord_id = values["discord_id"]
|
||||||
if 'name' in values:
|
if "name" in values:
|
||||||
self._name = values['name']
|
self._name = values["name"]
|
||||||
if 'xp' in values:
|
if "xp" in values:
|
||||||
self._xp = values['xp']
|
self._xp = values["xp"]
|
||||||
if 'ontime' in values:
|
if "ontime" in values:
|
||||||
self._ontime = values['ontime']
|
self._ontime = values["ontime"]
|
||||||
if 'level' in values:
|
if "level" in values:
|
||||||
self._level = values['level']
|
self._level = values["level"]
|
||||||
|
|
||||||
def filter(self, query: List[User]) -> List[User]:
|
def filter(self, query: List[User]) -> List[User]:
|
||||||
if self._id is not None:
|
if self._id is not None:
|
||||||
|
@ -19,8 +19,8 @@ class Query(QueryType):
|
|||||||
self.set_field("servers", self.resolve_servers)
|
self.set_field("servers", self.resolve_servers)
|
||||||
self.set_field("server_count", self.resolve_server_count)
|
self.set_field("server_count", self.resolve_server_count)
|
||||||
|
|
||||||
self.set_field("known_users", self.resolve_servers)
|
self.set_field("known_users", self.resolve_known_users)
|
||||||
self.set_field("known_users_count", self.resolve_server_count)
|
self.set_field("known_user_count", self.resolve_known_users_count)
|
||||||
|
|
||||||
@FilterABC.resolve_filter_annotation
|
@FilterABC.resolve_filter_annotation
|
||||||
def resolve_servers(self, *_, filter: ServerFilter = None):
|
def resolve_servers(self, *_, filter: ServerFilter = None):
|
||||||
|
Loading…
Reference in New Issue
Block a user