apidoc updates
This commit is contained in:
@@ -5,16 +5,19 @@ from marshmallow import fields
|
||||
|
||||
from api.exceptions import NotFoundException, BadRequestException
|
||||
from api.target_exchange.models import TargetExchange
|
||||
from api.utils import docwrap
|
||||
|
||||
from .models import Target
|
||||
from .serializers import target_schema, targets_schema
|
||||
|
||||
blueprint = Blueprint('target', __name__)
|
||||
doc = docwrap('Target')
|
||||
|
||||
|
||||
@doc(tags=['Target'])
|
||||
@doc
|
||||
@blueprint.route('', methods=['GET'])
|
||||
@jwt_required()
|
||||
@use_kwargs({'exchange': fields.Str()})
|
||||
@use_kwargs({'exchange': fields.Str()}, location='query')
|
||||
@marshal_with(targets_schema)
|
||||
def get_list(exchange=None):
|
||||
res = Target.query
|
||||
@@ -23,7 +26,7 @@ def get_list(exchange=None):
|
||||
return res.all()
|
||||
|
||||
|
||||
@doc(tags=['Target'])
|
||||
@doc
|
||||
@blueprint.route('', methods=['POST'])
|
||||
@jwt_required()
|
||||
@use_kwargs(target_schema)
|
||||
@@ -37,7 +40,7 @@ def create(name, routing_key, exchange):
|
||||
return target
|
||||
|
||||
|
||||
@doc(tags=['Target'])
|
||||
@doc
|
||||
@blueprint.route('/<target_id>', methods=['GET'])
|
||||
@jwt_required()
|
||||
@marshal_with(target_schema)
|
||||
@@ -49,7 +52,7 @@ def get_by_id(target_id: int):
|
||||
return NotFoundException(Target.__name__)
|
||||
|
||||
|
||||
@doc(tags=['Target'])
|
||||
@doc
|
||||
@blueprint.route('/<target_id>', methods=['PUT'])
|
||||
@jwt_required()
|
||||
@use_kwargs(target_schema)
|
||||
|
||||
Reference in New Issue
Block a user