# artemian21/advertising_agency architecture

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

- Interactive diagram: https://gitdiagram.com/artemian21/advertising_agency
- Repository: https://github.com/artemian21/advertising_agency

## Overview

##### Project type and purpose
- This is a layered .NET Web API application (“Advertising_Agency”) that exposes REST endpoints for order management, user authentication, discounts, and service listings.
- It follows a Clean/Onion-style architecture with distinct Domain, DataAccess (EF Core), BusinessLogic, WebAPI, and Test projects.

##### File structure
- Top-level projects:
- Advertising_Agency.Domain: DTOs and enums
- Advertising_Agency.DataAccess: EF Core DbContext, configurations, migrations, repository and UnitOfWork implementations
- Advertising_Agency.BusinessLogic: service interfaces and implementations (Auth, Discount, Order, OrderItem, Service, User, password hashing)
- Advertising_Agency.WebAPI: ASP.NET Core controllers and startup configuration
- Advertising_Agency.Tests: unit tests targeting BusinessLogic services
- Patterns & tech:
- Repository + Unit of Work for data access
- Dependency-injection for services/repositories
- Entity Framework Core for ORM
- DTO mapping (AutoMapper profile in DataAccess)
- Bcrypt for password hashing, JWT or token-based AuthService

##### README
- Minimal content (“# Advertising_Agency”), so rely primarily on code structure and conventions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers
    subgraph "Client"
        direction TB
        Client["Client (Web/Mobile)"]
    end

    subgraph "WebAPI Layer" 
        direction TB
        Controllers["Controllers\n(Advertising_Agency.WebAPI/Controllers)"]:::webapi
        Config["Program & AppSettings\n(Advertising_Agency.WebAPI/Program.cs\nappsettings*.json)"]:::webapi
    end

    subgraph "BusinessLogic Layer"
        direction TB
        BLInterfaces["Service Interfaces\n(Advertising_Agency.BusinessLogic/Interfaces)"]:::business
        BLServices["Service Implementations\n(Advertising_Agency.BusinessLogic/Services)"]:::business
        Hasher["Password Hasher\n(BCryptPasswordHasher & IPasswordHasher)"]:::business
    end

    subgraph "DataAccess Layer"
        direction TB
        UoW["UnitOfWork\n(Advertising_Agency.DataAccess/UnitOfWork.cs)"]:::data
        ReposInt["Repository Interfaces\n(Advertising_Agency.DataAccess/Interfaces)"]:::data
        ReposImpl["Repository Implementations\n(Advertising_Agency.DataAccess/Repositories)"]:::data
        Context["EF Core DbContext\n(Advertising_Agency.DataAccess/AdvertisingAgencyContext.cs)"]:::data
        Profile["AutoMapper Profile\n(Advertising_Agency.DataAccess/AdvertisingAgencyProfile.cs)"]:::data
        Configs["Entity Configurations\n(Advertising_Agency.DataAccess/Configurations)"]:::data
        Entities["Entities\n(Advertising_Agency.DataAccess/Entities)"]:::data
        Migrations["Migrations\n(Advertising_Agency.DataAccess/Migrations)"]:::data
    end

    subgraph "Domain Layer"
        direction TB
        DomainModels["DTOs & Models\n(Advertising_Agency.Domain/Models)"]:::domain
        DomainEnums["Enums\n(Advertising_Agency.Domain/Enums)"]:::domain
    end

    subgraph "Database"
        direction TB
        SQLDB["SQL Database"]:::db
    end

    subgraph "Tests"
        direction TB
        Tests["Unit Tests\n(Advertising_Agency.Tests/ServisesTests)"]:::test
    end

    %% Flow
    Client -->|HTTP REST| Controllers
    Controllers -->|Invoke IService| BLInterfaces
    Controllers -->|Invoke Implementation| BLServices
    Config -->|DI Registration| Controllers
    Controllers -->|DI| BLServices

    BLServices -->|Use Hasher| Hasher
    BLServices -->|Use UoW| UoW
    BLServices -->|Call Interfaces| ReposInt

    UoW -->|Provides| ReposImpl
    ReposImpl -->|Use Context| Context
    ReposImpl -->|CRUD via EF Core| Entities
    Context -->|Config via| Configs
    Context -->|Migrations| Migrations
    Context -->|Maps via| Profile

    Context -->|Query/Update| SQLDB
    SQLDB -->|Data| Context

    DomainModels -->|Mapped Entities| Entities
    DomainEnums -->|Used by| BLServices

    Tests -->|Validate| BLServices

    %% Click Events
    click DomainModels "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.Domain/Models"
    click DomainEnums "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.Domain/Enums"
    click Context "https://github.com/artemian21/advertising_agency/blob/master/Advertising_Agency.DataAccess/AdvertisingAgencyContext.cs"
    click Profile "https://github.com/artemian21/advertising_agency/blob/master/Advertising_Agency.DataAccess/AdvertisingAgencyProfile.cs"
    click Configs "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.DataAccess/Configurations"
    click Entities "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.DataAccess/Entities"
    click ReposInt "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.DataAccess/Interfaces"
    click ReposImpl "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.DataAccess/Repositories"
    click UoW "https://github.com/artemian21/advertising_agency/blob/master/Advertising_Agency.DataAccess/UnitOfWork.cs"
    click Migrations "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.DataAccess/Migrations"
    click BLInterfaces "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.BusinessLogic/Interfaces"
    click BLServices "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.BusinessLogic/Services"
    click Hasher "https://github.com/artemian21/advertising_agency/blob/master/Advertising_Agency.BusinessLogic/Services/BCryptPasswordHasher.cs"
    click Controllers "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.WebAPI/Controllers"
    click Config "https://github.com/artemian21/advertising_agency/blob/master/Advertising_Agency.WebAPI/Program.cs"
    click Tests "https://github.com/artemian21/advertising_agency/tree/master/Advertising_Agency.Tests/ServisesTests"

    %% Styles
    classDef webapi fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef business fill:#FFA500,stroke:#333,stroke-width:1px
    classDef data fill:#90EE90,stroke:#333,stroke-width:1px
    classDef domain fill:#D8BFD8,stroke:#333,stroke-width:1px
    classDef db fill:#D3D3D3,stroke:#333,stroke-width:1px,shape:cylinder
    classDef test fill:#FFC0CB,stroke:#333,stroke-width:1px
```
