25 lines
783 B
Python
25 lines
783 B
Python
import logging
|
|
from flask import Blueprint, request
|
|
from webargs.flaskparser import parser
|
|
from .. import impl
|
|
from ..services.auth_guard import auth_guard
|
|
import json
|
|
from BreCal.validators.validation_error import create_dynamic_exception_response
|
|
|
|
bp = Blueprint('berths', __name__)
|
|
|
|
|
|
@bp.route('/berths', methods=['get'])
|
|
@auth_guard() # no restriction by role
|
|
def GetBerths():
|
|
|
|
try:
|
|
if 'Authorization' in request.headers:
|
|
token = request.headers.get('Authorization')
|
|
return impl.berths.GetBerths(token)
|
|
else:
|
|
return create_dynamic_exception_response(ex=None, status_code=403, message="not authenticated")
|
|
|
|
except Exception as ex:
|
|
return create_dynamic_exception_response(ex=ex, status_code=400)
|