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

27 lines
737 B
Python

from flask import jsonify, request
from services import UserService
from services import AuthService
import sys
class AuthController:
def __init__(self, userService: UserService, authService: AuthService):
self.user_service = userService
self.auth_service = authService
def login(self):
data = request.get_json()
response = self.auth_service.login(data)
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"