# gmendozas/easyactivities architecture

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

- Interactive diagram: https://gitdiagram.com/gmendozas/easyactivities
- Repository: https://github.com/gmendozas/easyactivities

## Overview

##### Project Type and Purpose
- This is a full-stack .NET “EasyActivities” suite for recording working activities.
- It consists of:
- A WPF desktop client (ClienteActividades)
- An ASP.NET Web API backend (ServicioActividades)
- A shared data-access library (RepositorioDB)
- A MongoDB database
- External geolocation service (Google Maps Location Services)

##### File Structure Analysis
- Top-level solution (ServicioActividades.sln) contains three projects:
a. ClienteActividades (WPF application)
- UI layer: App.xaml, MainWindow.xaml
- References GoogleMaps.LocationServices, MongoDB.Driver, Newtonsoft.Json
b. RepositorioDB (Class library)
- Contracts: IActividadRepositorio
- MongoDb folder: BaseRepositorio, Entidades (domain models), Repositorios (implementations)
- Uses MongoDB C# driver
c. ServicioActividades (Web API)
- Controllers: ActividadesController, ColaboradorController
- Models: Actividad, Colaborador
- Configuration in WebApiConfig.cs, Web.config
- References RepositorioDB, MongoDB.Driver, Newtonsoft.Json

##### README Insights
- “Suite to record working activities” confirms the workflow:
Client UI captures activity data → sends to Web API → persists via repository → stored in MongoDB.

##### Main Components
a. WPF Client
b. ASP.NET Web API Server
c. RepositorioDB Library
d. MongoDB Database
e. Google Maps Location Services (external API)

##### Relationships and Data Flow
- Client → (HTTP/REST) → Web API Controllers
- Controllers → (calls) → IActividadRepositorio in RepositorioDB
- Repository implementations → (MongoDB C# Driver) → MongoDB
- Client → (Google Maps SDK) → External Geolocation Service

##### Architectural Patterns and Key Technologies
- Client: MVVM-style WPF (.NET Framework 4.x), uses GoogleMaps.LocationServices library
- Service: ASP.NET Web API (REST), Controllers → Models → Repository
- Repository: Repository pattern abstracted via IActividadRepositorio, implemented with MongoDb driver
- Data store: MongoDB NoSQL
- JSON serialization: Newtonsoft.Json

##### Detailed Capture of Essential Elements
- Controllers invoking IActividadRepositorio
- Entity classes (Actividad, Colaborador) flowing through layers
- Config files only as a note (e.g., Web.config for connection strings)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        WPF["ClienteActividades\nWPF (.NET 4.x)"]:::ui
        AppX["App.xaml"]:::ui
        MainW["MainWindow.xaml"]:::ui
        AppCfg["App.config"]:::ui
        ReadmeSDK["GoogleMaps.LocationServices.readme.txt"]:::ui
        WPF --> AppX
        WPF --> MainW
        WPF --> AppCfg
        WPF --> ReadmeSDK
    end

    %% Backend/API Layer
    subgraph "Backend/API Layer"
        direction TB
        subgraph "Controllers"
            direction TB
            ActCtrl["ActividadesController"]:::api
            ColCtrl["ColaboradorController"]:::api
        end
        subgraph "Models"
            direction TB
            ActModel["Actividad Model"]:::api
            ColModel["Colaborador Model"]:::api
        end
        subgraph "Configuration"
            direction TB
            WebApiCfg["WebApiConfig.cs"]:::api
            WebConfig["Web.config"]:::api
            GlobalASax["Global.asax"]:::api
        end
        ActCtrl -->|uses| ActModel
        ColCtrl -->|uses| ColModel
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        direction TB
        ReposLib["RepositorioDB Library"]:::lib
        IRepo["IActividadRepositorio"]:::lib
        ImplSub["Implementations\n(MongoDb Repositorios)"]:::lib
        ReposLib --> IRepo
        IRepo --> ImplSub
    end

    %% Persistence and External Services
    MongoDb["MongoDB Database"]:::db
    GoogleMaps["Google Maps Location Service"]:::ext

    %% Data Flows
    WPF -->|"HTTP GET/POST\n/api/actividades"| ActCtrl
    WPF -->|"HTTP GET/POST\n/api/colaborador"| ColCtrl
    ActCtrl -->|"calls IActividadRepositorio"| IRepo
    ColCtrl -->|"calls IActividadRepositorio"| IRepo
    IRepo -->|"MongoDB.Driver"| MongoDb
    ImplSub -->|"MongoDB CRUD"| MongoDb
    WPF -->|"GoogleMaps.LocationServices SDK"| GoogleMaps

    %% Click Events
    click WPF "https://github.com/gmendozas/easyactivities/tree/master/ServicioActividades/ClienteActividades"
    click AppX "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ClienteActividades/App.xaml"
    click MainW "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ClienteActividades/MainWindow.xaml"
    click AppCfg "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ClienteActividades/App.config"
    click ReadmeSDK "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ClienteActividades/GoogleMaps.LocationServices.readme.txt"
    click ActCtrl "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ServicioActividades/Controllers/ActividadesController.cs"
    click ColCtrl "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ServicioActividades/Controllers/ColaboradorController.cs"
    click ActModel "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ServicioActividades/Models/Actividades.cs"
    click ColModel "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ServicioActividades/Models/Colaborador.cs"
    click WebApiCfg "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ServicioActividades/App_Start/WebApiConfig.cs"
    click WebConfig "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ServicioActividades/Web.config"
    click GlobalASax "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/ServicioActividades/Global.asax"
    click ReposLib "https://github.com/gmendozas/easyactivities/tree/master/ServicioActividades/RepositorioDB"
    click IRepo "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/RepositorioDB/Contratos/IActividadRepositorio.cs"
    click ImplSub "https://github.com/gmendozas/easyactivities/tree/master/ServicioActividades/RepositorioDB/MongoDb/Repositorios"
    click MongoDb "https://github.com/gmendozas/easyactivities/blob/master/ServicioActividades/packages/GoogleMaps.LocationServices.0.9.8.5"

    %% Styles
    classDef ui fill:#add8e6,stroke:#333,stroke-width:1px
    classDef api fill:#90ee90,stroke:#333,stroke-width:1px
    classDef lib fill:#ffdead,stroke:#333,stroke-width:1px
    classDef db fill:#d3d3d3,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef ext fill:#b0e0e6,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
```
