From 92205106861815984163db3fab6812bb6a4ea69a Mon Sep 17 00:00:00 2001 From: Rapeepan Date: Wed, 1 May 2024 16:28:37 +0700 Subject: [PATCH] :recycle: Refactor user update functions and schemas --- app/crud/user.py | 2 +- app/schemas/user.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/crud/user.py b/app/crud/user.py index 0aef036..bf36671 100644 --- a/app/crud/user.py +++ b/app/crud/user.py @@ -88,7 +88,7 @@ def update_user(db: Session, user_id: str, user: updateUser): def update_user_by_super_admin(db: Session, user_id: str, user: updateUserBySuperAdmin): db_user = db.query(User).filter(User.id == user_id).first() # type: ignore - list_data = ["firstName", "lastName", "phoneNumber", "role", "is_active"] + list_data = ["firstName", "lastName", "phoneNumber","email", "role", "is_active"] try: for data in list_data: if hasattr(user, data): diff --git a/app/schemas/user.py b/app/schemas/user.py index ee646cb..0dade7d 100644 --- a/app/schemas/user.py +++ b/app/schemas/user.py @@ -51,6 +51,7 @@ class updateUserBySuperAdmin(BaseModel): firstName: Optional[str] lastName: Optional[str] phoneNumber: Optional[str] + email: Optional[str] role: Optional[str] is_active: Optional[bool]