please make  Six Pages .html:
- Ensure you have the following views:
- Dashboard
- Transaction History
- Budget Management
- Investments Tracker
- Savings Goals
- Debt Overview

3. HTML and Thymeleaf:
- Use Thymeleaf for dynamic content rendering in HTML.

4. JavaScript External Scripts:
- Make sure there is at least one external JavaScript file if you’re using any client-side logic.

5. Navigation:
- Include a reusable navigation bar across pages for seamless user experience.
This is the project i am trying to built:
I. Project Description
The project, named WealthGuardian, is a comprehensive personal financial management
application designed to help individuals monitor and manage their daily economic activities.
WealthGuardian was chosen as the name because it emphasizes the app’s role in guarding and
optimizing users’ wealth through insightful financial monitoring and guidance. The core functionalities of
WealthGuardian include budget tracking, which allows users to set monthly spending limits and track
day-to-day expenses to ensure they stay on budget. The investment tracker enables users to monitor
their portfolio performance, providing insights on stocks, bonds, and other investments (although this
part may be an overreach on the dev’s part).
Additionally, WealthGuardian offers a savings goal tracker that motivates and assists users in
achieving their short and long-term saving objectives by setting incremental landmarks. Finally, the
application integrates a debt management plan that offers tailored advice on reducing liabilities and
improving financial health. Overall, the aim of WealthGuardian is to offer an intuitive and accessible
interface that empowers users to enhance their financial literacy and achieve greater economic security.
Using the MoSCoW method, application of prioritization to WealthGuardian:
Essentials (MUST have)
- User authentication and management.
- Basic transaction tracking.
- Basic budget creation and tracking.
Important (SHOULD have)
- A detailed dashboard for a quick overview of financial health.
- Alerts or notifications for budget limits.
Nice to Have (COULD have)
- Investment tracking (simplified version).
- Use of interactive charts for financial data visualization.
Non-Essential (WON’T have this time)
- Comprehensive debt management tools.
- Advanced investment analysis features.
- In-depth financial health reports.
II. Model and Table Structure
List of Models:
1. User - Manages user information and authentication details.
2. Transaction - Records individual financial transactions to monitor spending and investments.
3. Account - Represents various financial accounts, such as checking, savings, or investment accounts.
4. Budget - Helps in setting and tracking monthly spending limits and financial goals.
List of Tables:
1. Table Name: Users
- Primary Key: user_id
- Model Related: User
2. Table Name: Transactions
- Primary Key: transaction_id
3- Foreign Key: account_id (links to Accounts table)
- Model Related: Transaction
3. Table Name: Accounts
- Primary Key: account_id
- Foreign Key: user_id (links to Users table)
- Model Related: Account
4. Table Name: Budgets
- Primary Key: budget_id
- Foreign Key: user_id (links to Users table)
- Model Related: Budget
III.List of Web Pages:
1. Dashboard - Provides an overview of all financial metrics including recent transactions, budget
summary, and savings goals.
2. Transaction History - Displays a detailed log of all financial transactions allowing users to review past
expenses and deposits.
3. Budget Management - Enables users to create, edit, and monitor their monthly budgets, visualizing
data to aid in financial decision-making.
4. Investments Tracker - Offers a comprehensive view of investment portfolios with performance
metrics and individual asset reviews.
5. Savings Goals - Allows setting and tracking of various saving objectives, offering motivational insights
and progress reports.
6. Debt Overview - Shows all liabilities and provides plans and suggestions for efficient debt
management.5. Savings Goals - Allows setting and tracking of various saving objectives, offering motivational insights
and progress reports.
6. Debt Overview - Shows all liabilities and provides plans and suggestions for efficient debt


Components Already Done:
- Models (User, Transaction, Account, Budget)
- Repositories
- Services
- Controllers
- Exception Handling
- Utility Classes
User.java:

Purpose: Represents a user in the WealthGuardian application, managing user information and authentication details.

Annotations:

@Entity: Indicates that this class is an entity that maps to a database table.
@Table(name = “users”): Specifies the table name for this entity in the database.
Summary of Responsibilities:

