TIF_E41211115_Genso_quiz_ba.../app/controllers/auth_controller.py

29 lines
808 B
Python

from flask import jsonify, request
from schemas import LoginSchema
from services import UserService
from services import AuthService
class AuthController:
def __init__(self, userService: UserService, authService: AuthService):
self.user_service = userService
self.auth_service = authService
def login(self):
data = request.get_json()
dataSchema = LoginSchema(**data)
response = self.auth_service.login(dataSchema)
if response.success:
return jsonify(response.to_dict()), 200
return jsonify(response.to_dict()), 400
def register(self):
return jsonify({"message": "register"})
def logout(self):
return jsonify({"message": "logout"})
def test(self):
return "test"