From d10cf30456669cc841d79221f2f74f8385530dfd Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 30 Nov 2020 19:26:17 +0200 Subject: Add allowed question types constant --- backend/constants.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'backend/constants.py') diff --git a/backend/constants.py b/backend/constants.py index 746e277..c7db8e6 100644 --- a/backend/constants.py +++ b/backend/constants.py @@ -15,3 +15,14 @@ OAUTH2_REDIRECT_URI = os.getenv( ) SECRET_KEY = os.getenv("SECRET_KEY", binascii.hexlify(os.urandom(30)).decode()) + +QUESTION_TYPES = [ + "radio", + "checkbox", + "select", + "short_text", + "textarea", + "code", + "range", + "section", +] -- cgit v1.2.3 From 11d6b2e9fdbc97d6dabe3cc6f52859acced48e45 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 30 Nov 2020 19:44:39 +0200 Subject: Add question types data requirements to constants --- backend/constants.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'backend/constants.py') diff --git a/backend/constants.py b/backend/constants.py index c7db8e6..1816354 100644 --- a/backend/constants.py +++ b/backend/constants.py @@ -26,3 +26,21 @@ QUESTION_TYPES = [ "range", "section", ] + +REQUIRED_QUESTION_TYPE_DATA = { + "radio": { + "options": list, + }, + "select": { + "options": list, + }, + "code": { + "language": str, + }, + "range": { + "options": list, + }, + "section": { + "text": str, + }, +} -- cgit v1.2.3 From 0ec52e5b8349674bccd449d46a8ea2ce5b011f99 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Mon, 30 Nov 2020 20:15:03 +0200 Subject: Add Enum for form features --- backend/constants.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'backend/constants.py') diff --git a/backend/constants.py b/backend/constants.py index 1816354..3b8bec8 100644 --- a/backend/constants.py +++ b/backend/constants.py @@ -3,6 +3,8 @@ load_dotenv() import os # noqa import binascii # noqa +from enum import Enum # noqa + DATABASE_URL = os.getenv("DATABASE_URL") MONGO_DATABASE = os.getenv("MONGO_DATABASE", "pydis_forms") @@ -44,3 +46,13 @@ REQUIRED_QUESTION_TYPE_DATA = { "text": str, }, } + + +class FormFeatures(Enum): + """Lists form features. Read more in SCHEMA.md.""" + + DISCOVERABLE = "DISCOVERABLE" + REQUIRES_LOGIN = "REQUIRES_LOGIN" + OPEN = "OPEN" + COLLECT_EMAIL = "COLLECT_EMAIL" + DISABLE_ANTISPAM = "DISABLE_ANTISPAM" -- cgit v1.2.3