Added maintenance to db and gql #424
This commit is contained in:
@@ -11,6 +11,7 @@ from bot_api.exception.service_error_code_enum import ServiceErrorCode
|
||||
from bot_api.exception.service_exception import ServiceException
|
||||
from bot_api.route.route import Route
|
||||
from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum
|
||||
from bot_core.environment_variables import MAINTENANCE
|
||||
from bot_data.model.achievement import Achievement
|
||||
from bot_data.model.auth_role_enum import AuthRoleEnum
|
||||
from bot_data.model.auth_user import AuthUser
|
||||
@@ -93,7 +94,7 @@ class QueryABC(ObjectType):
|
||||
if permissions.is_member_technician(guild.get_member(u.discord_id)):
|
||||
return True
|
||||
|
||||
if config.get_configuration("MAINTENANCE"):
|
||||
if config.get_configuration(MAINTENANCE):
|
||||
return False
|
||||
|
||||
access = False
|
||||
@@ -242,11 +243,11 @@ class QueryABC(ObjectType):
|
||||
match permission:
|
||||
case UserRoleEnum.moderator:
|
||||
can_edit = permissions.is_member_moderator
|
||||
if config.get_configuration("MAINTENANCE"):
|
||||
if config.get_configuration(MAINTENANCE):
|
||||
can_edit = lambda x: False
|
||||
case UserRoleEnum.admin:
|
||||
can_edit = permissions.is_member_admin
|
||||
if config.get_configuration("MAINTENANCE"):
|
||||
if config.get_configuration(MAINTENANCE):
|
||||
can_edit = lambda x: False
|
||||
case UserRoleEnum.technician:
|
||||
can_edit = permissions.is_member_technician
|
||||
|
@@ -5,6 +5,7 @@ type TechnicianConfig implements TableWithHistoryQuery {
|
||||
waitForShutdown: Int
|
||||
cacheMaxMessages: Int
|
||||
maxSteamOfferCount: Int
|
||||
maintenance: Boolean
|
||||
featureFlagCount: Int
|
||||
featureFlags: [FeatureFlag]
|
||||
pingURLs: [String]
|
||||
@@ -25,6 +26,7 @@ type TechnicianConfigHistory implements HistoryTableQuery {
|
||||
waitForShutdown: Int
|
||||
cacheMaxMessages: Int
|
||||
maxSteamOfferCount: Int
|
||||
maintenance: Boolean
|
||||
featureFlagCount: Int
|
||||
featureFlags: [FeatureFlag]
|
||||
|
||||
@@ -62,6 +64,7 @@ input TechnicianConfigInput {
|
||||
waitForShutdown: Int
|
||||
cacheMaxMessages: Int
|
||||
maxSteamOfferCount: Int
|
||||
maintenance: Boolean
|
||||
featureFlags: [FeatureFlagInput]
|
||||
pingURLs: [String]
|
||||
technicianIds: [String]
|
||||
|
@@ -62,6 +62,9 @@ class TechnicianConfigMutation(QueryABC):
|
||||
technician_config.max_steam_offer_count = (
|
||||
input["maxSteamOfferCount"] if "maxSteamOfferCount" in input else technician_config.max_steam_offer_count
|
||||
)
|
||||
technician_config.max_steam_offer_count = (
|
||||
input["maintenance"] if "maintenance" in input else technician_config.maintenance
|
||||
)
|
||||
old_feature_flags = technician_config.feature_flags
|
||||
technician_config.feature_flags = (
|
||||
dict(
|
||||
|
Reference in New Issue
Block a user