Skip to content

Commit

Permalink
Merge pull request #2 from Marishka17/documentation
Browse files Browse the repository at this point in the history
Added documentation for swagger page
  • Loading branch information
Marishka17 authored Dec 11, 2019
2 parents 9f63686 + 3264684 commit e670b3e
Show file tree
Hide file tree
Showing 2 changed files with 177 additions and 6 deletions.
22 changes: 22 additions & 0 deletions cvat/apps/authentication/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
from . import forms
from . import signature

from django.utils.decorators import method_decorator
from drf_yasg.utils import swagger_auto_schema
from drf_yasg import openapi

def register_user(request):
if request.method == 'POST':
form = forms.NewUserForm(request.POST)
Expand All @@ -27,7 +31,25 @@ def register_user(request):
form = forms.NewUserForm()
return render(request, 'register.html', {'form': form})

@method_decorator(name='post', decorator=swagger_auto_schema(
request_body=openapi.Schema(
type=openapi.TYPE_OBJECT,
required=[
'url'
],
properties={
'url': openapi.Schema(type=openapi.TYPE_STRING)
}
),
responses={'200': openapi.Response(description='text URL')}
))
class SigningView(views.APIView):
"""
This method signs URL for access to the server.
Signed URL contains a token which authenticates a user on the server.
Signed URL is valid during 30 seconds since signing.
"""
def post(self, request):
url = request.data.get('url')
if not url:
Expand Down
Loading

0 comments on commit e670b3e

Please sign in to comment.