def get_all_acct(userid):
     try:
         if UserService.get_user(userid):
             return jsonify(AccountService.all_account()), 200
     except ResourceNotFound as r:
         r.message
         return "This client does not exist", 404
    def create_user_withid(user_id):

        try:
            user_acct = UserService.get_user(int(user_id)).__dict__
            first_index = (list(user_acct.values())[0])
            print(first_index)
            # print("--------------testing-------------------")
            print(f" The value passed in is : {first_index}")
            for users in AccountService.all_account():
                # print(users)
                print()
                if list(users.values())[0] == first_index:
                    acc = Account()
                    acc.userid = first_index
                    # print(acc)
                    account = AccountService.create_account(acc)
                    # print(users)
                    return jsonify(account.json()), 201
                else:
                    print("Nothing found")

        except ResourceNotFound as r:
            return r.message, 404
Example #3
0
 def get_account(cl_id):
     return jsonify(AccountService.all_account(int(cl_id))), 200
 def get_all_account():
     return jsonify(AccountService.all_account()), 200