Exemple #1
0
    def update_user(self, updated_user: User) -> Optional[User]:
        updated_user.last_updated = datetime.now()

        try:
            updated_user.save()
            updated_user.refresh()
            return updated_user
        except Exception as e:
            LOG.exception(str(e))
            return None
Exemple #2
0
    def create_user(new_user: User) -> Optional[User]:
        new_user.id = str(uuid.uuid4())
        new_user.password = UsersService.encrypt_password(new_user.password)
        new_user.last_updated = datetime.now()

        try:
            new_user.save()
            new_user.refresh()
            return new_user
        except Exception as e:
            LOG.exception(str(e))
            return None