add routers usersé

This commit is contained in:
Valentin CZERYBA 2023-10-27 23:50:35 +02:00
parent 4e2cf12c3b
commit 4059411828

View File

@ -1,4 +1,4 @@
from fastapi import APIRouter, Depends, HTTPException, status
from fastapi import APIRouter, Depends, HTTPException, status, Response
from fastapi.responses import JSONResponse
from datetime import datetime
from ..dependencies import users_token, permissions_checker, database
@ -104,8 +104,8 @@ async def update_users_id(authorize: Annotated[bool, Depends(permissions_checker
user = user_repository.find_one_by({"username": {'$eq': userSingle.username}})
if user is None:
response.status_code = status.HTTP_201_CREATED
user = users.User()
Response.status_code = status.HTTP_201_CREATED
user = users.User(username=userSingle.username, password=users_token.get_password_hash(userSingle.password), email=userSingle.email)
user.username = userSingle.username
user.password = users_token.get_password_hash(userSingle.password)
user.roles = userSingle.roles