Defines the structure of a user entity with properties like userId, username, password, and accounts.
Uses @OneToMany to establish a one-to-many relationship with Account entities through the accounts field.
Provides getters and setters for accessing and modifying entity properties.

UserRepository.java:

Purpose: Manages the persistence of User entities, providing methods for CRUD operations.

Annotations:

@Repository: Marks this interface as a repository component managed by Spring for data access.
Summary of Responsibilities:

Extends JpaRepository<User, Long> to inherit methods for CRUD operations on User entities.
Defines additional query methods such as findByUsername for custom data retrieval operations.

UserService.java:

Purpose: Implements business logic operations related to User entities, utilizing UserRepository for data access.

Annotations:

@Service: Indicates that this class is a service component in the Spring framework, managing business logic.
Summary of Responsibilities:

Provides methods to manage User entities:saveUser(User user): Saves a new user or updates an existing one.
getUserById(Long userId): Retrieves a user by their ID.
getAllUsers(): Retrieves all users stored in the repository.
findByUsername(String username): Retrieves a user by their username.
Uses UserRepository for data access operations.

UserController.java:

Purpose: Defines HTTP endpoints for CRUD operations on User entities, serving as an interface between clients and the application’s business logic.

Annotations:

@RestController: Indicates that this class is a REST controller, facilitating RESTful endpoints.
@RequestMapping(“/api/users”): Specifies the base URL path for handling requests related to users.
Summary of Responsibilities:

Defines HTTP endpoints (POST, GET) for managing User entities:createUser: Handles HTTP POST requests to create a new user.
getUserById: Handles HTTP GET requests to retrieve a user by their ID.
getAllUsers: Handles HTTP GET requests to retrieve all users.
Uses UserService to delegate business logic operations.
Returns appropriate ResponseEntity objects with status codes for success or failure scenarios.

Summary of Responsibilities (Overall):

User.java: Defines the structure and relationships of a user entity, including one-to-many with Account.
UserRepository.java: Manages the persistence of User entities, providing methods for CRUD operations and custom queries.
UserService.java: Implements business logic operations for User entities, such as creation, retrieval, and deletion, utilizing UserRepository.
UserController.java: Defines RESTful endpoints for handling HTTP requests related to users, facilitating create and retrieve operations and error handling with appropriate responses.



Transaction.java:
Purpose: This class represents a financial transaction in the WealthGuardian application.
Annotations (@Entity, @Table, @Id, @GeneratedValue, @ManyToOne, @JoinColumn, @Temporal): These annotations are used by the JPA (Java Persistence API) to map this class to a database table (transactions). They define the primary key (transactionId), relationships (many-to-one with Account), and temporal data (date).
Attributes (transactionId, account, type, amount, date): These attributes represent the data associated with a transaction (e.g., ID, linked account, type of transaction, amount, date).
Getters and Setters: These methods are standard Java bean-style getters and setters used to access and mutate the private attributes of the class.

TransactionRepository.java:
Purpose: This class serves as a repository for managing Transaction objects in memory (or potentially persistently with a database, though currently it’s in-memory with a Map).
Attributes (transactions): A Map (HashMap) that stores transactions with transactionId as the key.
Methods:
findById(Long transactionId): Finds a transaction by its ID.
findByAccountId(Long accountId): Finds transactions associated with a specific account ID.
save(Transaction transaction): Saves a transaction into the repository (transactions map).
delete(Long transactionId): Deletes a transaction from the repository.
getAllTransactions(): Retrieves all transactions stored in the repository.

TransactionService.java:
Purpose: This class provides business logic and acts as an intermediary between the TransactionController and TransactionRepository.
Attributes (transactionRepository): Holds an instance of TransactionRepository to interact with the data layer.
Methods:
addTransaction(Transaction transaction): Delegates to TransactionRepository to save a new transaction.
getAllTransactions(): Retrieves all transactions from TransactionRepository.
getTransactionById(Long transactionId): Retrieves a transaction by its ID from TransactionRepository.
deleteTransaction(Long transactionId): Delegates to TransactionRepository to delete a transaction.

