Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
c22af013fd | |||
a6b11a8096 | |||
16949c83d7 | |||
5b347a020a | |||
e5128a9182 | |||
579ac3d303 | |||
ce24b50b8b | |||
587763d808 |
@ -11,7 +11,7 @@ class User(BaseModel):
|
||||
roles: str = "User"
|
||||
status: int = 0
|
||||
email: EmailStr
|
||||
birth: str | None = None
|
||||
birth: datetime | None = None
|
||||
created_at: datetime = datetime.today()
|
||||
connected_at: datetime | None = None
|
||||
updated_at: datetime | None = None
|
||||
|
@ -143,9 +143,12 @@ async def delete_users_id(item_id : str, authorize: Annotated[bool, Depends(perm
|
||||
async def update_users_me(current_user: Annotated[users.User, Depends(users_token.get_current_active_user)], authorize: Annotated[bool, Depends(permissions_checker.PermissionChecker(roles=["Admin", "User"]))], userSingle: users.UserIn | None = None):
|
||||
user_repository = users.UserRepository(database=database.database)
|
||||
current_user.username = userSingle.username
|
||||
if len(userSingle.password) > 0:
|
||||
current_user.password = user_token.get_password_hash(userSingle.password)
|
||||
current_user.roles = userSingle.roles
|
||||
current_user.email = userSingle.email
|
||||
current_user.name = userSingle.name
|
||||
current_user.firstName = userSingle.firstName
|
||||
current_user.birth = userSingle.birth
|
||||
user_repository.save(current_user)
|
||||
content = {"message": "user is updated"}
|
||||
response = JSONResponse(content=content)
|
||||
@ -202,6 +205,7 @@ async def update_users_id(item_id: str, authorize: Annotated[bool, Depends(permi
|
||||
)
|
||||
|
||||
user.username = userSingle.username
|
||||
if len(userSingle.password) > 0:
|
||||
user.password = users_token.get_password_hash(userSingle.password)
|
||||
user.roles = userSingle.roles
|
||||
user.email = userSingle.email
|
||||
|
Loading…
x
Reference in New Issue
Block a user