diff options
author | 2020-04-06 14:17:53 +0200 | |
---|---|---|
committer | 2020-04-06 14:17:53 +0200 | |
commit | f13f8b8852bf80836f2ad69b4e077af7b376a3ad (patch) | |
tree | 24ea70318d6e4589c9e86850eb470c2907e322b6 | |
parent | Merge pull request #339 from python-discord/feat/deps/o138/pre-commit-hooks (diff) |
Allow PATCH requests on the OffensiveMessage modeloffensive-messages-patch
This is required in order to reschedule failed message deletions
-rw-r--r-- | pydis_site/apps/api/viewsets/bot/offensive_message.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/pydis_site/apps/api/viewsets/bot/offensive_message.py b/pydis_site/apps/api/viewsets/bot/offensive_message.py index 54cb3a38..169ba718 100644 --- a/pydis_site/apps/api/viewsets/bot/offensive_message.py +++ b/pydis_site/apps/api/viewsets/bot/offensive_message.py @@ -1,7 +1,8 @@ from rest_framework.mixins import ( CreateModelMixin, DestroyModelMixin, - ListModelMixin + ListModelMixin, + UpdateModelMixin ) from rest_framework.viewsets import GenericViewSet @@ -10,7 +11,7 @@ from pydis_site.apps.api.serializers import OffensiveMessageSerializer class OffensiveMessageViewSet( - CreateModelMixin, ListModelMixin, DestroyModelMixin, GenericViewSet + CreateModelMixin, ListModelMixin, DestroyModelMixin, UpdateModelMixin, GenericViewSet ): """ View providing CRUD access to offensive messages. @@ -46,6 +47,20 @@ class OffensiveMessageViewSet( - 201: returned on success - 400: if the body format is invalid + ### POST /bot/offensive-messages/<id:int> + Edit an existing offensive message object with the given `id`. + + #### Request body + >>> { + ... 'channel_id': int + ... 'delete_date': datetime.datetime # ISO-8601-formatted date + ... } + + #### Status codes + - 200: returned on success + - 400: if the body format is invalid + - 404: if the offensive message object with the given `id` does not exist + ### DELETE /bot/offensive-messages/<id:int> Delete the offensive message object with the given `id`. |