Adds requirements and userstories. also updates diagrams to be mermaid diagrams instead of text variants

This commit is contained in:
2026-06-17 11:31:17 +02:00
parent 73025c5a84
commit c7154e288f
13 changed files with 1018 additions and 163 deletions
@@ -8,54 +8,39 @@ The frontend is a React SPA (to be built) that communicates with the API via RES
## Architecture Diagram
```
+--------------------------------------------------+
| Client Layer |
| +--------------------------------------------+ |
| | React SPA (SlpModularCms.Frontend) | |
| | Vite + React Router v7 + shadcn/ui | |
| | Tailwind CSS v4 (#ac0000 theme) | |
| +--------------------------------------------+ |
+---------------------------+----------------------+
| HTTP REST / JSON
+---------------------------v----------------------+
| API Layer |
| +--------------------------------------------+ |
| | SlpModularCms.Api (ASP.NET Core) | |
| | - JWT Bearer Auth Middleware | |
| | - CORS, Swagger/OpenAPI | |
| | - Module registration pipeline | |
| +--------------------------------------------+ |
| |
| +------------------+ +---------------------+ |
| | Identity Module | | Availability Module | |
| | - AuthController| | - AvailabilityCtrl | |
| | - SetupCtrl | | - PersistentService | |
| | - UsersCtrl | | - CircuitBreaker | |
| +------------------+ +---------------------+ |
+---------------------------+----------------------+
|
+---------------------------v----------------------+
| Core Layer |
| +--------------------------------------------+ |
| | SlpModularCms.Core | |
| | - ApplicationDbContext (EF Core) | |
| | - Domain Entities | |
| | - Identity Services (Auth, Setup, Invite) | |
| | - IModule interface + ModuleInfo | |
| +--------------------------------------------+ |
+---------------------------+----------------------+
|
+---------------------------v----------------------+
| Data Layer |
| +--------------------------------------------+ |
| | SQL Server Database | |
| | - ASP.NET Identity tables | |
| | - RefreshTokens | |
| | - Invitations | |
| | - GlobalAvailabilityState | |
| +--------------------------------------------+ |
+--------------------------------------------------+
```mermaid
graph TD
subgraph ClientLayer["Client Layer"]
Frontend["React SPA\nVite + TanStack Router + shadcn/ui\nTailwind CSS v4 #ac0000"]
end
subgraph ApiLayer["API Layer"]
Api["SlpModularCms.Api\nASP.NET Core\nJWT Bearer, CORS, Swagger"]
Identity["Identity Module\nAuthController\nSetupController\nUsersController"]
Avail["Availability Module\nAvailabilityController\nPersistentService + CircuitBreaker"]
end
subgraph CoreLayer["Core Layer"]
Core["SlpModularCms.Core\nApplicationDbContext\nDomain Entities\nIdentity Services\nIModule interface"]
end
subgraph DataLayer["Data Layer"]
DB[("SQL Server\nIdentity tables\nRefreshTokens\nInvitations\nGlobalAvailabilityState")]
end
Frontend -->|HTTP REST / JSON| Api
Api --> Identity
Api --> Avail
Identity --> Core
Avail --> Core
Core --> DB
style Frontend fill:#2196F3,stroke:#0D47A1,color:#fff
style Api fill:#4CAF50,stroke:#2E7D32,color:#fff
style Identity fill:#4CAF50,stroke:#2E7D32,color:#fff
style Avail fill:#4CAF50,stroke:#2E7D32,color:#fff
style Core fill:#FFC107,stroke:#F57F17,color:#000
style DB fill:#FF5722,stroke:#BF360C,color:#fff
```
## Component Descriptions
@@ -92,24 +77,36 @@ The frontend is a React SPA (to be built) that communicates with the API via RES
## Data Flow
```
Login Flow:
Browser -> POST /auth/login -> AuthController
-> AuthService.AuthenticateAsync()
-> PasswordHasher validates credentials
-> JwtService generates access + refresh tokens
-> Returns {accessToken, refreshToken}
```mermaid
sequenceDiagram
participant Browser
participant AuthController
participant AuthService
participant DB
Invite Flow:
Admin -> POST /users/invite -> UsersController
-> InvitationService.CreateInvitationAsync()
-> Stores Invitation entity with token
-> Returns invite link
Note over Browser,DB: Login Flow
Browser->>AuthController: POST /auth/login
AuthController->>AuthService: AuthenticateAsync()
AuthService->>DB: Validate credentials
DB-->>AuthService: User found
AuthService-->>AuthController: access + refresh tokens
AuthController-->>Browser: 200 OK with tokens
New User Setup:
User -> POST /users/complete-setup -> UsersController
-> InvitationService.CompleteInvitationAsync()
-> Sets password, activates account
Note over Browser,DB: Invite Flow
Browser->>AuthController: POST /users/invite
AuthController->>AuthService: CreateInvitationAsync()
AuthService->>DB: Store Invitation entity
DB-->>AuthService: Stored
AuthService-->>AuthController: invite token
AuthController-->>Browser: 200 OK with invite link
Note over Browser,DB: New User Setup
Browser->>AuthController: POST /users/complete-setup
AuthController->>AuthService: CompleteInvitationAsync()
AuthService->>DB: Set password, activate account
DB-->>AuthService: Updated
AuthService-->>AuthController: success
AuthController-->>Browser: 200 OK
```
## Integration Points