Skip to content
Snippets Groups Projects
Commit 6eabae0d authored by stvn's avatar stvn
Browse files

feat: Implement POST endpoint for discussions API

parent 87e375d6
No related branches found
Tags release-2021-04-08-07.47
No related merge requests found
......@@ -138,6 +138,19 @@ class DiscussionsConfigurationView(APIView):
serializer = self.Serializer(configuration)
return Response(serializer.data)
def post(self, request, course_key_string, **_kwargs) -> Response:
"""
Handle HTTP/POST requests
TODO: Should we cleanup orphaned LTI config when swapping to cs_comments_service?
"""
course_key = self._validate_course_key(course_key_string)
configuration = DiscussionsConfiguration.get(course_key)
serializer = self.Serializer(configuration, data=request.data, partial=True)
if serializer.is_valid(raise_exception=True):
serializer.save()
return Response(serializer.data)
def _validate_course_key(self, course_key_string: str) -> CourseKey:
"""
Validate and parse a course_key string, if supported
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment