Skip to content

Commit

Permalink
fix: create-user route
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduard0803 committed Dec 10, 2023
1 parent 8fca7ca commit 336fdd9
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions gestao/web/api/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
from uuid import uuid4

from asyncpg.exceptions import UniqueViolationError
from fastapi import APIRouter, HTTPException, Request
from fastapi import APIRouter, HTTPException

from gestao.db.models.dependent import Dependent
from gestao.db.models.user import User
from gestao.web.api.login.utils import generate_password, send_email
from gestao.web.api.user.enums import UserStatus
from gestao.web.api.user.schemas import CreateUserDTO, UpdateUserDTO

Expand Down Expand Up @@ -45,15 +44,7 @@ async def create_user(request: Request, create_user: CreateUserDTO) -> User:
create_user_dict = create_user.dict()
dependents = create_user_dict.pop("dependents", [])
user_id = str(uuid4())
user_password = generate_password()
create_user_dict["password"] = user_password
url_logo = str(request.url_for("static", path="logo.png"))
send_email(
create_user_dict["fullName"],
create_user_dict["email"],
user_password,
url_logo,
)
create_user_dict["password"] = create_user_dict["cpf"]
await User.objects.create(
id=user_id, **create_user_dict, status=UserStatus.analyzing
)
Expand Down

0 comments on commit 336fdd9

Please sign in to comment.