# binhnqhe172185/sep492 architecture

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

- Interactive diagram: https://gitdiagram.com/binhnqhe172185/sep492
- Repository: https://github.com/binhnqhe172185/sep492

## Overview

##### Main Components
- Frontend:
- Angular Client (LMCM_FE/LMCM_Client) which includes components, pages, API services, layout, assets, and route modules.
- Backend:
- API Controllers: Found under LMCM_BE/Controllers; these handle incoming HTTP requests.
- Services Layer: Under LMCM_BE/Services; contains business logic (for example, AcceptanceRecordService, BudgetProposalService, etc.).
- Repositories: Under LMCM_BE/Repositories; abstract data access logic for different entities (e.g., UserRepository, ContractRepository, etc.).
- Domain Models and DTOs: Found in LMCM_BE/Models and LMCM_BE/DTOs, showing how data is structured and passed between layers.
- AutoMapper Profiles: Located in LMCM_BE/AutoMapper to handle mapping between domain models and DTOs.
- Database Context and Migrations: The LMCM_DBContext and migration files that manage database schema evolution.
- External Integrations: For example, the GoogleDriveService in LMCM_BE/Services indicating an integration with external storage.

##### Relationships and Interactions
- The front-end Angular application makes HTTP API requests to the backend controllers.
- Controllers invoke corresponding services which contain the business logic.
- Services call the repository layer to interact with the database (using LMCM_DBContext).
- AutoMapper profiles facilitate the conversion between domain models and DTOs, ensuring data consistency.
- External services (like Google Drive) are invoked from the backend where necessary.

##### Architectural Patterns & Design Principles
- Layered/MVC Pattern: Notice the clear separation of controllers (presentation layer), services (business logic), and repositories (data access layer).
- Domain-Driven Design: Each domain such as “AcceptanceRecord” or “Contract” has its own dedicated directories, promoting modularity.
- Dependency Injection: Likely used in the ASP.NET Core project to decouple controllers, services, and repositories.
- API-First Architecture: The clear division of frontend (Angular) and backend (Web API) makes it straightforward to see the RESTful communication.

##### Technology Stack & Key Technologies
- Frontend: Angular (as indicated by angular.json and related Angular project files) with tools such as ESLint, Prettier, and Tailwind CSS.
- Backend: ASP.NET Core with C# (observed from .csproj, Program.cs, and Entity Framework Core migrations).
- Database: Managed via Entity Framework Core (through LMCM_DBContext and Migrations).
- External Services: Google Drive integration is implemented through a dedicated service.

##### Additional Details
- AutoMapper as a mediator layer between the DTOs and the models (this helps illustrate how data transformations occur).
- Dependency flow (e.g., controllers depend on services, services depend on repositories).

This approach ensures that every critical architectural element is captured while remaining concise and specific to the LMCM project’s structure and responsibilities.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Layer
    subgraph "Frontend"
        AC["Angular Client"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend"
        API["API Controllers"]:::backend
        SVC["Services Layer"]:::backend
        REPO["Repositories"]:::backend
        AM["AutoMapper Profiles"]:::backend
    end

    %% Domain Modules
    subgraph "Domain Modules"
        DM["Domain Models"]:::domain
        DTO["DTOs"]:::domain
    end

    %% Database Layer
    subgraph "Database"
        DB["Database (LMCM_DBContext)"]:::db
        MIG["Migrations"]:::db
    end

    %% External Integration
    EXT["External Integration (Google Drive)"]:::external

    %% Relationships
    AC -->|"calls"| API
    API -->|"calls"| SVC
    SVC -->|"calls"| REPO
    REPO -->|"interacts"| DB
    DB -->|"tracked_by"| MIG

    SVC -->|"maps"| AM
    AM -->|"to"| DM
    AM -->|"from"| DTO

    SVC -->|"invokes"| EXT
    AC -.->|"HTTP_API"| API

    %% Styles
    classDef frontend fill:#F9E79F,stroke:#333,stroke-width:2px;
    classDef backend fill:#AED6F1,stroke:#333,stroke-width:2px;
    classDef domain fill:#D2B4DE,stroke:#333,stroke-width:2px;
    classDef db fill:#ABEBC6,stroke:#333,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#333,stroke-width:2px;

    %% Click Events
    click AC "https://github.com/binhnqhe172185/sep492/tree/dev/LMCM/LMCM_FE/LMCM_Client"
    click API "https://github.com/binhnqhe172185/sep492/tree/dev/LMCM/LMCM_BE/Controllers"
    click SVC "https://github.com/binhnqhe172185/sep492/tree/dev/LMCM/LMCM_BE/Services"
    click REPO "https://github.com/binhnqhe172185/sep492/tree/dev/LMCM/LMCM_BE/Repositories"
    click DM "https://github.com/binhnqhe172185/sep492/tree/dev/LMCM/LMCM_BE/Models"
    click DTO "https://github.com/binhnqhe172185/sep492/tree/dev/LMCM/LMCM_BE/DTOs"
    click AM "https://github.com/binhnqhe172185/sep492/tree/dev/LMCM/LMCM_BE/AutoMapper"
    click DB "https://github.com/binhnqhe172185/sep492/blob/dev/LMCM/LMCM_BE/DbContext/LMCM_DBContext.cs"
    click MIG "https://github.com/binhnqhe172185/sep492/tree/dev/LMCM/LMCM_BE/Migrations"
    click EXT "https://github.com/binhnqhe172185/sep492/tree/dev/LMCM/LMCM_BE/Services/GoogleDriveService"
```
