Added to server query #378

This commit is contained in:
Sven Heidemann 2023-09-28 10:52:51 +02:00
parent 4a763e4e03
commit 4161d3a38a
4 changed files with 13 additions and 0 deletions

View File

@ -16,6 +16,7 @@ class FeatureFlagsEnum(Enum):
level_module = "LevelModule"
moderator_module = "ModeratorModule"
permission_module = "PermissionModule"
short_role_name = "ShortRoleName"
# features
api_only = "ApiOnly"
presence = "Presence"

View File

@ -18,6 +18,7 @@ class FeatureFlagsSettings(ConfigurationModelABC):
FeatureFlagsEnum.moderator_module.value: False, # 02.10.2022 #48
FeatureFlagsEnum.permission_module.value: True, # 02.10.2022 #48
FeatureFlagsEnum.config_module.value: True, # 19.07.2023 #127
FeatureFlagsEnum.short_role_name.value: False, # 28.09.2023 #378
# features
FeatureFlagsEnum.api_only.value: False, # 13.10.2022 #70
FeatureFlagsEnum.presence.value: True, # 03.10.2022 #56

View File

@ -31,6 +31,9 @@ type Server implements TableWithHistoryQuery {
achievementCount: Int
achievements(filter: AchievementFilter, page: Page, sort: Sort): [Achievement]
shortRoleNameCount: Int
shortRoleNames(filter: ShortRoleNameFilter, page: Page, sort: Sort): [ShortRoleName]
config: ServerConfig
createdAt: String

View File

@ -7,6 +7,7 @@ from bot_data.abc.client_repository_abc import ClientRepositoryABC
from bot_data.abc.game_server_repository_abc import GameServerRepositoryABC
from bot_data.abc.level_repository_abc import LevelRepositoryABC
from bot_data.abc.server_config_repository_abc import ServerConfigRepositoryABC
from bot_data.abc.short_role_name_repository_abc import ShortRoleNameRepositoryABC
from bot_data.abc.user_joined_server_repository_abc import UserJoinedServerRepositoryABC
from bot_data.abc.user_joined_voice_channel_repository_abc import UserJoinedVoiceChannelRepositoryABC
from bot_data.abc.user_repository_abc import UserRepositoryABC
@ -17,6 +18,7 @@ from bot_graphql.filter.achievement_filter import AchievementFilter
from bot_graphql.filter.auto_role_filter import AutoRoleFilter
from bot_graphql.filter.client_filter import ClientFilter
from bot_graphql.filter.level_filter import LevelFilter
from bot_graphql.filter.short_role_name_filter import ShortRoleNameFilter
from bot_graphql.filter.user_filter import UserFilter
@ -33,6 +35,7 @@ class ServerQuery(DataQueryWithHistoryABC):
ujs: UserJoinedServerRepositoryABC,
ujvs: UserJoinedVoiceChannelRepositoryABC,
achievements: AchievementRepositoryABC,
short_role_names: ShortRoleNameRepositoryABC,
server_configs: ServerConfigRepositoryABC,
):
DataQueryWithHistoryABC.__init__(self, "Server", "ServersHistory", ServerHistory, db)
@ -64,6 +67,11 @@ class ServerQuery(DataQueryWithHistoryABC):
self.add_collection(
"achievement", lambda server, *_: achievements.get_achievements_by_server_id(server.id), AchievementFilter
)
self.add_collection(
"shortRoleName",
lambda server, *_: short_role_names.get_short_role_names_by_server_id(server.id),
ShortRoleNameFilter,
)
self.set_field("config", lambda server, *_: server_configs.get_server_config_by_server(server.id))
@staticmethod