# paulfriki55/pruebatecnicanetby architecture

> Architecture diagram of the GitHub repository paulfriki55/pruebatecnicanetby, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paulfriki55/pruebatecnicanetby
- Repository: https://github.com/paulfriki55/pruebatecnicanetby

## Overview

##### Main Components
- Backend Microservices:
– ProductService: Manages product data (create, read, update, delete).
– TransactionService: Handles transaction records (purchases and sales) and updates to the inventory.
- Database:
– A SQL Server instance initialized via the provided crearBDD.sql script (creates the InventoryDB and tables).
- Frontend:
– An Angular application (located in frontend/gestion-productos) that uses standalone components to manage product and transaction views.
- External Tools:
– API endpoints for each microservice shown in the README (swagger endpoints for easy testing/documentation).

##### Process Flow
- Start at the User Interface:
– The Angular frontend displays pages for listing products, product details, forms for adding/editing products, as well as similar components for transactions.
- When a user interacts with the UI, the frontend sends RESTful API calls to the appropriate backend service:
– If a product is being viewed or modified, the frontend calls the ProductService API.
– If a transaction is initiated, the frontend interacts with the TransactionService API.
- The Microservices communicate with the SQL Server database:
– Both ProductService and TransactionService use their respective ApplicationDbContext implementations to interact with the same underlying SQL Server database.
- Data Flow Summary:
– User action in the frontend → HTTP request to appropriate microservice → Microservice logic and database query/update → HTTP response returned → UI updates accordingly.

##### Architectural Patterns
- Microservices Architecture:
– Note that the backend is split into multiple services (ProductService and TransactionService) that communicate through REST APIs.
– Highlight that each service has its own set of endpoints.
- Separation of Concerns:
– The frontend is entirely decoupled from the backend logic, communicating only through standardized REST calls.
- Process Flow:

## Diagram (Mermaid)

```mermaid
flowchart TD
    U("User"):::user
    AF("Angular Frontend\n(Product & Transaction Management)"):::frontend
    PS("ProductService\n(ASP.NET Core Microservice)"):::microservice
    TS("TransactionService\n(ASP.NET Core Microservice)"):::microservice
    DB("SQL Server Database"):::database

    %% Process Flow
    U -->|"InitiatesAction"| AF
    AF -->|"GET/api/Product"| PS
    PS -->|"QueryUpdate"| DB
    DB -->|"DataResponse"| PS
    PS -->|"SendResponse"| AF
    AF -->|"POST/api/Transaction"| TS
    TS -->|"QueryUpdate"| DB
    DB -->|"DataResponse"| TS
    TS -->|"SendResponse"| AF

    %% Click Events
    click PS "https://github.com/paulfriki55/pruebatecnicanetby/tree/main/ProductService/"
    click TS "https://github.com/paulfriki55/pruebatecnicanetby/tree/main/TransactionService/"
    click DB "https://github.com/paulfriki55/pruebatecnicanetby/blob/main/BDD/crearBDD.sql"
    click AF "https://github.com/paulfriki55/pruebatecnicanetby/tree/main/frontend/gestion-productos/"

    %% Styling
    classDef user fill:#FFA500,stroke:#333,stroke-width:2px;
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef microservice fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef database fill:#C0C0C0,stroke:#333,stroke-width:2px;
```
