TIF_E41211115_Genso_quiz_ba.../app/blueprints/auth.py

28 lines
835 B
Python

import sys
from flask import Blueprint
from controllers import AuthController
from di_container import Container
from dependency_injector.wiring import inject, Provide
auth_blueprint = Blueprint("auth", __name__)
@auth_blueprint.route("/register", methods=["POST"])
@inject
def register(auth_controller: AuthController = Provide[Container.auth_controller]):
print(auth_controller.test(), file=sys.stderr)
return auth_controller.register()
@auth_blueprint.route("/login", methods=["POST"])
@inject
def login(auth_controller: AuthController = Provide[Container.auth_controller]):
return auth_controller.login()
@auth_blueprint.route("/logout", methods=["DELETE"])
@inject
def logout(auth_controller: AuthController = Provide[Container.auth_controller]):
return auth_controller.logout()