From 1435d100286c0ea434c2995d1cd993045b2103f0 Mon Sep 17 00:00:00 2001 From: ImportErr Date: Fri, 30 Nov 2018 18:48:32 +0000 Subject: Fixed member route typos --- api/viewsets.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/viewsets.py b/api/viewsets.py index de5ddaf6..86ab5758 100644 --- a/api/viewsets.py +++ b/api/viewsets.py @@ -365,7 +365,7 @@ class TagViewSet(ModelViewSet): - 201: returned on success - 400: if one of the given fields is invalid - ### PUT /bot/members/ + ### PUT /bot/tags/ Update the tag with the given `title`. #### Request body @@ -383,7 +383,7 @@ class TagViewSet(ModelViewSet): - 400: if the request body was invalid, see response body for details - 404: if the tag with the given `title` could not be found - ### PATCH /bot/members/ + ### PATCH /bot/tags/ Update the tag with the given `title`. #### Request body @@ -401,7 +401,7 @@ class TagViewSet(ModelViewSet): - 400: if the request body was invalid, see response body for details - 404: if the tag with the given `title` could not be found - ### DELETE /bot/members/ + ### DELETE /bot/tags/ Deletes the tag with the given `title`. #### Status codes -- cgit v1.2.3 From ccdf2b163bf7a439ea38c5f3ba7fd479c055d8e0 Mon Sep 17 00:00:00 2001 From: ImportErr Date: Sat, 1 Dec 2018 12:08:35 +0000 Subject: Ordered models alphabetically --- api/models.py | 110 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/api/models.py b/api/models.py index 7623c86c..fc031b6e 100644 --- a/api/models.py +++ b/api/models.py @@ -60,6 +60,50 @@ class OffTopicChannelName(ModelReprMixin, models.Model): return self.name +class Role(ModelReprMixin, models.Model): + """A role on our Discord server.""" + + id = models.BigIntegerField( # noqa + primary_key=True, + validators=( + MinValueValidator( + limit_value=0, + message="Role IDs cannot be negative." + ), + ), + help_text="The role ID, taken from Discord." + ) + name = models.CharField( + max_length=100, + help_text="The role name, taken from Discord." + ) + colour = models.IntegerField( + validators=( + MinValueValidator( + limit_value=0, + message="Colour hex cannot be negative." + ), + ), + help_text="The integer value of the colour of this role from Discord." + ) + permissions = models.IntegerField( + validators=( + MinValueValidator( + limit_value=0, + message="Role permissions cannot be negative." + ), + MaxValueValidator( + limit_value=2 << 32, + message="Role permission bitset exceeds value of having all permissions" + ) + ), + help_text="The integer value of the permission bitset of this role from Discord." + ) + + def __str__(self): + return self.name + + class SnakeFact(ModelReprMixin, models.Model): """A snake fact used by the bot's snake cog.""" @@ -125,48 +169,24 @@ class SpecialSnake(ModelReprMixin, models.Model): return self.name -class Role(ModelReprMixin, models.Model): - """A role on our Discord server.""" +class Tag(ModelReprMixin, models.Model): + """A tag providing (hopefully) useful information.""" - id = models.BigIntegerField( # noqa - primary_key=True, - validators=( - MinValueValidator( - limit_value=0, - message="Role IDs cannot be negative." - ), - ), - help_text="The role ID, taken from Discord." - ) - name = models.CharField( + title = models.CharField( max_length=100, - help_text="The role name, taken from Discord." - ) - colour = models.IntegerField( - validators=( - MinValueValidator( - limit_value=0, - message="Colour hex cannot be negative." - ), + help_text=( + "The title of this tag, shown in searches and providing " + "a quick overview over what this embed contains." ), - help_text="The integer value of the colour of this role from Discord." + primary_key=True ) - permissions = models.IntegerField( - validators=( - MinValueValidator( - limit_value=0, - message="Role permissions cannot be negative." - ), - MaxValueValidator( - limit_value=2 << 32, - message="Role permission bitset exceeds value of having all permissions" - ) - ), - help_text="The integer value of the permission bitset of this role from Discord." + embed = pgfields.JSONField( + help_text="The actual embed shown by this tag.", + validators=(validate_tag_embed,) ) def __str__(self): - return self.name + return self.title class User(ModelReprMixin, models.Model): @@ -214,23 +234,3 @@ class User(ModelReprMixin, models.Model): def __str__(self): return f"{self.name}#{self.discriminator}" - - -class Tag(ModelReprMixin, models.Model): - """A tag providing (hopefully) useful information.""" - - title = models.CharField( - max_length=100, - help_text=( - "The title of this tag, shown in searches and providing " - "a quick overview over what this embed contains." - ), - primary_key=True - ) - embed = pgfields.JSONField( - help_text="The actual embed shown by this tag.", - validators=(validate_tag_embed,) - ) - - def __str__(self): - return self.title -- cgit v1.2.3 From 9d5b6491f8825e4b366be3e6db0429237311dd1e Mon Sep 17 00:00:00 2001 From: ImportErr Date: Sat, 1 Dec 2018 12:23:02 +0000 Subject: Renamed class in test_users --- api/tests/test_users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/tests/test_users.py b/api/tests/test_users.py index 8dadcbdb..90bc3d30 100644 --- a/api/tests/test_users.py +++ b/api/tests/test_users.py @@ -4,7 +4,7 @@ from .base import APISubdomainTestCase from ..models import Role, User -class UnauthedDocumentationLinkAPITests(APISubdomainTestCase): +class UnauthedUserAPITests(APISubdomainTestCase): def setUp(self): super().setUp() self.client.force_authenticate(user=None) -- cgit v1.2.3