TIF_E41211115_Genso_quiz_ba.../app/blueprints/history.py

32 lines
939 B
Python

from flask import Blueprint
from app.controllers import HistoryController
from app.di_container import Container
from dependency_injector.wiring import inject, Provide
history_blueprint = Blueprint("history", __name__)
@history_blueprint.route("/<user_id>", methods=["GET"])
@inject
def user_history(
user_id: str, controller: HistoryController = Provide[Container.history_controller]
):
return controller.get_quiz_by_user(user_id)
@history_blueprint.route("/detail/<answer_id>", methods=["GET"])
@inject
def user_detail_history(
answer_id, controller: HistoryController = Provide[Container.history_controller]
):
return controller.get_detail_quiz_history(answer_id)
@history_blueprint.route("/session/<session_id>", methods=["GET"])
@inject
def session_history(
session_id: str,
controller: HistoryController = Provide[Container.history_controller],
):
return controller.get_session_history(session_id)