apidoc updates
This commit is contained in:
@@ -5,18 +5,21 @@ from marshmallow import fields
|
||||
from sqlalchemy import or_
|
||||
|
||||
from api.exceptions import NotFoundException, BadRequestException
|
||||
from api.utils import docwrap
|
||||
from api.target.models import Target
|
||||
from api.target_exchange.models import TargetExchange
|
||||
|
||||
from .models import Registration
|
||||
from .serializers import registration_schema, registrations_schema
|
||||
|
||||
blueprint = Blueprint('Registration', __name__)
|
||||
doc = docwrap('Registration')
|
||||
|
||||
|
||||
@doc(tags=['Registration'])
|
||||
@doc
|
||||
@blueprint.route('', methods=['GET'])
|
||||
@jwt_required()
|
||||
@use_kwargs({'exchange': fields.Str(), 'target': fields.Str()})
|
||||
@use_kwargs({'exchange': fields.Str(), 'target': fields.Str()}, location='query')
|
||||
@marshal_with(registrations_schema)
|
||||
def get_list(exchange=None, target=None):
|
||||
res = Registration.query
|
||||
@@ -26,7 +29,7 @@ def get_list(exchange=None, target=None):
|
||||
return res.all()
|
||||
|
||||
|
||||
@doc(tags=['Registration'])
|
||||
@doc
|
||||
@blueprint.route('', methods=['POST'])
|
||||
@jwt_required()
|
||||
@use_kwargs(registration_schema)
|
||||
@@ -43,7 +46,7 @@ def create(name, routing_key, targets):
|
||||
return registration
|
||||
|
||||
|
||||
@doc(tags=['Registration'])
|
||||
@doc
|
||||
@blueprint.route('/<registration_id>', methods=['GET'])
|
||||
@jwt_required()
|
||||
@marshal_with(registration_schema)
|
||||
@@ -55,7 +58,7 @@ def get_by_id(registration_id: int):
|
||||
return NotFoundException(Registration.__name__)
|
||||
|
||||
|
||||
@doc(tags=['Registration'])
|
||||
@doc
|
||||
@blueprint.route('/<registration_id>', methods=['PUT'])
|
||||
@jwt_required()
|
||||
@use_kwargs(registration_schema)
|
||||
|
||||
Reference in New Issue
Block a user