Removed unused code

This commit is contained in:
bsquillari 2023-12-04 12:29:47 +00:00
parent a7d0fbc091
commit 5e548162ee
1 changed files with 1 additions and 21 deletions

View File

@ -3,7 +3,7 @@ from flask import request
from flask_restx import Namespace, Resource from flask_restx import Namespace, Resource
from src import bcrypt from src import bcrypt
from src.api.cruds.users import add_user, get_user_by_email, get_user_by_id from src.api.cruds.users import get_user_by_email, get_user_by_id
from src.api.models.users import User from src.api.models.users import User
auth_namespace = Namespace("auth") auth_namespace = Namespace("auth")
@ -19,25 +19,6 @@ parser = auth_namespace.parser()
parser.add_argument("Authorization", location="headers") parser.add_argument("Authorization", location="headers")
class Register(Resource):
@auth_namespace.marshal_with(auth_user_model)
@auth_namespace.expect(auth_full_user_model, validate=True)
@auth_namespace.response(201, "Success")
@auth_namespace.response(400, "Sorry. That email already exists.")
def post(self):
post_data = request.get_json()
username = post_data.get("username")
email = post_data.get("email")
password = post_data.get("password")
user = get_user_by_email(email)
if user:
auth_namespace.abort(400, "Sorry. That email already exists.")
user = add_user(username, email, password)
return user, 201
class Login(Resource): class Login(Resource):
@auth_namespace.marshal_with(auth_tokens_model) @auth_namespace.marshal_with(auth_tokens_model)
@auth_namespace.expect(auth_login_model, validate=True) @auth_namespace.expect(auth_login_model, validate=True)
@ -124,7 +105,6 @@ class Status(Resource):
auth_namespace.abort(403, "Token required") auth_namespace.abort(403, "Token required")
auth_namespace.add_resource(Register, "/register")
auth_namespace.add_resource(Login, "/login") auth_namespace.add_resource(Login, "/login")
auth_namespace.add_resource(Refresh, "/refresh") auth_namespace.add_resource(Refresh, "/refresh")
auth_namespace.add_resource(Status, "/status") auth_namespace.add_resource(Status, "/status")