Example #1
0
 def add_user(
     email: str,
     password: str,
     first_name: str,
     last_name: str,
     account: int,
     bot: str,
     user: str,
     is_integration_user=False,
     role="trainer",
 ):
     """ Adds a new user to the app based on the details
         provided by the user """
     assert not Utility.check_empty_string(email) and not Utility.check_empty_string(last_name) and not Utility.check_empty_string(first_name) and not Utility.check_empty_string(password),"Email, FirstName, LastName and password cannot be empty or blank spaces "
     Utility.is_exist(
         User,
         exp_message="User already exists! try with different email address.",
         email__iexact=email.strip(), status=True
     )
     return (
         User(
             email=email.strip(),
             password=Utility.get_password_hash(password.strip()),
             first_name=first_name.strip(),
             last_name=last_name.strip(),
             account=account,
             bot=bot.strip(),
             user=user.strip(),
             is_integration_user=is_integration_user,
             role=role.strip(),
         )
         .save()
         .to_mongo()
         .to_dict()
     )
Example #2
0
 def add_user(
     email: str,
     password: str,
     first_name: str,
     last_name: str,
     account: int,
     bot: str,
     user: str,
     is_integration_user=False,
     role="trainer",
 ):
     Utility.is_exist(
         User,
         query={"email": email},
         exp_message=
         "User already exists! try with different email address.",
     )
     return (User(
         email=email,
         password=Utility.get_password_hash(password),
         first_name=first_name,
         last_name=last_name,
         account=account,
         bot=bot,
         user=user,
         is_integration_user=is_integration_user,
         role=role,
     ).save().to_mongo().to_dict())
Example #3
0
def user_details(*args, **kwargs):
    return {
        "email": "*****@*****.**",
        "password": Utility.get_password_hash("welcome@1"),
        "first_name": "integration",
        "last_name": "test",
        "status": True,
        "bot": "integration",
        "account": 1,
        "is_integration_user": False,
    }