Added history for achievements to frontend #268_achievements
This commit is contained in:
@@ -27,6 +27,7 @@ from bot_graphql.mutations.level_mutation import LevelMutation
|
||||
from bot_graphql.mutations.user_joined_game_server_mutation import UserJoinedGameServerMutation
|
||||
from bot_graphql.mutations.user_mutation import UserMutation
|
||||
from bot_graphql.queries.achievement_attribute_query import AchievementAttributeQuery
|
||||
from bot_graphql.queries.achievement_history_query import AchievementHistoryQuery
|
||||
from bot_graphql.queries.achievement_query import AchievementQuery
|
||||
from bot_graphql.queries.auto_role_history_query import AutoRoleHistoryQuery
|
||||
from bot_graphql.queries.auto_role_query import AutoRoleQuery
|
||||
@@ -69,6 +70,7 @@ class GraphQLModule(ModuleABC):
|
||||
# queries
|
||||
services.add_transient(QueryABC, AchievementAttributeQuery)
|
||||
services.add_transient(QueryABC, AchievementQuery)
|
||||
services.add_transient(QueryABC, AchievementHistoryQuery)
|
||||
services.add_transient(QueryABC, AutoRoleHistoryQuery)
|
||||
services.add_transient(QueryABC, AutoRoleQuery)
|
||||
services.add_transient(QueryABC, AutoRoleRuleHistoryQuery)
|
||||
|
@@ -28,7 +28,7 @@ type AchievementHistory implements HistoryTableQuery {
|
||||
operator: String
|
||||
value: String
|
||||
|
||||
server: Server
|
||||
server: ID
|
||||
|
||||
deleted: Boolean
|
||||
dateFrom: String
|
||||
|
13
kdb-bot/src/bot_graphql/queries/achievement_history_query.py
Normal file
13
kdb-bot/src/bot_graphql/queries/achievement_history_query.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from bot_graphql.abc.history_query_abc import HistoryQueryABC
|
||||
|
||||
|
||||
class AchievementHistoryQuery(HistoryQueryABC):
|
||||
def __init__(self):
|
||||
HistoryQueryABC.__init__(self, "Achievement")
|
||||
|
||||
self.set_field("id", lambda x, *_: x.id)
|
||||
self.set_field("name", lambda x, *_: x.name)
|
||||
self.set_field("attribute", lambda x, *_: x.attribute)
|
||||
self.set_field("operator", lambda x, *_: x.operator)
|
||||
self.set_field("value", lambda x, *_: x.value)
|
||||
self.set_field("server", lambda x, *_: x.server)
|
@@ -1,6 +1,6 @@
|
||||
from cpl_core.database.context import DatabaseContextABC
|
||||
|
||||
from bot_data.model.user_history import UserHistory
|
||||
from bot_data.model.achievement_history import AchievementHistory
|
||||
from bot_graphql.abc.data_query_with_history_abc import DataQueryWithHistoryABC
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class AchievementQuery(DataQueryWithHistoryABC):
|
||||
self,
|
||||
db: DatabaseContextABC,
|
||||
):
|
||||
DataQueryWithHistoryABC.__init__(self, "Achievement", "AchievementsHistory", UserHistory, db)
|
||||
DataQueryWithHistoryABC.__init__(self, "Achievement", "AchievementsHistory", AchievementHistory, db)
|
||||
|
||||
self.set_field("id", lambda x, *_: x.id)
|
||||
self.set_field("name", lambda x, *_: x.name)
|
||||
|
Reference in New Issue
Block a user