fix: name,updated data, db data mapping

This commit is contained in:
TheNoxium
2025-07-29 22:57:31 +05:00
parent e0887c240f
commit b82960faf3
9 changed files with 77 additions and 135 deletions

View File

@@ -98,14 +98,13 @@ async def update_account(
if user_update.password is not None:
await update_password_key(connection, user.id, user_update.password)
update_values = update_user_data_changes(user_update, user)
if update_values is None:
updated_values = user_update.model_dump(by_alias=True, exclude_none=True)
if not updated_values:
return user
user_update_data = UserUpdate.model_validate({**user.model_dump(), **update_values})
await update_user_by_id(connection, update_values, user)
await update_user_by_id(connection, updated_values, user)
user = await get_user_by_id(connection, user_id)
@@ -126,12 +125,12 @@ async def delete_account(
user_update = UserUpdate(status=AccountStatus.DELETED.value)
update_values = update_user_data_changes(user_update, user)
updated_values = user_update.model_dump(by_alias=True, exclude_none=True)
if update_values is None:
if not updated_values:
return user
await update_user_by_id(connection, update_values, user)
await update_user_by_id(connection, updated_values, user)
user = await get_user_by_id(connection, user_id)