aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/models
diff options
context:
space:
mode:
Diffstat (limited to 'pydis_site/apps/api/models')
-rw-r--r--pydis_site/apps/api/models/__init__.py1
-rw-r--r--pydis_site/apps/api/models/bot/__init__.py1
-rw-r--r--pydis_site/apps/api/models/bot/allowlist.py28
3 files changed, 30 insertions, 0 deletions
diff --git a/pydis_site/apps/api/models/__init__.py b/pydis_site/apps/api/models/__init__.py
index 1c9e1d07..04d0fc50 100644
--- a/pydis_site/apps/api/models/__init__.py
+++ b/pydis_site/apps/api/models/__init__.py
@@ -1,5 +1,6 @@
# flake8: noqa
from .bot import (
+ AllowList,
BotSetting,
DocumentationLink,
DeletedMessage,
diff --git a/pydis_site/apps/api/models/bot/__init__.py b/pydis_site/apps/api/models/bot/__init__.py
index 8ae47746..b373ee84 100644
--- a/pydis_site/apps/api/models/bot/__init__.py
+++ b/pydis_site/apps/api/models/bot/__init__.py
@@ -1,4 +1,5 @@
# flake8: noqa
+from .allowlist import AllowList
from .bot_setting import BotSetting
from .deleted_message import DeletedMessage
from .documentation_link import DocumentationLink
diff --git a/pydis_site/apps/api/models/bot/allowlist.py b/pydis_site/apps/api/models/bot/allowlist.py
new file mode 100644
index 00000000..c8fa2e33
--- /dev/null
+++ b/pydis_site/apps/api/models/bot/allowlist.py
@@ -0,0 +1,28 @@
+from django.db import models
+
+from pydis_site.apps.api.models import ModelReprMixin, ModelTimestampMixin
+
+
+class AllowList(ModelTimestampMixin, ModelReprMixin, models.Model):
+ """An item that is either allowed or denied."""
+
+ AllowListType = models.TextChoices(
+ 'guild_invite_id',
+ 'file_format',
+ 'domain_name',
+ 'word_watchlist',
+ )
+ type = models.CharField(
+ max_length=50,
+ help_text=(
+ "The type of allowlist this is on. The value must be one of the following: "
+ f"{','.join(AllowListType.choices)}."
+ ),
+ choices=AllowListType.choices,
+ )
+ allowed = models.BooleanField(
+ help_text="Whether this item is on the allowlist or the denylist."
+ )
+ content = models.TextField(
+ help_text="The data to add to the allowlist."
+ )