"""User API blueprint and endpoint definitions.""" from flask import Blueprint, abort from atheneum.api.decorators import return_json from atheneum.api.model import APIResponse from atheneum.middleware import authentication_middleware from atheneum.service import user_service USER_BLUEPRINT = Blueprint( name='user', import_name=__name__, url_prefix='/user') @USER_BLUEPRINT.route('/', methods=['GET']) @return_json @authentication_middleware.require_token_auth def get_user(name: str) -> APIResponse: """ Get a token for continued authentication. :return: A login token for continued authentication """ user = user_service.find_by_name(name) if user is not None: return APIResponse(user, 200) return abort(404)