feat: profile image update backend

This commit is contained in:
Timothy J. Baek 2024-01-26 20:27:45 -08:00
parent 0e831f4cf7
commit 418da74756
3 changed files with 52 additions and 11 deletions

View file

@ -108,6 +108,20 @@ class UsersTable:
except:
return None
def update_user_profile_image_url_by_id(
self, id: str, profile_image_url: str
) -> Optional[UserModel]:
try:
query = User.update(profile_image_url=profile_image_url).where(
User.id == id
)
query.execute()
user = User.get(User.id == id)
return UserModel(**model_to_dict(user))
except:
return None
def update_user_by_id(self, id: str, updated: dict) -> Optional[UserModel]:
try:
query = User.update(**updated).where(User.id == id)