TransactionController.java:
Purpose: This class acts as a REST controller for handling HTTP requests related to transactions.
Annotations (@RestController, @RequestMapping, @PostMapping, @GetMapping, @PathVariable, @RequestBody): These annotations are used by Spring MVC to map HTTP requests to Java methods and manage the RESTful API.
Attributes (transactionService): Holds an instance of TransactionService to handle business logic related to transactions.
Methods:
createTransaction(Transaction transaction): Handles HTTP POST requests to create a new transaction.
getAllTransactions(): Handles HTTP GET requests to retrieve all transactions.
getTransactionById(Long id): Handles HTTP GET requests to retrieve a transaction by its ID.
ResponseEntity: Wraps responses to include HTTP status codes (e.g., HttpStatus.CREATED, HttpStatus.OK, HttpStatus.NOT_FOUND).


Summary(Transaction)
Transaction.java: Defines the structure of a financial transaction entity.
TransactionRepository.java: Manages the storage and retrieval of Transaction objects.
TransactionService.java: Provides business logic operations on Transaction objects.
TransactionController.java: Handles HTTP requests and serves as the interface between the client and the TransactionService.



Account.java
Purpose: Represents a financial account in the WealthGuardian application, such as checking, savings, or investment accounts.

Annotations:

@Entity: Indicates that this class is an entity mapped to a database table.
@Table(name = “accounts”): Specifies the name of the database table corresponding to this entity.
@Id: Denotes the primary key field of the entity.
@GeneratedValue(strategy = GenerationType.IDENTITY): Specifies that the primary key value is generated by the database (auto-increment).
AccountRepository.java
Purpose: Provides data access methods for managing Account entities.

Annotations:

None in this simplified version, but typically, Spring Data repositories might use annotations like @Repository.
AccountService.java
Purpose: Implements business logic operations related to Account entities.

Annotations:

@Service: Indicates that this class is a service component in the Spring framework.
AccountController.java
Purpose: Handles HTTP requests related to Account entities, acting as the entry point for account-related operations.

Annotations:

@RestController: Indicates that this class is a REST controller that handles HTTP requests and returns JSON or XML responses.
@RequestMapping(“/api/accounts”): Specifies the base URL path for which this controller will handle requests related to accounts.
Summary of Responsibilities:
Account.java: Defines the structure of an account entity, including its properties and relationships with other entities.
AccountRepository.java: Manages the persistence of Account entities, providing methods for CRUD operations (Create, Read, Update, Delete).
AccountService.java: Contains business logic operations related to Account entities, such as creating, retrieving, updating, and deleting accounts.
AccountController.java: Defines endpoints to handle HTTP requests for account operations (e.g., create, retrieve by ID, retrieve all). Acts as an interface between the client (e.g., web browser or mobile app) and the application’s business logic (via AccountService).




Budget.java:

Purpose: Represents a budget entity in the WealthGuardian application, defining its structure and relationships.

Annotations:

@Entity: Specifies that this class is an entity that maps to a database table.
@Table(name = “budgets”): Maps this entity to the “budgets” table in the database.
Summary of Responsibilities:

Defines the structure of a budget entity with properties like budgetId, user, monthlyLimit, and currentSpending.
Establishes a Many-to-One relationship with the User entity through the user field.
Provides getters and setters for accessing and modifying entity properties.

BudgetRepository.java:

Purpose: Manages the persistence and retrieval of Budget entities using an in-memory data structure.

Annotations:

@Repository: Indicates that this class is a repository component managed by Spring for data access.
Summary of Responsibilities:

Provides methods to interact with Budget entities:findById(Long budgetId): Retrieves a budget by its ID.
save(Budget budget): Saves a budget entity.
delete(Long budgetId): Deletes a budget by its ID.
findAll(): Retrieves all budgets stored in the repository.
Uses a HashMap (budgets) to store Budget entities temporarily in memory.

BudgetService.java:

