# riorinald/taskmanagementsystem architecture

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

- Interactive diagram: https://gitdiagram.com/riorinald/taskmanagementsystem
- Repository: https://github.com/riorinald/taskmanagementsystem

## Overview

##### Main Components
- Presentation/API Layer: Represented by the TaskManagementSystem.API project. This layer contains the controllers (e.g., WorkItemsController.cs) that handle incoming HTTP requests.
- Application Layer: Represented by the TaskManagementSystem.Application project. It includes the application services, DTOs (for creating, updating, and retrieving work items and users), and validators. This layer encapsulates the business use cases and logic.
- Domain Layer: Represented by the TaskManagementSystem.Domain project. It holds the core business entities (such as User and WorkItem), enums (Priority, Status), and interfaces (e.g., IUserRepository, IWorkItemRepository) that define the contracts without depending on external services.
- Infrastructure Layer: Represented by the TaskManagementSystem.Infrastructure project. This implements the repository interfaces and manages data access to the SQLite database, as shown by the database context implementations (SqliteDatabaseContext, JsonDatabaseContext) and the dependency injection configuration.
- Testing Layer: Represented by TaskManagementSystem.Tests. Contains xUnit tests for various API endpoints and system behavior.

##### Relationships and Data Flow
- The Application Layer processes business logic and uses DTOs to interact with client data. It then calls the Domain Layer’s interfaces to work with business entities.
- The Domain Layer defines core entities and the repository interfaces that abstract data operations.
- The Infrastructure Layer implements the repository interfaces from the Domain, providing the concrete database access (using SQLite for persistence).
- Optionally, illustrate the dependency injection setup (found in files like ServiceCollectionExtensions.cs and DependencyInjection.cs) to show how the components are wired during application startup.

##### Architectural Patterns
- Clean Architecture: Segregate the code into layers (API, Application, Domain, Infrastructure) ensuring separation of concerns.
- Dependency Injection: Show how the API and Application layers are decoupled from the Infrastructure implementations.
- Repository Pattern: Emphasize that the Domain interfaces for data access are implemented by the Infrastructure layer repositories (UserRepository, WorkItemRepository).

##### Relevant Technologies and Details
- .NET Core or .NET 5/6 (as indicated by the .csproj files and .NET CLI commands in the README).
- SQLite: Show its connection with the Infrastructure layer (via database context implementations).
- API Endpoints: Note some key endpoints (GET /api/workitems, POST /api/workitems, GET /api/users) in the API layer.
- Testing Framework: xUnit, as indicated by the Test project.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation/API Layer
    subgraph "Presentation/API Layer"
        API1["WorkItemsController"]:::api
        API2["ServiceCollectionExtensions"]:::api
        API3["Program.cs"]:::api
    end

    %% Application Layer
    subgraph "Application Layer"
        APP1["DTOs"]:::app
        APP2["Application Interfaces"]:::app
        APP3["Application Services"]:::app
        APP4["Validators"]:::app
    end

    %% Domain Layer
    subgraph "Domain Layer"
        DOM1["Domain Entities"]:::domain
        DOM2["Domain Enums"]:::domain
        DOM3["Domain Interfaces"]:::domain
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        INF1["Data Access"]:::infra
        INF2["Infrastructure DI"]:::infra
        INF3["Repository Implementations"]:::infra
    end

    %% Testing Layer
    subgraph "Testing Layer"
        TEST1["API Tests"]:::test
    end

    %% Connections between layers
    API1 -->|"calls"| APP3
    API3 -->|"initiates"| API2
    API2 -->|"registers"| INF2
    APP3 -->|"uses"| DOM3
    DOM3 -->|"implementedBy"| INF3
    INF3 -->|"accesses"| INF1

    %% Testing connection
    TEST1 -->|"tests"| API1

    %% Additional dependency wiring
    API3 -->|"wiresUp"| INF2

    %% Click Events
    click API1 "https://github.com/riorinald/taskmanagementsystem/blob/master/TaskManagementSystem.API/Controllers/WorkItemsController.cs"
    click API2 "https://github.com/riorinald/taskmanagementsystem/blob/master/TaskManagementSystem.API/Extensions/ServiceCollectionExtensions.cs"
    click API3 "https://github.com/riorinald/taskmanagementsystem/blob/master/TaskManagementSystem.API/Program.cs"
    click APP1 "https://github.com/riorinald/taskmanagementsystem/tree/master/TaskManagementSystem.Application/DTOs/"
    click APP2 "https://github.com/riorinald/taskmanagementsystem/tree/master/TaskManagementSystem.Application/Interfaces/"
    click APP3 "https://github.com/riorinald/taskmanagementsystem/tree/master/TaskManagementSystem.Application/Services/"
    click APP4 "https://github.com/riorinald/taskmanagementsystem/tree/master/TaskManagementSystem.Application/Validators/"
    click DOM1 "https://github.com/riorinald/taskmanagementsystem/tree/master/TaskManagementSystem.Domain/Entities/"
    click DOM2 "https://github.com/riorinald/taskmanagementsystem/tree/master/TaskManagementSystem.Domain/Enums/"
    click DOM3 "https://github.com/riorinald/taskmanagementsystem/tree/master/TaskManagementSystem.Domain/Interfaces/"
    click INF1 "https://github.com/riorinald/taskmanagementsystem/tree/master/TaskManagementSystem.Infrastructure/Data/"
    click INF2 "https://github.com/riorinald/taskmanagementsystem/blob/master/TaskManagementSystem.Infrastructure/DependencyInjection.cs"
    click INF3 "https://github.com/riorinald/taskmanagementsystem/tree/master/TaskManagementSystem.Infrastructure/Repositories/"
    click TEST1 "https://github.com/riorinald/taskmanagementsystem/tree/master/TaskManagementSystem.Tests/API/"

    %% Styles
    classDef api fill:#FFCC00,stroke:#333,stroke-width:2px;
    classDef app fill:#66CCFF,stroke:#333,stroke-width:2px;
    classDef domain fill:#CCFFCC,stroke:#333,stroke-width:2px;
    classDef infra fill:#FF9999,stroke:#333,stroke-width:2px;
    classDef test fill:#CCCCFF,stroke:#333,stroke-width:2px;
```
