# khipusys/petmor-sistema-veterinaria-spa architecture

> Architecture diagram of the GitHub repository khipusys/petmor-sistema-veterinaria-spa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/khipusys/petmor-sistema-veterinaria-spa
- Repository: https://github.com/khipusys/petmor-sistema-veterinaria-spa

## Overview

Petmor is an ASP.NET Core veterinary and spa management application. Its broad workflow covers client and pet records, appointment and clinical care, inventory and product-code tracking, sales and billing, purchasing, cash management, and reporting. The sampled code shows sales operations coordinating inventory, reservations, and care charges, while Factiliza provides document lookup and electronic receipt support. Several major capabilities are represented by controller paths in the tree but were not sampled, so their internal connections are left unasserted.

Main entry points: [`Data/ApplicationDbContext.cs`](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Data/ApplicationDbContext.cs) (Application data), [`Services/OperacionVentaService.cs`](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/OperacionVentaService.cs) (Sale operations), [`Controllers/PetmorController.cs`](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/PetmorController.cs) (Pet care), [`Controllers/VentasController.cs`](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/VentasController.cs) (Sales)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflows"]
  node_clients["Client records"]
  node_home["Dashboard<br/>[HomeController.cs]"]
  node_reports["Reports"]
end

subgraph group_care["Veterinary care"]
  node_carework["Pet care"]
  node_attentions["Care service<br/>[AtencionService.cs]"]
  node_veterinary["Pet records<br/>[Veterinaria.cs]"]
end

subgraph group_commerce["Commerce operations"]
  node_sales["Sales"]
  node_saleops["Sale operations"]
  node_emission["Receipt emission"]
  node_products["Product catalog"]
  node_codes["Product-code lookup<br/>[CodigosLecturas.cs]"]
  node_reservations["Reservations<br/>[ReservaService.cs]"]
  node_purchases["Purchases"]
  node_cash["Cash management<br/>[CajaController.cs]"]
  node_inventory["Inventory movements"]
  node_sales_model["Sale records<br/>[Venta.cs]"]
end

subgraph group_platform["Shared platform"]
  node_database[("Application data")]
  node_branches["Active branch<br/>[SedeActual.cs]"]
  node_branchscope["Branch middleware<br/>[SedeMiddleware.cs]"]
  node_identity["Identity login<br/>[Login.cshtml.cs]"]
  node_factiliza_service["Document and billing integration"]
end

node_user(("Staff user"))
node_factiliza{{"Factiliza API"}}

node_user -.->|"uses"| node_home
node_user -.->|"manages"| node_clients
node_user -.->|"records care"| node_carework
node_user -.->|"records sales"| node_sales
node_user -.->|"manages stock"| node_purchases
node_user -.->|"manages cash"| node_cash
node_user -.->|"views reports"| node_reports
node_clients -->|"reads and writes"| node_database
node_home -->|"reads"| node_database
node_carework -->|"reads and writes"| node_database
node_carework -->|"delegates care"| node_attentions
node_carework -->|"delegates checkout"| node_saleops
node_attentions -->|"reads and writes"| node_database
node_sales -->|"reads and writes"| node_database
node_sales -->|"delegates sale"| node_saleops
node_sales -->|"requests receipt"| node_emission
node_saleops -->|"commits operations"| node_database
node_saleops -->|"counts scans"| node_codes
node_saleops -->|"records movement"| node_inventory
node_saleops -->|"creates sale"| node_sales_model
node_saleops -.->|"uses reservations"| node_reservations
node_products -->|"reads and writes"| node_database
node_products -->|"associates codes"| node_codes
node_codes -->|"resolves codes"| node_database
node_attentions -->|"manages care records"| node_veterinary
node_emission -->|"stores emission state"| node_database
node_emission -->|"requests billing"| node_factiliza_service
node_factiliza_service -->|"calls API"| node_factiliza
node_branchscope -->|"sets active branch"| node_branches
node_branchscope -->|"reads branch data"| node_database
node_database -->|"uses branch context"| node_branches
node_identity -.->|"authenticates"| node_database

