# aabdoo23/scheds architecture

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

- Interactive diagram: https://gitdiagram.com/aabdoo23/scheds
- Repository: https://github.com/aabdoo23/scheds

## Overview

##### Main Architecture Components

The project follows a Clean Architecture pattern with distinct layers:
- Presentation Layer (Scheds.MVC)
- Application Layer (Scheds.Application)
- Domain Layer (Scheds.Domain)
- Infrastructure Layer (Scheds.Infrastructure)

a) Client-Side Components (Top Layer):
- Web Browser
- Frontend Assets (CSS/JS/Images)
- View Components
- jQuery/Bootstrap

b) Application Layer (Middle Layer):
- MVC Controllers
- View Components
- Service Interfaces
- Repository Interfaces

c) Domain Layer:
- Entities (CourseBase, CourseSchedule, Instructor, CardItem)
- DTOs
- ViewModels

d) Infrastructure Layer (Bottom Layer):
- Database Context (SchedsDbContext)
- Repository Implementations
- Service Implementations
- External Service Integration (Self-Service System)

##### User Interface → Controllers
- Schedule generation requests
- Course search
- Room availability checks

##### Controllers → Services
- ICardItemService
- IEmptyRoomsService
- IParsingService
- ISelfServiceLiveFetchService

##### Services → Repositories
- ICardItemRepository
- ICourseBaseRepository
- ICourseScheduleRepository
- IInstructorRepository

##### Repositories → Database
- Entity Framework Core operations
- Data persistence

##### External Integration
- Self-Service Live Fetch connection
- Data synchronization flow

##### Component Grouping

Related components:
##### Schedule Generation
- GenerateController
- CardItemService
- CourseScheduleRepository

##### Room Management
- RoomController
- EmptyRoomsService
- Room-related repositories

##### Course Management
- CourseBaseController
- CourseScheduleController
- Related services and repositories

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Legend"
        L1[Frontend Component]:::frontend
        L2[Application Component]:::application
        L3[Infrastructure Component]:::infrastructure
        L4[External System]:::external
        L5[Database]:::database
    end

    subgraph "Frontend Layer"
        Browser[Client Browser]:::frontend
        Views[MVC Views]:::frontend
        Controllers[Controllers]:::frontend
        StaticAssets[Static Assets]:::frontend
        ViewComponents[View Components]:::frontend
    end

    subgraph "Application Layer"
        AppServices[Application Services]:::application
        Interfaces[Interfaces]:::application
        ViewModels[ViewModels]:::application
        DTOs[DTOs]:::application
    end

    subgraph "Domain Layer"
        Entities[Domain Entities]:::application
    end

    subgraph "Infrastructure Layer"
        DbContext[Database Context]:::infrastructure
        Repositories[Repositories]:::infrastructure
        InfraServices[Infrastructure Services]:::infrastructure
        Utils[Utility Classes]:::infrastructure
    end

    subgraph "Core Features"
        SchedGen[Schedule Generation System]:::application
        CourseMan[Course Management System]:::application
        RoomFinder[Study Room Finder]:::application
        CartSystem[Cart System]:::application
    end

    subgraph "External Systems"
        SelfService[NU Self-Service System]:::external
        Database[(SQL Server)]:::database
    end

    Browser --> Controllers
    Controllers --> Views
    Controllers --> ViewComponents
    Controllers --> AppServices
    AppServices --> Interfaces
    AppServices --> DTOs
    AppServices --> ViewModels
    AppServices --> Entities
    Interfaces --> InfraServices
    InfraServices --> DbContext
    DbContext --> Database
    InfraServices --> SelfService
    Repositories --> DbContext
    Utils --> InfraServices

    %% Click events for component mapping
    click Views "https://github.com/aabdoo23/Scheds/tree/master//Scheds/Views"
    click Controllers "https://github.com/aabdoo23/Scheds/tree/master//Scheds/Controllers"
    click StaticAssets "https://github.com/aabdoo23/Scheds/tree/master//Scheds/wwwroot"
    click ViewComponents "https://github.com/aabdoo23/Scheds/tree/master//Scheds/Views/Shared/Components"
    click ViewModels "https://github.com/aabdoo23/Scheds/tree/master//Scheds.Domain/ViewModels"
    click DTOs "https://github.com/aabdoo23/Scheds/tree/master//Scheds.Domain/DTOs"
    click Entities "https://github.com/aabdoo23/Scheds/tree/master//Scheds.Domain/Entities"
    click DbContext "https://github.com/aabdoo23/Scheds/blob/master//Scheds.Infrastructure/Contexts/SchedsDbContext.cs"
    click Repositories "https://github.com/aabdoo23/Scheds/tree/master//Scheds.Infrastructure/Repositories"
    click InfraServices "https://github.com/aabdoo23/Scheds/tree/master//Scheds.Infrastructure/Services"
    click SchedGen "https://github.com/aabdoo23/Scheds/blob/master//Scheds.Infrastructure/Util/GenerationUtil.cs"
    click CourseMan "https://github.com/aabdoo23/Scheds/blob/master//Scheds/Controllers/CourseBaseController.cs"
    click RoomFinder "https://github.com/aabdoo23/Scheds/blob/master//Scheds/Controllers/FindStudyRoomsController.cs"
    click CartSystem "https://github.com/aabdoo23/Scheds/blob/master//Scheds/Controllers/CartController.cs"

    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef application fill:#4CAF50,stroke:#2E7D32,color:white
    classDef infrastructure fill:#FF9800,stroke:#EF6C00,color:white
    classDef external fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef database fill:#795548,stroke:#4E342E,color:white
```
