# jimmyam63/comp3000-jimmymacesanu architecture

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

- Interactive diagram: https://gitdiagram.com/jimmyam63/comp3000-jimmymacesanu
- Repository: https://github.com/jimmyam63/comp3000-jimmymacesanu

## Overview

##### Project Type & Purpose
- This is a full-stack application that consists of a backend API built with .NET 6 (as seen by the net6.0 directories and .csproj files) and a frontend implemented using Angular (notice the angular.json, TypeScript, and component files in NaplexFrontend).
- The API handles business logic for operations related to sales, rota management, targets, staff, stores, and authentication. The Angular frontend acts as the presentation layer enabling a retail dashboard interface.
- Although the README is minimal, file names (like SalesController, ROTAController, StaffController, etc.) and DTO and Entity classes suggest that the application is focused on retail management or internal store operations.

##### Analyzing the File Structure
- Backend (NaplexAPI):
- Organized into Controllers (for handling HTTP requests), Services (implementing business logic), and Models (both DTOs and Entities).
- There is an Infrastructure folder containing the ApplicationDbContext, which implies an Entity Framework Core connection to an underlying database.
- The Migrations folder indicates database versioning and schema evolution, further strengthening the persistence layer.
- Additional configuration files (appsettings.json, dotnet-tools.json) and build outputs indicate a standard .NET API project.
- Frontend (NaplexFrontend):
- Contains the Angular configuration (angular.json), TypeScript files, numerous components (login, dashboard, menu, etc.), routing modules, and services dealing with authentication and domain-specific operations (rota, sales, staff, targets).
- Dist and src directories show the typical Angular project structure.

##### Main Components
- Frontend Application (Angular):
- Components: Login, Dashboard, Chat, Leaderboard, Staff, Rota, Sales, Settings, Sidenav, Notification, Panel, Store Selection Modal.
- Services: Authentication, Leaderboard, Rota Service, Sales Service, Store Service, Targets Service, etc.
- Angular Routing Module (API call integration through api.ts file).
- Backend API (.NET):
- API Controllers: AuthController, ROTAController, SalesController, StaffController, StoreController, TargetsController.
- Service Layer: Business logic implementation (UserService, ChangeRoleService, SalesService, etc.).
- Data Access Layer: ApplicationDbContext in Infrastructure, along with the Entity Framework Core Migrations.
- Models: Separate folders for DTOs (data transfer objects) and Entities (domain models).
- Database:

##### Architectural Patterns & Design Principles
- MVC architecture in the .NET API:
- Controllers, Models (DTOs and entities), and Services represent different concerns.
- Component-based structure on the Angular side with proper separation of concerns (services handling business logic, components handling UI).
- Use dependency injection on the backend (interface/service pairs like IAssignToStoreService/AssignToStoreService) as suggested by the file naming.
- A RESTful API design whereby the Angular front-end communicates with the .NET backend via clearly defined endpoints.

