# tuannta2k/mediplat_prn231_sp25 architecture

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

- Interactive diagram: https://gitdiagram.com/tuannta2k/mediplat_prn231_sp25
- Repository: https://github.com/tuannta2k/mediplat_prn231_sp25

## Overview

##### Main Architectural Components

a. Presentation Layer:
- Two client applications:
- Razor Pages UI (MediPlat.RazorPage)
- API Endpoints (MediPlat.API)

b. Business Layer:
- Service Layer (MediPlat.Service)
- Model Layer (MediPlat.Model)

c. Data Access Layer:
- Repository Layer (MediPlat.Repository)
- Database Layer (SQL Server, based on MediPlat_v1.0.sql)

##### Component Details and Relationships

a. Client Layer (Top):
**┌─────────────────────┐    ┌─────────────────────┐**
- Razor Pages UI    │    │    API Controllers   │
- (MediPlat.RazorPage)│    │   (MediPlat.API)    │
- ┘    └─────────────────────┘

b. Domain Model (Center):
**┌─────────────────────────────────────────┐**
- Domain Models                 │
- AppointmentSlot    - Doctor           │
- Patient            - Review           │
- Service            - Specialty        │
- Subscription       - Transaction      │
- ┘

c. Data Access (Bottom):
**┌─────────────────────┐**
- Generic Repository  │
- ┘
- ↓
**┌─────────────────────┐**
- Database Layer   │
- ┘

##### Interaction Flows

- Client → API Controllers
- API Controllers → Services
- Services → Repositories
- Repositories → Database

##### Additional Elements

a. Cross-Cutting Concerns:
- Authentication/Authorization
- Logging
- Error Handling

b. External Dependencies:
- Bootstrap
- jQuery
- Entity Framework Core

##### Technical Details to Note

Technical specifications:
- .NET Core framework
- Entity Framework Core
- Docker support (noted by Dockerfile presence)
- RESTful API endpoints

##### Deployment Context

- Docker container
- Database server
- Web server

Remember to:
- Use consistent spacing and alignment
- Clear labels for all components
- Both synchronous and asynchronous flows
- Primary data flows
- Significant design patterns (Repository Pattern, etc.)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        UI["Razor Pages Web UI"]:::frontend
        Assets["Static Assets"]:::frontend
        Libs["Client Libraries"]:::frontend
        UI --> Assets
        UI --> Libs
    end

    subgraph APILayer
        API["API Gateway"]:::api
        AuthC["Auth Controller"]:::api
        DoctorC["Doctor Controller"]:::api
        SubC["Subscription Controller"]:::api
        ExpC["Experience Controller"]:::api
        ExMiddleware["Exception Middleware"]:::api
        
        API --> AuthC
        API --> DoctorC
        API --> SubC
        API --> ExpC
        API --> ExMiddleware
    end

    subgraph ServiceLayer
        AuthS["Auth Service"]:::service
        DoctorS["Doctor Service"]:::service
        SubS["Subscription Service"]:::service
        ExpS["Experience Service"]:::service
        EmailS["Email Service"]:::service
        OTPS["OTP Service"]:::service
        TokenS["Token Service"]:::service
        Mapper["Service Mapper"]:::service
    end

    subgraph RepositoryLayer
        GenRepo["Generic Repository"]:::repo
        UoW["Unit of Work"]:::repo
        GenRepo --> UoW
    end

    subgraph ModelLayer
        Domain["Domain Models"]:::model
        DTOs["DTOs"]:::model
        DbContext["Database Context"]:::model
    end

    subgraph External
        DB[(SQL Server)]:::external
        EmailProvider["Email Provider"]:::external
        AuthProvider["Auth Provider"]:::external
    end

    %% Connections
    UI --> API
    
    AuthC --> AuthS
    DoctorC --> DoctorS
    SubC --> SubS
    ExpC --> ExpS
    
    AuthS --> TokenS
    AuthS --> OTPS
    AuthS --> EmailS
    
    DoctorS --> GenRepo
    SubS --> GenRepo
    ExpS --> GenRepo
    AuthS --> GenRepo
    
    EmailS --> EmailProvider
    AuthS --> AuthProvider
    
    GenRepo --> DbContext
    DbContext --> DB

    %% Click Events
    click UI "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/tree/TuanNTA/MediPlat/MediPlat.RazorPage/Pages"
    click Assets "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/tree/TuanNTA/MediPlat/MediPlat.RazorPage/wwwroot"
    click Libs "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/tree/TuanNTA/MediPlat/MediPlat.RazorPage/wwwroot/lib"
    click API "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.API"
    click AuthC "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.API/Controllers/AuthController.cs"
    click DoctorC "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.API/Controllers/DoctorController.cs"
    click SubC "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.API/Controllers/SubscriptionsController.cs"
    click ExpC "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.API/Controllers/ExperienceController.cs"
    click ExMiddleware "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.API/Middleware/GlobalExceptionMiddleware.cs"
    click AuthS "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.Service/Services/AuthService.cs"
    click DoctorS "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.Service/Services/DoctorService.cs"
    click SubS "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.Service/Services/SubscriptionService.cs"
    click ExpS "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.Service/Services/ExperienceService.cs"
    click TokenS "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.Service/Services/TokenService.cs"
    click Mapper "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.Service/Mapping/MappingProfile.cs"
    click GenRepo "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/tree/TuanNTA/MediPlat/MediPlat.Repository/Repositories"
    click UoW "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.Repository/Repositories/UnitOfWork.cs"
    click Domain "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/tree/TuanNTA/MediPlat/MediPlat.Model/Model"
    click DTOs "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/tree/TuanNTA/MediPlat/MediPlat.Model/RequestObject"
    click DbContext "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.Model/Model/MediPlatContext.cs"
    click DB "https://github.com/TuanNTA2K/MediPlat_PRN231_SP25/blob/TuanNTA/MediPlat/MediPlat.sql"

    %% Styles
    classDef frontend fill:#2196F3,stroke:#000,color:#fff
    classDef api fill:#4CAF50,stroke:#000,color:#fff
    classDef service fill:#FFC107,stroke:#000,color:#000
    classDef repo fill:#FF9800,stroke:#000,color:#fff
    classDef model fill:#9C27B0,stroke:#000,color:#fff
    classDef external fill:#607D8B,stroke:#000,color:#fff
```
