aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/models
diff options
context:
space:
mode:
authorGravatar D0rs4n <[email protected]>2021-12-15 19:25:55 +0100
committerGravatar D0rs4n <[email protected]>2021-12-18 18:02:12 +0100
commit4c93b1b9b75cce4e45bdbdae608f4497372c2b56 (patch)
treee79f011a3407103bb255a6fbd04a4815964cc312 /pydis_site/apps/api/models
parentPatch Filter and FilterList Serializer validation logic and representation (diff)
Prepare FilterList and Filter models, serializers for the new filter schema
- Rename channel scope fields: - "allowed" -> "disabled" eg.: "allowed_channels" -> "disabled_channels" - Rename FilterLists` names: filter_token -> tokens domain_name -> domains guild_invite -> invites file_format -> formats - Patch the docs and validators accordingly.
Diffstat (limited to 'pydis_site/apps/api/models')
-rw-r--r--pydis_site/apps/api/models/bot/filters.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/pydis_site/apps/api/models/bot/filters.py b/pydis_site/apps/api/models/bot/filters.py
index 3a1f3c6a..ae877685 100644
--- a/pydis_site/apps/api/models/bot/filters.py
+++ b/pydis_site/apps/api/models/bot/filters.py
@@ -99,14 +99,12 @@ class FilterList(FilterSettingsMixin):
# Where a filter should apply.
#
# The resolution is done in the following order:
- # - disallowed channels
- # - disallowed categories
- # - allowed categories
- # - allowed channels
- disallowed_channels = ArrayField(models.IntegerField())
- disallowed_categories = ArrayField(models.IntegerField())
- allowed_channels = ArrayField(models.IntegerField())
- allowed_categories = ArrayField(models.IntegerField())
+ # - enabled_channels
+ # - disabled_categories
+ # - disabled_channels
+ enabled_channels = ArrayField(models.IntegerField())
+ disabled_channels = ArrayField(models.IntegerField())
+ disabled_categories = ArrayField(models.IntegerField())
class Meta:
"""Constrain name and list_type unique."""
@@ -157,10 +155,9 @@ class Filter(FilterSettingsMixin):
)
# Check FilterList model for information about these properties.
- disallowed_channels = ArrayField(models.IntegerField(), null=True)
- disallowed_categories = ArrayField(models.IntegerField(), null=True)
- allowed_channels = ArrayField(models.IntegerField(), null=True)
- allowed_categories = ArrayField(models.IntegerField(), null=True)
+ enabled_channels = ArrayField(models.IntegerField(), null=True)
+ disabled_channels = ArrayField(models.IntegerField(), null=True)
+ disabled_categories = ArrayField(models.IntegerField(), null=True)
def __str__(self) -> str:
return f"Filter {self.content!r}"