apidoc updates

This commit is contained in:
Gardient
2021-09-30 23:00:46 +03:00
parent 71c1e322aa
commit 04d70ba424
8 changed files with 42 additions and 24 deletions

View File

@@ -4,21 +4,19 @@ from flask_apispec import use_kwargs, marshal_with, doc
from marshmallow import fields
from api.exceptions import BadRequestException
from api.utils import docwrap
import api.constants as constants
from .serializers import token_response_schema
from .serializers import token_response_schema, login_schema
blueprint = Blueprint('login', __name__)
@doc(tags=['login'])
@docwrap('Login', None)
@blueprint.route('', methods=['POST'])
@jwt_required(optional=True)
@use_kwargs({
'username': fields.Str(required=True),
'password': fields.Str(required=True)
})
@use_kwargs(login_schema)
@marshal_with(token_response_schema)
def login_user(username, password, **kwargs):
def login_user(username, password):
if username == constants.API_USER and password == current_app.config[constants.API_PASS]:
return {'token': create_access_token(identity=username, fresh=True, expires_delta=False)}
else: