Initial commit with inital CMS
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
# Business Rules — Unit 03: Availability Module
|
||||
|
||||
Dit document beschrijft de functionele logica voor de beschikbaarheidscontrole en de remote shutdown functionaliteit.
|
||||
|
||||
## 1. Beschikbaarheidsstatus (BR-AVAIL-01)
|
||||
|
||||
- **Status Typen**:
|
||||
- `Available`: Het systeem is volledig operationeel.
|
||||
- `Maintenance`: Het systeem is in onderhoud; alleen beheerders hebben toegang.
|
||||
- `Degraded`: Sommige functies zijn beperkt, maar het systeem is in principe bereikbaar.
|
||||
- `NotAvailable`: Het systeem is volledig afgesloten (Remote Shutdown).
|
||||
- **Default (MVP)**: In de MVP versie retourneert de `StubAvailabilityService` altijd `Available`, tenzij handmatig anders geconfigureerd in `appsettings.json`.
|
||||
|
||||
## 2. Remote Shutdown Handhaving (BR-AVAIL-02)
|
||||
|
||||
- **Mechanisme**: Een globale middleware controleert bij elk inkomend request de status via de `IAvailabilityService`.
|
||||
- **Gedrag**:
|
||||
- Als status == `NotAvailable` -> Retourneer `503 Service Unavailable`.
|
||||
- Als status == `Maintenance` -> Blokkeer requests voor reguliere gebruikers; sta alleen toe voor gebruikers met de rol `Owner` of `Administrator`.
|
||||
- **Response**: De response moet het gestandaardiseerde `ApiErrorResponse` formaat gebruiken (U01).
|
||||
|
||||
## 3. Publieke Status (BR-AVAIL-03)
|
||||
|
||||
- **Endpoint**: `GET /api/availability/status` moet voor iedereen bereikbaar zijn (geen authenticatie vereist).
|
||||
- **Informatie**: Het endpoint retourneert de huidige status en een timestamp van de laatste controle.
|
||||
|
||||
## 4. Beheerder Bypass (BR-AVAIL-04)
|
||||
|
||||
- **Rechten**: Gebruikers met de rol `Owner` of `Administrator` kunnen de blokkades van de Availability Middleware omzeilen om onderhoudstaken uit te voeren.
|
||||
- **Identificatie**: De bypass is gebaseerd op de JWT claims (`role`).
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
# Domain Entities — Unit 03: Availability Module
|
||||
|
||||
Dit document beschrijft de data structuren voor de beschikbaarheidsmodule.
|
||||
|
||||
## 1. AvailabilityResponse (DTO)
|
||||
|
||||
Model voor de publieke status check.
|
||||
|
||||
- **Status**: De huidige `AvailabilityStatus` (Enum uit U01).
|
||||
- **CheckedAt**: Tijdstip van de status check.
|
||||
- **Message**: Optionele tekstuele toelichting (bijv. "Onderhoud gepland tot 14:00").
|
||||
|
||||
## 2. AvailabilitySettings (Configuration)
|
||||
|
||||
Model voor de configuratie in `appsettings.json`.
|
||||
|
||||
- **DefaultStatus**: De status die geretourneerd wordt door de stub.
|
||||
- **MaintenanceMessage**: Bericht dat getoond wordt tijdens onderhoud.
|
||||
- **AllowedRolesForMaintenance**: Lijst van rollen die toegang hebben tijdens onderhoud (default: `Owner`, `Administrator`).
|
||||
|
||||
## 3. AvailabilityState (In-Memory)
|
||||
|
||||
Indien we in de MVP de status dynamisch willen kunnen aanpassen zonder restart:
|
||||
|
||||
- **CurrentStatus**: `AvailabilityStatus`.
|
||||
- **StatusChangedAt**: DateTimeOffset.
|
||||
- **Reason**: String.
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
# Business Logic Model — Unit 03: Availability Module
|
||||
|
||||
Dit document beschrijft de processen voor beschikbaarheidscontrole.
|
||||
|
||||
## 1. Availability Middleware Flow
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Inkomend Request] --> B{Is Endpoint /status?}
|
||||
B -- Ja --> C[Laat door naar Controller]
|
||||
B -- Nee --> D{Check Status via IAvailabilityService}
|
||||
D --> E{Status == Available?}
|
||||
E -- Ja --> C
|
||||
E -- Nee --> F{Status == Maintenance?}
|
||||
F -- Ja --> G{Heeft Rol Admin/Owner?}
|
||||
G -- Ja --> C
|
||||
G -- Nee --> H[Retourneer 503 + ApiErrorResponse]
|
||||
F -- Nee --> H
|
||||
```
|
||||
|
||||
## 2. Status Check Flow
|
||||
|
||||
1. **Client** roept `GET /api/availability/status` aan.
|
||||
2. **AvailabilityController** roept `IAvailabilityService.IsAvailableAsync()` aan.
|
||||
3. **Service** haalt status op (in MVP uit config of in-memory state).
|
||||
4. **Controller** bouwt response:
|
||||
```json
|
||||
{
|
||||
"status": "Available",
|
||||
"checkedAt": "2026-06-12T01:15:00Z",
|
||||
"message": "System is running normally."
|
||||
}
|
||||
```
|
||||
|
||||
## 3. Remote Shutdown Logic (Toekomst)
|
||||
|
||||
Hoewel de MVP een stub gebruikt, is het logic model voorbereid op een externe trigger:
|
||||
- Een administratieve actie zet een vlag in de database/cache.
|
||||
- De `IAvailabilityService` detecteert deze wijziging.
|
||||
- De Middleware reageert direct op alle volgende requests.
|
||||
Reference in New Issue
Block a user