diff --git a/api.yml b/api.yml index 7f28370..d6ab2d6 100644 --- a/api.yml +++ b/api.yml @@ -863,6 +863,8 @@ components: balance: type: integer format: float + notes: + type: string example: account_id: "63b6e8e8" client_id: "896d4ed8" @@ -870,6 +872,7 @@ components: opening_timestamp: "17-04-2022 16:21:12" account_type: Savings Account" balance: 2314.23 + notes: "This account is for savings" Transaction: type: object properties: diff --git a/application/account.py b/application/account.py index a26ae0d..77430ef 100644 --- a/application/account.py +++ b/application/account.py @@ -21,7 +21,7 @@ notes_text = None if len(sys.argv) > 3: # Check if the account description is provided as a command line argument account_id = sys.argv[1] - account_description = sys.argv[3] # This is passed so that the window can be titled appopriately + account_description = sys.argv[3] # This is passed so that the window can be titled appropriately else: messagebox.showerror("Error", "Account ID and description were not provided by the server.") sys.exit(1) @@ -66,7 +66,11 @@ def display_account_info(account_id): label_value = customtkinter.CTkLabel(info_frame, text=value, font=("Helvetica", 14)) label_key.grid(row=0, column=i*2, sticky='w', padx=10) label_value.grid(row=0, column=i*2+1, sticky='w', padx=10) - global notes_text + notes = get_account(account_id).get('data', {}).get('notes', '') + + print(f"Account: {account}") # Debugging + print(f"Account: {notes}") # Debugging + notes_text.configure(text=account.get('notes', '')) def on_transaction_double_click(event): @@ -183,11 +187,15 @@ else: welcome_label = customtkinter.CTkLabel(root, text=f"Transactions for: {account_description}", font=("Helvetica", 24)) welcome_label.pack(pady=10) +# Display account information +info_frame = customtkinter.CTkFrame(root) +info_frame.pack(fill=tk.X) + # Create the notes label and text box -notes_label = customtkinter.CTkLabel(root, text="Notes:", font=("Helvetica", 14)) -notes_label.pack(pady=10) -notes_text = customtkinter.CTkLabel(root, height=4, width=50, wraplength=400) # Use CTkLabel instead of CTkTextbox -notes_text.pack(pady=10, fill=tk.BOTH, expand=True) # Add fill and expand options +notes_label = customtkinter.CTkLabel(info_frame, text="Notes:", font=("Helvetica", 14)) +notes_label.grid(row=1, column=0, padx=10, pady=5, sticky='w') +notes_text = customtkinter.CTkLabel(info_frame, height=4, width=50, wraplength=400) # Use CTkLabel instead of CTkTextbox +notes_text.grid(row=1, column=1, padx=10, pady=5, sticky='ew') # Add fill and expand options # Display account information info_frame = customtkinter.CTkFrame(root) diff --git a/application/session_data.json b/application/session_data.json index 02b93f2..475caa5 100644 --- a/application/session_data.json +++ b/application/session_data.json @@ -1 +1 @@ -{"session_cookie": {"session": "rVrt6XfG-HNcgZwJHJGmwEg8boBPPRljoCFcrRfQ-ss"}, "client_id": "9755c18f"} \ No newline at end of file +{"session_cookie": {"session": "zEUX5N4IojE58Mg8yfVC0XiNC-IcnHaZcBJRMRH9J94"}, "client_id": "9755c18f"} \ No newline at end of file diff --git a/bank.db b/bank.db index 2fe4842..374ded4 100644 Binary files a/bank.db and b/bank.db differ diff --git a/class_account.py b/class_account.py index ca84dd8..f8ee9a4 100644 --- a/class_account.py +++ b/class_account.py @@ -39,4 +39,5 @@ class Account(Base): "open_timestamp": self.open_timestamp, "account_type": self.account_type, "balance": self.balance, + "notes": self.notes } \ No newline at end of file diff --git a/manager.py b/manager.py index bb72215..c9dd5f3 100644 --- a/manager.py +++ b/manager.py @@ -160,6 +160,8 @@ def generate_otp(client_id: str): try: send_email(email, "Luxbank One Time Password", f"Your one-time password is: {password}") otps[client_id] = (password, time.time()) # Store the OTP and the current time + log_event(f"OTP Code {password} emailed to {email}") + print(f"OTP Code {password} emailed to {email}") return format_response(True, "OTP generated and sent successfully."), 200 except EmailSendingError as e: log_event(f"Error sending email: {str(e)}") @@ -252,7 +254,6 @@ def get_accounts(client_id: str): @login_required def get_account(account_id:str): """Returns a specific account in the database. If the account is not found, returns an error message.""" - print(account_id) current_client_id, is_admin = get_current_client() account_owner = session.query(Account).filter_by(account_id=account_id).one_or_none().client_id if not is_admin and account_owner != current_client_id: @@ -260,6 +261,7 @@ def get_account(account_id:str): account = session.query(Account).filter_by(account_id=account_id).one_or_none() for account in session.query(Account).all(): if account.account_id == account_id: + print(account.to_dict()) return format_response(True, "", account.to_dict()), 200 return format_response(False, "Account not found."), 404