# ccastro2050/proyecto_aplicacion_y_servicios_web architecture

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

- Interactive diagram: https://gitdiagram.com/ccastro2050/proyecto_aplicacion_y_servicios_web
- Repository: https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web

## Overview

This repository’s runnable product is a versioned ASP.NET Core product-inventory API backed by SQL Server. The main workflow is an HTTP client’s product request, request-body validation, controller delegation to business logic, and database access, followed by an HTTP response. The graph also preserves the documented interactive Swagger and diagnostic endpoint. Source excerpts show the controller, service, repository, and registration wiring; relationships to the database script are supported by the repository’s SQL implementation, but the database initialization details were not sampled.

Main entry points: [`api_facturas/Controllers/ProductoController.cs`](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Controllers/ProductoController.cs) (Product Controller), [`api_facturas/Program.cs`](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Program.cs) (Application Setup), [`api_facturas/Servicios/ServicioProducto.cs`](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Servicios/ServicioProducto.cs) (Product Service), [`api_facturas/Repositorios/RepositorioProductoSqlServer.cs`](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Repositorios/RepositorioProductoSqlServer.cs) (SQL Repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_controller["Product Controller"]
  node_create_request["Create Request<br/>[ProductoCrear.cs]"]
  node_replace_request["PUT Request"]
  node_update_request["PATCH Request"]
end

subgraph group_business["Product Logic"]
  node_service["Product Service"]
  node_not_found["Not Found Error"]
  node_product["Product Entity<br/>[Producto.cs]"]
end

subgraph group_persistence["Persistence"]
  node_repository_contract["Repository Contract"]
  node_sql_repository["SQL Repository"]
  node_database[("Product Database<br/>[bdfacturas.sql]")]
end

subgraph group_runtime["API Runtime"]
  node_program["Application Setup<br/>[Program.cs]"]
  node_swagger["Swagger UI<br/>[Program.cs]"]
  node_diagnostic["Diagnostic Route<br/>[Program.cs]"]
end

node_client(("HTTP Client"))

node_client -->|"sends requests"| node_controller
node_program -->|"maps routes"| node_controller
node_controller -->|"delegates operations"| node_service
node_controller -->|"validates POST"| node_create_request
node_controller -->|"validates PUT"| node_replace_request
node_controller -->|"validates PATCH"| node_update_request
node_program -->|"configures 422"| node_create_request
node_controller -->|"constructs entity"| node_product
node_service -->|"uses contract"| node_repository_contract
node_program -->|"registers implementation"| node_sql_repository
node_program -->|"registers service"| node_service
node_sql_repository -->|"implements contract"| node_repository_contract
node_sql_repository -->|"queries product table"| node_database
node_service -->|"throws when missing"| node_not_found
node_controller -->|"maps missing to 404"| node_not_found
node_program -->|"enables UI"| node_swagger
node_client -->|"uses interactively"| node_swagger
node_program -->|"registers route"| node_diagnostic
node_client -->|"checks status"| node_diagnostic

click node_controller "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Controllers/ProductoController.cs"
click node_create_request "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Peticiones/ProductoCrear.cs"
click node_replace_request "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Peticiones/ProductoReemplazo.cs"
click node_update_request "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Peticiones/ProductoActualizar.cs"
click node_service "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Servicios/ServicioProducto.cs"
click node_not_found "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Excepciones/NoEncontradoExcepcion.cs"
click node_product "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Modelos/Producto.cs"
click node_repository_contract "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Repositorios/IRepositorioProducto.cs"
click node_sql_repository "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Repositorios/RepositorioProductoSqlServer.cs"
click node_database "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/db/bdfacturas.sql"
click node_program "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Program.cs"
click node_swagger "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Program.cs"
click node_diagnostic "https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Program.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controller,node_create_request,node_replace_request,node_update_request,node_client toneBlue
class node_service,node_not_found,node_product toneAmber
class node_repository_contract,node_sql_repository,node_database toneMint
class node_program,node_swagger,node_diagnostic toneRose
```

## Components

### HTTP API

- [Product Controller](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Controllers/ProductoController.cs): `api_facturas/Controllers/ProductoController.cs`
- [Create Request](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Peticiones/ProductoCrear.cs): `api_facturas/Peticiones/ProductoCrear.cs`
- [PUT Request](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Peticiones/ProductoReemplazo.cs): `api_facturas/Peticiones/ProductoReemplazo.cs`
- [PATCH Request](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Peticiones/ProductoActualizar.cs): `api_facturas/Peticiones/ProductoActualizar.cs`

### Product Logic

- [Product Service](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Servicios/ServicioProducto.cs): `api_facturas/Servicios/ServicioProducto.cs`
- [Not Found Error](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Excepciones/NoEncontradoExcepcion.cs): `api_facturas/Excepciones/NoEncontradoExcepcion.cs`
- [Product Entity](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Modelos/Producto.cs): `api_facturas/Modelos/Producto.cs`

### Persistence

- [Repository Contract](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Repositorios/IRepositorioProducto.cs): `api_facturas/Repositorios/IRepositorioProducto.cs`
- [SQL Repository](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Repositorios/RepositorioProductoSqlServer.cs): `api_facturas/Repositorios/RepositorioProductoSqlServer.cs`
- [Product Database](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/db/bdfacturas.sql): `db/bdfacturas.sql`

### API Runtime

- [Application Setup](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Program.cs): `api_facturas/Program.cs`
- [Swagger UI](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Program.cs): `api_facturas/Program.cs`
- [Diagnostic Route](https://github.com/ccastro2050/proyecto_aplicacion_y_servicios_web/blob/main/api_facturas/Program.cs): `api_facturas/Program.cs`

### Other components

- **HTTP Client**

## Connections

- HTTP Client → Product Controller: sends requests (evidence: `README.md`)
- Application Setup → Product Controller: maps routes (evidence: `api_facturas/Program.cs`)
- Product Controller → Product Service: delegates operations (evidence: `api_facturas/Controllers/ProductoController.cs`)
- Product Controller → Create Request: validates POST (evidence: `api_facturas/Controllers/ProductoController.cs`)
- Product Controller → PUT Request: validates PUT (evidence: `api_facturas/Controllers/ProductoController.cs`)
- Product Controller → PATCH Request: validates PATCH (evidence: `api_facturas/Controllers/ProductoController.cs`)
- Application Setup → Create Request: configures 422 (evidence: `api_facturas/Program.cs`)
- Product Controller → Product Entity: constructs entity (evidence: `api_facturas/Controllers/ProductoController.cs`)
- Product Service → Repository Contract: uses contract (evidence: `api_facturas/Servicios/ServicioProducto.cs`)
- Application Setup → SQL Repository: registers implementation (evidence: `api_facturas/Program.cs`)
- Application Setup → Product Service: registers service (evidence: `api_facturas/Program.cs`)
- SQL Repository → Repository Contract: implements contract (evidence: `api_facturas/Repositorios/RepositorioProductoSqlServer.cs`)
- SQL Repository → Product Database: queries product table (evidence: `api_facturas/Repositorios/RepositorioProductoSqlServer.cs`)
- Product Service → Not Found Error: throws when missing (evidence: `api_facturas/Servicios/ServicioProducto.cs`)
- Product Controller → Not Found Error: maps missing to 404 (evidence: `api_facturas/Controllers/ProductoController.cs`)
- Application Setup → Swagger UI: enables UI (evidence: `api_facturas/Program.cs`)
- HTTP Client → Swagger UI: uses interactively (evidence: `README.md`)
- Application Setup → Diagnostic Route: registers route (evidence: `api_facturas/Program.cs`)
- HTTP Client → Diagnostic Route: checks status (evidence: `README.md`)