##### Final Checklist for the Principal Software Engineer
- The separation between the Angular-based frontend and .NET API-based backend.
- How RESTful interactions are handled (list key endpoints if desired).
- The division within the backend (controllers → services → data access layer).
- The integration with the database through the ApplicationDbContext and migration history.
- The frontend issues HTTP calls routed by API endpoints.
- The backend performs business tasks and data persistence.
- The overall flow of data and control between components is clear.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Angular Frontend"
        direction TB
        A1["Angular Frontend Application"]:::frontend
        subgraph "Components"
            direction TB
            B1["Login Component"]:::frontend
            B2["Dashboard Component"]:::frontend
            B3["Chat Component"]:::frontend
            B4["Leaderboard Component"]:::frontend
            B5["Staff Component"]:::frontend
            B6["Rota Component"]:::frontend
            B7["Sales Component"]:::frontend
            B8["Settings Component"]:::frontend
            B9["Sidenav Component"]:::frontend
            B10["Notification Component"]:::frontend
            B11["Panel Component"]:::frontend
            B12["Store Selection Modal"]:::frontend
        end
        C1["API Integration File"]:::frontend
        C2["Angular Routing Module"]:::frontend
    end

    subgraph ".NET API Backend"
        direction TB
        subgraph "Controllers"
            direction TB
            D1["AuthController"]:::backend
            D2["ROTAController"]:::backend
            D3["SalesController"]:::backend
            D4["StaffController"]:::backend
            D5["StoreController"]:::backend
            D6["TargetsController"]:::backend
        end
        subgraph "Service Layer"
            direction TB
            E1["UserService/ChangeRoleService etc."]:::backend
        end
        subgraph "Models"
            direction TB
            F1["DTOs"]:::backend
            F2["Entities"]:::backend
        end
        subgraph "Infrastructure"
            direction TB
            G1["ApplicationDbContext"]:::backend
            G2["Migrations"]:::backend
        end
    end

    subgraph "Database"
        direction TB
        H1["Relational Database"]:::database
    end

    %% Connections: Frontend to API
    A1 -->|"triggers"| C1
    B1 -->|"triggers"| C1
    B2 -->|"triggers"| C1
    B3 -->|"triggers"| C1
    B4 -->|"triggers"| C1
    B5 -->|"triggers"| C1
    B6 -->|"triggers"| C1
    B7 -->|"triggers"| C1
    B8 -->|"triggers"| C1
    B9 -->|"triggers"| C1
    B10 -->|"triggers"| C1
    B11 -->|"triggers"| C1
    B12 -->|"triggers"| C1

    %% API Integration File calling Controllers via REST
    C1 -->|"RESTcall"| D1
    C1 -->|"RESTcall"| D2
    C1 -->|"RESTcall"| D3
    C1 -->|"RESTcall"| D4
    C1 -->|"RESTcall"| D5
    C1 -->|"RESTcall"| D6

    %% Controllers delegate tasks to Service Layer
    D1 -->|"delegates"| E1
    D2 -->|"delegates"| E1
    D3 -->|"delegates"| E1
    D4 -->|"delegates"| E1
    D5 -->|"delegates"| E1
    D6 -->|"delegates"| E1

    %% Service Layer performs CRUD operations through Data Access
    E1 -->|"CRUD"| G1

    %% Data Access persists data in the Database
    G1 -->|"stores data"| H1

    %% Click Events for Angular Components
    click A1 "https://github.com/jimmyam63/comp3000-jimmymacesanu/tree/main/NaplexFrontend/"
    click B1 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/login/login.component.ts"
    click B2 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/dashboard/dashboard.component.ts"
    click B3 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/chat/chat.component.ts"
    click B4 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/leaderboard/leaderboard.component.ts"
    click B5 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/staff/staff.component.ts"
    click B6 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/rota/rota.component.ts"
    click B7 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/sales/sales.component.ts"
    click B8 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/settings/settings.component.ts"
    click B9 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/sidenav/sidenav.component.ts"
    click B10 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/notification/notification.component.ts"
    click B11 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/panel/panel.component.ts"
    click B12 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/store-selection-modal/store-selection-modal.component.ts"
    click C1 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/api.ts"
    click C2 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexFrontend/src/app/app-routing.module.ts"

    %% Click Events for .NET API Components
    click D1 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexAPI/NaplexAPI/Controllers/AuthController.cs"
    click D2 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexAPI/NaplexAPI/Controllers/ROTAController.cs"
    click D3 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexAPI/NaplexAPI/Controllers/SalesController.cs"
    click D4 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexAPI/NaplexAPI/Controllers/StaffController.cs"
    click D5 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexAPI/NaplexAPI/Controllers/StoreController.cs"
    click D6 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexAPI/NaplexAPI/Controllers/TargetsController.cs"
    click E1 "https://github.com/jimmyam63/comp3000-jimmymacesanu/tree/main/NaplexAPI/NaplexAPI/Services/"
    click F1 "https://github.com/jimmyam63/comp3000-jimmymacesanu/tree/main/NaplexAPI/NaplexAPI/Models/DTOs/"
    click F2 "https://github.com/jimmyam63/comp3000-jimmymacesanu/tree/main/NaplexAPI/NaplexAPI/Models/Entities/"
    click G1 "https://github.com/jimmyam63/comp3000-jimmymacesanu/blob/main/NaplexAPI/NaplexAPI/Infrastructure/ApplicationDbContext.cs"
    click G2 "https://github.com/jimmyam63/comp3000-jimmymacesanu/tree/main/NaplexAPI/NaplexAPI/Migrations/"

    %% Styles
    classDef frontend fill:#aee1f9,stroke:#1f77b4,stroke-width:2px;
    classDef backend fill:#ffd1a4,stroke:#ff7f0e,stroke-width:2px;
    classDef database fill:#d0f0c0,stroke:#2ca02c,stroke-width:2px;
```
