# arcanik78/web_services-asistens architecture

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

- Interactive diagram: https://gitdiagram.com/arcanik78/web_services-asistens
- Repository: https://github.com/arcanik78/web_services-asistens

## Overview

##### Project type and purpose
- This is an ASP​.NET Web API project named “Web_Services-Asistens,” which provides RESTful endpoints for attendance management (Asistencia), employee data (Empleado), work schedules (HorarioTrabajo), and QR code operations (qr).
- The solution uses the typical layered structure: App_Start for Web API configuration, Controllers for request handling, Models for DTOs/entities, a typed dataset (dbAsistencia.*) for data access, and a small Services folder (GeneradorQR) for QR code generation logic.

##### File structure
- App_Start
- SwaggerConfig.cs — integrates Swagger UI for API documentation
- WebApiConfig.cs — sets up routing and message handlers
- Controllers
- AsistenciaController.cs, EmpleadoController.cs, HorarioTrabajoController.cs, qrController.cs — each exposes CRUD endpoints
- Models
- Asistencia.cs, Empleado.cs, HorarioTrabajo.cs, qr.cs — define the data contracts/entities
- dbAsistencia.*
- Typed DataSet (XSD/XSC/XSS) and its designer file for strongly typed ADO.NET access
- services/GeneradorQR.cs — encapsulates QR code generation
- Configuration files (Web.config, Debug/Release transforms, packages.config)
- Global.asax(.cs) — application startup and routing glue

##### Essential architectural patterns
- Layered architecture:
- Presentation/API layer (Controllers + Swagger UI)
- Business logic layer (Services folder + any custom logic inside controllers)
- Data access layer (Typed DataSet (dbAsistencia) connecting to the underlying database)
- Dependency on .NET Framework’s Web API pipeline for routing and serialization
- External integration point: Swagger for interactive API docs

##### Main components and their interactions
a. Clients (e.g., Web or Mobile App)
→ send HTTP requests (JSON) to
b. ASP​.NET Web API Controllers
→ invoke business logic in Services (e.g., GeneradorQR) or directly call Data Access
c. Data Access Layer (dbAsistencia typed DataSet)
→ executes SQL queries/stored procedures against the underlying SQL Server database
d. Database (SQL Server or equivalent)
← stores Asistencia, Empleado, HorarioTrabajo tables
e. Swagger UI (optional component)
← provides interactive API documentation and testing interface

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Layers
    subgraph "Client"
        direction TB
        Clients["Clients\n(Web & Mobile)"]:::client
    end

    subgraph "API Layer"
        direction TB
        cfg["WebApiConfig.cs"]:::config
        swagger["SwaggerConfig.cs\n(Swagger UI)"]:::swagger
        AController["AsistenciaController.cs"]:::api
        EController["EmpleadoController.cs"]:::api
        HController["HorarioTrabajoController.cs"]:::api
        QController["qrController.cs"]:::api
        subgraph "Models"
            direction TB
            AsistenciaModel["Asistencia.cs"]:::api
            EmpleadoModel["Empleado.cs"]:::api
            HorarioTrabajoModel["HorarioTrabajo.cs"]:::api
            qrModel["qr.cs"]:::api
        end
    end

    subgraph "Services Layer"
        direction TB
        QRService["GeneradorQR.cs"]:::service
    end

    subgraph "Data Access Layer"
        direction TB
        xsd["dbAsistencia.xsd"]:::data
        xsc["dbAsistencia.xsc"]:::data
        xss["dbAsistencia.xss"]:::data
        ds["dbAsistencia.cs & Designer.cs"]:::data
    end

    subgraph "Configuration & Startup"
        direction TB
        global["Global.asax\nGlobal.asax.cs"]:::config
        configFiles["Web.config\nWeb.Debug.config\nWeb.Release.config"]:::config
    end

    Database[(SQL Server Database)]:::db

    %% Connections
    Clients -->|"HTTP/HTTPS REST"| AController
    Clients -->|"HTTP/HTTPS REST"| EController
    Clients -->|"HTTP/HTTPS REST"| HController
    Clients -->|"HTTP/HTTPS REST"| QController
    Clients -->|"Swagger UI"| swagger

    AController -->|"Invoke DataSet"| ds
    EController -->|"Invoke DataSet"| ds
    HController -->|"Invoke DataSet"| ds
    QController -->|"Invoke DataSet"| ds

    QController -->|"GenerateQRCode()"| QRService

    cfg --> AController
    cfg --> EController
    cfg --> HController
    cfg --> QController

    ds -->|"ExecuteStoredProcedure"| Database
    Database -->|"Return Results"| ds

    global --> cfg
    global --> swagger

    %% Click Events
    click cfg "https://github.com/arcanik78/web_services-asistens/blob/master/App_Start/WebApiConfig.cs"
    click swagger "https://github.com/arcanik78/web_services-asistens/blob/master/App_Start/SwaggerConfig.cs"
    click AController "https://github.com/arcanik78/web_services-asistens/blob/master/Controllers/AsistenciaController.cs"
    click EController "https://github.com/arcanik78/web_services-asistens/blob/master/Controllers/EmpleadoController.cs"
    click HController "https://github.com/arcanik78/web_services-asistens/blob/master/Controllers/HorarioTrabajoController.cs"
    click QController "https://github.com/arcanik78/web_services-asistens/blob/master/Controllers/qrController.cs"
    click AsistenciaModel "https://github.com/arcanik78/web_services-asistens/blob/master/Models/Asistencia.cs"
    click EmpleadoModel "https://github.com/arcanik78/web_services-asistens/blob/master/Models/Empleado.cs"
    click HorarioTrabajoModel "https://github.com/arcanik78/web_services-asistens/blob/master/Models/HorarioTrabajo.cs"
    click qrModel "https://github.com/arcanik78/web_services-asistens/blob/master/Models/qr.cs"
    click QRService "https://github.com/arcanik78/web_services-asistens/blob/master/services/GeneradorQR.cs"
    click xsd "https://github.com/arcanik78/web_services-asistens/blob/master/dbAsistencia.xsd"
    click xsc "https://github.com/arcanik78/web_services-asistens/blob/master/dbAsistencia.xsc"
    click xss "https://github.com/arcanik78/web_services-asistens/blob/master/dbAsistencia.xss"
    click ds "https://github.com/arcanik78/web_services-asistens/blob/master/dbAsistencia.cs"
    click global "https://github.com/arcanik78/web_services-asistens/blob/master/Global.asax"
    click configFiles "https://github.com/arcanik78/web_services-asistens/blob/master/Web.config"

    %% Styles
    classDef client fill:#cfe2f3,stroke:#3b88c3
    classDef api fill:#d9eaf7,stroke:#97cbe8
    classDef swagger fill:#f8f0f0,stroke:#e67e7e,stroke-dasharray:5 5
    classDef service fill:#d1e7dd,stroke:#82c884
    classDef data fill:#fde2c5,stroke:#f5c160
    classDef db fill:#ebedef,stroke:#a5a5a5,stroke-width:2px
    classDef config fill:#ece2f0,stroke:#b08bbe
```
