How ismael-asensio/pjcuentabancaria works
Project Type and Purpose
• This project is a RESTful API built in .NET 8 designed for managing bank accounts including creating customers, managing monetary transactions (deposits and withdrawals), and retrieving account balances and transaction histories.
• The README emphasizes API endpoints for clients, bank accounts, and transactions, and it also indicates the use of an In-Memory database for simplicity during development/testing.
File Structure
• The top-level solution is represented by "pjCuentaBancaria.sln" and includes the main project directory (pjCuentaBancaria) and a test project (TestBanco).
• Within the main project directory, you have a clear layered structure:
• Controllers – Implements the API endpoints (BankAccountController, CustomerController, TransactionController).
• Models – Defines the entities (BankAccount, Customer, Transaction) used throughout the API.
• Data – Contains the ApplicationDbContext and configuration for the In-Memory database.
• Repositories – Contains repository interfaces and implementations (such as IBankAccountRepository and its implementation). This layer abstracts data access.
• Services – Contains business logic and service interfaces with concrete implementations (BankAccountService, CustomerService, TransactionService). Services act as intermediaries between controllers and repositories.
• The test project (TestBanco) contains unit tests that verify the functionality of services, repositories, and controllers.
• Configuration files (appsettings.json and appsettings.Development.json) guide deployment-specific settings.
Key Architectural Elements
a. Main Components:
• API Controllers: Gateway for client requests.
• Services: Business logic processing.
• Repositories: Data persistence abstraction.
• Data Layer: EF Core ApplicationDbContext, using an In-Memory database.
• Models: Domain entities representing customers, bank accounts, and transactions.
• Test Suite: Ensures proper functionality of individual layers.
b. Relationships and Interactions:
• Clients interact with API endpoints exposed by Controllers.
• Controllers delegate requests to Services.
• Services use Repositories to perform CRUD operations on Models.
• Repository layer interacts with the EF Core data context that accesses the In-Memory database.
• The test project simulates interactions and validates functionality over these layers.
c. Architectural Patterns and Design Principles:
• Layered Architecture: Clear separation between Controllers (presentation), Services (business logic), and Repositories/Data Access.
• Repository Pattern: Abstracts and encapsulates database access logic.
• Dependency Injection: Likely used for injecting services and repositories (as is common in .NET projects).
• Clean Code and Separation of Concerns: Data models, business logic, and API controllers are each in distinct folders.
d. Relevant Technologies and Frameworks:
• .NET 8 for API and application framework.
• Entity Framework Core with an In-Memory provider for data persistence.
• Testing frameworks integrated with .NET (via dotnet test).
• Tools such as Visual Studio or VSCode for development and debugging.
• Postman/Swagger for API testing.