Purpose: Implements business logic operations related to Budget entities, facilitating interaction between the repository and controllers.

Annotations:

@Service: Marks this class as a service component in the Spring framework, managing business logic.
Summary of Responsibilities:

Provides methods to manage Budget entities:createBudget(Budget budget): Saves a new budget.
getBudgetById(Long budgetId): Retrieves a budget by its ID.
getAllBudgets(): Retrieves all budgets.
deleteBudget(Long budgetId): Deletes a budget by its ID.
Uses BudgetRepository for data access operations.

BudgetController.java:

Purpose: Defines HTTP endpoints for CRUD operations on Budget entities, acting as an interface between clients and the application’s business logic.

Annotations:

@RestController: Indicates that this class is a REST controller, facilitating RESTful endpoints.
Summary of Responsibilities:

Defines HTTP endpoints (POST, GET, DELETE) for managing Budget entities:createBudget: Handles HTTP POST requests to create a new budget.
getBudgetById: Handles HTTP GET requests to retrieve a budget by its ID.
getAllBudgets: Handles HTTP GET requests to retrieve all budgets.
deleteBudget: Handles HTTP DELETE requests to delete a budget by its ID.
Uses BudgetService to delegate business logic operations.

Summary of Responsibilities (Overall):

Budget.java: Defines the structure and relationships of a budget entity.
BudgetRepository.java: Manages the persistence of Budget entities using an in-memory HashMap, providing CRUD operations.
BudgetService.java: Implements business logic operations for Budget entities, including creation, retrieval, and deletion.
BudgetController.java: Defines RESTful endpoints for handling HTTP requests related to budgets, facilitating create, retrieve, and delete operations.


Exceptions:

1. Custom Exception Classes:
- ResourceNotFoundException.java:
- Purpose: To signal when a requested resource (e.g., user, transaction) is not found in the system.
- Usage: Throw this exception when a specific resource identified by a unique identifier (e.g., userId) does not exist.

- BadRequestException.java:
- Purpose: To signal when the client sends a bad or malformed request to the server.
- Usage: Throw this exception when the input data from the client is invalid or does not adhere to expected formats or constraints.

2. Global Exception Handler:
- GlobalExceptionHandler.java:
- Purpose: To handle exceptions globally across the application, ensuring a consistent error response structure.
- Annotations: @ControllerAdvice to manage application-wide exception handling.
- Methods:
- handleResourceNotFoundException: Returns a NOT_FOUND (404) status with an error message for ResourceNotFoundException.
- handleBadRequestException: Returns a BAD_REQUEST (400) status with an error message for BadRequestException.
- handleGlobalException: Catches any other exceptions, returning an INTERNAL_SERVER_ERROR (500) status with the error message.

Utility Classes:

1. Date Utility:
- DateUtil.java:
- Purpose: To provide common methods for date handling and formatting.
- Methods:
- stringToDate(String dateString): Converts a date string into a Date object.
- dateToString(Date date): Converts a Date object into a string formatted as yyyy-MM-dd.

2. Input Validation Utility:
- InputValidator.java:
- Purpose: To provide common validation methods for input data.
- Methods:
- isStringValid(String input): Checks if a given string is neither null nor empty after trimming whitespace.

3. Response Utility:
- ResponseUtil.java:
- Purpose: To standardize API response creation.
- Methods:
- createSuccessResponse(Object body): Returns a ResponseEntity with an OK (200) status and the given response body.
- createCreatedResponse(Object body): Returns a ResponseEntity with a CREATED (201) status and the given response body.
- createErrorResponse(String message, HttpStatus status): Returns a ResponseEntity with the specified status and an error message.

Summary:

- Exceptions:
- Created two custom exceptions (ResourceNotFoundException, BadRequestException) for handling specific error conditions.
- Implemented a global exception handler (GlobalExceptionHandler) to manage and format exception responses consistently.

- Utilities:
- Developed utility classes to handle common tasks:
- DateUtil: For date parsing and formatting.
- InputValidator: For input validation checks.
- ResponseUtil: For standardized API response generation.