admin_schemas: move FEATURES schema to there

This commit is contained in:
Luna 2019-03-13 18:35:01 -03:00
parent a12c63a7bf
commit 1ad328904d
3 changed files with 14 additions and 10 deletions

View File

@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
""" """
from litecord.enums import Feature
VOICE_SERVER = { VOICE_SERVER = {
'hostname': {'type': 'string', 'maxlength': 255, 'required': True} 'hostname': {'type': 'string', 'maxlength': 255, 'required': True}
} }
@ -29,3 +31,12 @@ VOICE_REGION = {
'deprecated': {'type': 'boolean', 'default': False}, 'deprecated': {'type': 'boolean', 'default': False},
'custom': {'type': 'boolean', 'default': False}, 'custom': {'type': 'boolean', 'default': False},
} }
FEATURES = {
'features': {
'type': 'list', 'required': True,
# using Feature doesn't seem to work with a "not callable" error.
'schema': {'coerce': lambda x: Feature(x)}
}
}

View File

@ -22,7 +22,8 @@ from quart import Blueprint, current_app as app, jsonify, request
from litecord.auth import admin_check from litecord.auth import admin_check
from litecord.errors import BadRequest from litecord.errors import BadRequest
from litecord.schemas import validate, FEATURES from litecord.schemas import validate
from litecord.admin_schemas import FEATURES
from litecord.blueprints.guilds import vanity_invite from litecord.blueprints.guilds import vanity_invite
bp = Blueprint('features_admin', __name__) bp = Blueprint('features_admin', __name__)

View File

@ -28,7 +28,7 @@ from .permissions import Permissions
from .types import Color from .types import Color
from .enums import ( from .enums import (
ActivityType, StatusType, ExplicitFilter, RelationshipType, ActivityType, StatusType, ExplicitFilter, RelationshipType,
MessageNotifications, ChannelType, VerificationLevel, Feature MessageNotifications, ChannelType, VerificationLevel
) )
from litecord.embed.schemas import EMBED_OBJECT from litecord.embed.schemas import EMBED_OBJECT
@ -656,14 +656,6 @@ GET_MENTIONS = {
'guild_id': {'coerce': int, 'required': False} 'guild_id': {'coerce': int, 'required': False}
} }
FEATURES = {
'features': {
'type': 'list', 'required': True,
# using Feature doesn't seem to work with a "not callable" error.
'schema': {'coerce': lambda x: Feature(x)}
}
}
VANITY_URL_PATCH = { VANITY_URL_PATCH = {
# TODO: put proper values in maybe an invite data type # TODO: put proper values in maybe an invite data type