|
@@ -33,6 +33,7 @@ def create_new_driver(driver: DriverCreate, db: Session): |
|
|
print("Creating new driver" + str(driver)) |
|
|
print("Creating new driver" + str(driver)) |
|
|
if get_user_by_email(driver.Email, db): |
|
|
if get_user_by_email(driver.Email, db): |
|
|
return "userExists" |
|
|
return "userExists" |
|
|
|
|
|
|
|
|
driver_object = User( |
|
|
driver_object = User( |
|
|
Email=driver.Email, |
|
|
Email=driver.Email, |
|
|
Name=driver.Name, |
|
|
Name=driver.Name, |
|
@@ -124,7 +125,10 @@ def replace_user_data(user_id: int, user_data: UserCreate, db: Session): |
|
|
user.Address = user_data.Address |
|
|
user.Address = user_data.Address |
|
|
user.ContactNumber = user_data.ContactNumber |
|
|
user.ContactNumber = user_data.ContactNumber |
|
|
user.Role = user_data.Role |
|
|
user.Role = user_data.Role |
|
|
user.HashedPassword = Hasher.get_password_hash(user_data.Password) |
|
|
|
|
|
|
|
|
if user_data.Password == "": |
|
|
|
|
|
print("Password not changed") |
|
|
|
|
|
else: |
|
|
|
|
|
user.HashedPassword = Hasher.get_password_hash(user_data.Password) |
|
|
db.commit() |
|
|
db.commit() |
|
|
db.refresh(user) |
|
|
db.refresh(user) |
|
|
return user |
|
|
return user |
|
|