TIF_E41211115_Genso_quiz_ba.../app/controllers/history_controller.py

25 lines
851 B
Python

from app.services import HistoryService
from app.helpers import make_error_response, make_response
class HistoryController:
def __init__(self, history_service: HistoryService):
self.history_service = history_service
def get_quiz_by_user(self, user_id: str):
try:
data = self.history_service.get_history_by_user_id(user_id)
return make_response(message="retrive history data", data=data)
except Exception as e:
return make_error_response(e)
def get_detail_quiz_history(self, answer_id: str):
try:
data = self.history_service.get_history_by_answer_id(answer_id)
return make_response(
message="success retrive detail history data", data=data
)
except Exception as e:
return make_error_response(e)