click node_clients "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/ClientesController.cs"
click node_home "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/HomeController.cs"
click node_reports "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/ReportesController.cs"
click node_carework "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/PetmorController.cs"
click node_attentions "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/AtencionService.cs"
click node_veterinary "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Models/Veterinaria.cs"
click node_sales "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/VentasController.cs"
click node_saleops "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/OperacionVentaService.cs"
click node_emission "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/EmisionVentaService.cs"
click node_products "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/ProductosController.cs"
click node_codes "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/CodigosLecturas.cs"
click node_reservations "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/ReservaService.cs"
click node_purchases "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/ComprasController.cs"
click node_cash "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/CajaController.cs"
click node_inventory "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Models/MovimientoInventario.cs"
click node_database "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Data/ApplicationDbContext.cs"
click node_branches "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/SedeActual.cs"
click node_branchscope "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Infrastructure/SedeMiddleware.cs"
click node_identity "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Areas/Identity/Pages/Account/Login.cshtml.cs"
click node_factiliza_service "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/FactilizaService.cs"
click node_sales_model "https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Models/Venta.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_clients,node_home,node_reports,node_user toneBlue
class node_carework,node_attentions,node_veterinary toneAmber
class node_sales,node_saleops,node_emission,node_products,node_codes,node_reservations,node_purchases,node_cash,node_inventory,node_sales_model,node_factiliza toneMint
class node_database,node_branches,node_branchscope,node_identity,node_factiliza_service toneRose
```

## Components

### Web workflows

- [Client records](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/ClientesController.cs): `Controllers/ClientesController.cs`
- [Dashboard](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/HomeController.cs): `Controllers/HomeController.cs`
- [Reports](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/ReportesController.cs): `Controllers/ReportesController.cs`

### Veterinary care

- [Pet care](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/PetmorController.cs): `Controllers/PetmorController.cs`
- [Care service](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/AtencionService.cs): `Services/AtencionService.cs`
- [Pet records](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Models/Veterinaria.cs): `Models/Veterinaria.cs`

### Commerce operations

- [Sales](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/VentasController.cs): `Controllers/VentasController.cs`
- [Sale operations](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/OperacionVentaService.cs): `Services/OperacionVentaService.cs`
- [Receipt emission](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/EmisionVentaService.cs): `Services/EmisionVentaService.cs`
- [Product catalog](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/ProductosController.cs): `Controllers/ProductosController.cs`
- [Product-code lookup](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/CodigosLecturas.cs): `Services/CodigosLecturas.cs`
- [Reservations](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/ReservaService.cs): `Services/ReservaService.cs`
- [Purchases](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/ComprasController.cs): `Controllers/ComprasController.cs`
- [Cash management](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Controllers/CajaController.cs): `Controllers/CajaController.cs`
- [Inventory movements](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Models/MovimientoInventario.cs): `Models/MovimientoInventario.cs`
- [Sale records](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Models/Venta.cs): `Models/Venta.cs`

### Shared platform

- [Application data](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Data/ApplicationDbContext.cs): `Data/ApplicationDbContext.cs`
- [Active branch](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/SedeActual.cs): `Services/SedeActual.cs`
- [Branch middleware](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Infrastructure/SedeMiddleware.cs): `Infrastructure/SedeMiddleware.cs`
- [Identity login](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Areas/Identity/Pages/Account/Login.cshtml.cs): `Areas/Identity/Pages/Account/Login.cshtml.cs`
- [Document and billing integration](https://github.com/khipusys/petmor-sistema-veterinaria-spa/blob/main/Services/FactilizaService.cs): `Services/FactilizaService.cs`

### Other components

- **Staff user**
- **Factiliza API**

## Connections

- Staff user → Dashboard: uses (evidence: `README.md`)
- Staff user → Client records: manages (evidence: `README.md`)
- Staff user → Pet care: records care (evidence: `README.md`)
- Staff user → Sales: records sales (evidence: `README.md`)
- Staff user → Purchases: manages stock (evidence: `README.md`)
- Staff user → Cash management: manages cash (evidence: `README.md`)
- Staff user → Reports: views reports (evidence: `README.md`)
- Client records → Application data: reads and writes (evidence: `Controllers/ClientesController.cs`)
- Dashboard → Application data: reads (evidence: `Controllers/HomeController.cs`)
- Pet care → Application data: reads and writes (evidence: `Controllers/PetmorController.cs`)
- Pet care → Care service: delegates care (evidence: `Controllers/PetmorController.cs`)
- Pet care → Sale operations: delegates checkout (evidence: `Controllers/PetmorController.cs`)
- Care service → Application data: reads and writes (evidence: `Services/AtencionService.cs`)
- Sales → Application data: reads and writes (evidence: `Controllers/VentasController.cs`)
- Sales → Sale operations: delegates sale (evidence: `Controllers/VentasController.cs`)
- Sales → Receipt emission: requests receipt (evidence: `Controllers/VentasController.cs`)
- Sale operations → Application data: commits operations (evidence: `Services/OperacionVentaService.cs`)
- Sale operations → Product-code lookup: counts scans (evidence: `Services/OperacionVentaService.cs`)
- Sale operations → Inventory movements: records movement (evidence: `Services/OperacionVentaService.cs`)
- Sale operations → Sale records: creates sale (evidence: `Services/OperacionVentaService.cs`)
- Sale operations → Reservations: uses reservations
- Product catalog → Application data: reads and writes (evidence: `Controllers/ProductosController.cs`)
- Product catalog → Product-code lookup: associates codes (evidence: `Controllers/ProductosController.cs`)
- Product-code lookup → Application data: resolves codes (evidence: `Services/CodigosLecturas.cs`)
- Care service → Pet records: manages care records (evidence: `Services/AtencionService.cs`)
- Receipt emission → Application data: stores emission state (evidence: `Services/EmisionVentaService.cs`)
- Receipt emission → Document and billing integration: requests billing (evidence: `Services/EmisionVentaService.cs`)
- Document and billing integration → Factiliza API: calls API (evidence: `Services/FactilizaService.cs`)
- Branch middleware → Active branch: sets active branch (evidence: `Infrastructure/SedeMiddleware.cs`)
- Branch middleware → Application data: reads branch data (evidence: `Infrastructure/SedeMiddleware.cs`)
- Application data → Active branch: uses branch context (evidence: `Data/ApplicationDbContext.cs`)
- Identity login → Application data: authenticates
