Complete Step 1.1: ValidatePDF Application Layer

Updated PHASENPLAN and ROADMAP to reflect progress on Feature 1 - ValidatePDF (75% complete). Marked Step 1.1 as completed, including MediatR setup, pipeline behaviors (`ValidationBehavior`, `LoggingBehavior`), ValidatePDF feature (Query, Handler, Validator), and DTOs.

Added `DependencyInjection.cs` for Application Layer DI configuration. Introduced `LoggingBehavior` and `ValidationBehavior` for MediatR pipelines. Implemented `ValidatePdfHandler`, `ValidatePdfQuery`, and `ValidatePdfValidator`.

Created DTOs (`ValidatePdfRequest`, `ValidatePdfResponse`) for the ValidatePDF feature. Added unit tests for `ValidatePdfHandler` to verify metadata handling and exception propagation.

Removed unused folder references in `DocumentOperator.Application.csproj`.
This commit is contained in:
OlgunR
2026-06-25 15:23:58 +02:00
parent 62c67d86d4
commit afc0e34312
12 changed files with 367 additions and 48 deletions

View File

@@ -1,6 +1,6 @@
# ?? DocumentOperator - Phasenplan (Feature-Driven Development)
> **Stand:** 17.01.2025 | **Aktuell:** Feature 1 - ValidatePDF (Step 1.1 NEXT) | **Projektdauer:** 6 Wochen
> **Stand:** 17.01.2025 | **Aktuell:** Feature 1 - ValidatePDF (Step 1.2 NEXT) | **Projektdauer:** 6 Wochen
---
@@ -8,7 +8,7 @@
| Woche | Features / Concerns | Status | Fortschritt |
|-------|---------------------|--------|-------------|
| **W1** | Feature 1: ValidatePDF | ?? In Progress | 50% (Infrastructure fertig, Application NEXT) |
| **W1** | Feature 1: ValidatePDF | ?? In Progress | 75% (Foundation + Application fertig, API NEXT) |
| **W2** | Feature 2: ExtractAttachments | ? Geplant | 0% |
| **W2** | Feature 3: ApplyStamp | ? Geplant | 0% |
| **W3** | Feature 4: EmbedCertificate | ? Geplant | 0% |
@@ -42,7 +42,7 @@
## ?? DETAILLIERTER PLAN
### WOCHE 1 - Feature 1: ValidatePDF | ?? In Progress - 50%
### WOCHE 1 - Feature 1: ValidatePDF | ?? In Progress - 75%
**Ziel:** POST /api/v1/documents/validate Endpoint im Swagger testbar
@@ -58,38 +58,38 @@
---
#### ?? Step 1.1: Application Layer (MediatR Setup + ValidatePDF Feature) - **NEXT**
#### ? Step 1.1: Application Layer (MediatR Setup + ValidatePDF Feature) - **ABGESCHLOSSEN**
**Dauer:** ~4 Stunden
**Status:** ? NEXT
**Status:** ? ABGESCHLOSSEN
**Was wird erstellt:**
**Was wurde erstellt:**
1. **MediatR Setup**
- `Application/DependencyInjection.cs` (Service Registration)
- `Application/Common/Behaviors/ValidationBehavior.cs` (FluentValidation Pipeline)
- `Application/Common/Behaviors/LoggingBehavior.cs` (Logging Pipeline)
- ? `Application/DependencyInjection.cs` (Service Registration)
- ? `Application/Common/Behaviors/ValidationBehavior.cs` (FluentValidation Pipeline)
- ? `Application/Common/Behaviors/LoggingBehavior.cs` (Logging Pipeline mit ILogger<T>)
2. **ValidatePDF Feature (Vertical Slice)**
- `Application/Features/Documents/ValidatePdf/ValidatePdfQuery.cs`
- `Application/Features/Documents/ValidatePdf/ValidatePdfHandler.cs`
- `Application/Features/Documents/ValidatePdf/ValidatePdfValidator.cs`
- ? `Application/Features/Documents/ValidatePdf/ValidatePdfQuery.cs`
- ? `Application/Features/Documents/ValidatePdf/ValidatePdfHandler.cs`
- ? `Application/Features/Documents/ValidatePdf/ValidatePdfValidator.cs`
3. **DTOs**
- `Application/Common/DTOs/ValidatePdfRequest.cs`
- `Application/Common/DTOs/ValidatePdfResponse.cs`
- ? `Application/Common/DTOs/ValidatePdfRequest.cs`
- ? `Application/Common/DTOs/ValidatePdfResponse.cs`
4. **Tests**
- `Tests/Unit/Application/Features/ValidatePdf/ValidatePdfHandlerTests.cs`
- ? `Tests/Unit/Application/Features/ValidatePdf/ValidatePdfHandlerTests.cs` (2 Tests - alle grün!)
**Akzeptanzkriterien:**
- ? Build erfolgreich
- ? Tests grün (Handler Tests)
- ? Tests grün (Handler Tests: 2/2 passed)
- ? MediatR Pipeline funktioniert (Validation + Logging)
---
#### ? Step 1.2: API Layer (Endpoint + Exception Middleware)
#### ?? Step 1.2: API Layer (Endpoint + Exception Middleware) - **NEXT**
**Dauer:** ~3 Stunden
**Status:** ? Pending
**Status:** ? NEXT
**Was wird erstellt:**
1. **Exception Middleware**
@@ -418,7 +418,7 @@
| Kategorie | Status | Fortschritt |
|-----------|--------|-------------|
| **Foundation** | ? Abgeschlossen | 100% |
| **Feature 1** | ?? In Progress | 50% |
| **Feature 1** | ?? In Progress | 75% |
| **Feature 2-5** | ? Pending | 0% |
| **Multi-Tenancy** | ? Pending | 0% |
| **Cross-Cutting** | ? Pending | 0% |
@@ -430,19 +430,19 @@
### Heute (17.01.2025)
**Feature 1 - Step 1.1: Application Layer**
**Feature 1 - Step 1.1: Application Layer** ? **ABGESCHLOSSEN**
1. ? MediatR Setup (DependencyInjection.cs)
2. ? ValidationBehavior.cs erstellen
3. ? LoggingBehavior.cs erstellen
3. ? LoggingBehavior.cs erstellen (mit ILogger<T>)
4. ? ValidatePDF Feature erstellen (Query, Handler, Validator)
5. ? DTOs erstellen (Request, Response)
6. ? Tests schreiben (ValidatePdfHandlerTests.cs)
6. ? Tests schreiben (ValidatePdfHandlerTests.cs - 2 Tests grün)
7. ? Build + Tests grün
8. ? ROADMAP + PHASENPLAN aktualisieren
9. ? Commit
**Danach:**
? Feature 1 - Step 1.2: API Layer (Endpoint + Exception Middleware)
? Feature 1 - Step 1.2: API Layer (Endpoint + Exception Middleware) - **NEXT**
---
@@ -455,6 +455,7 @@
| 17.01.2025 | Infrastructure | DevExpressPdfProcessor.ValidateAsync implementiert |
| 17.01.2025 | Tests | DevExpressPdfProcessorTests.cs erstellt (6 Tests) |
| 17.01.2025 | **PHASENPLAN** | ?? **Komplett umstrukturiert** (Feature-basiert + Datum korrigiert 23.06.2026 ? 17.01.2025) |
| 17.01.2025 | **Feature 1 - Step 1.1** | ? **ABGESCHLOSSEN** - Application Layer (MediatR, Behaviors, ValidatePDF Feature, DTOs, Tests - 2/2 grün) |
---

View File

@@ -1,6 +1,6 @@
# ?? DocumentOperator - Project Roadmap (Feature-Driven Development)
> **Last Updated:** 17.01.2025 | **Status:** In Development | **Current Feature:** Feature 1 - ValidatePDF (NEXT)
> **Last Updated:** 17.01.2025 | **Status:** In Development | **Current Feature:** Feature 1 - ValidatePDF (Step 1.2 NEXT)
---
@@ -44,7 +44,7 @@
| Feature | Type | Status | Swagger Testbar? |
|---------|------|--------|------------------|
| **1. ValidatePDF** | Synchron | ?? NEXT | ? |
| **1. ValidatePDF** | Synchron | ?? In Progress (Step 1.2 NEXT) | ? |
| **2. ExtractAttachments** | Synchron | ? Pending | ? |
| **3. ApplyStamp** | Synchron | ? Pending | ? |
| **4. EmbedCertificate** | Synchron | ? Pending | ? |
@@ -61,7 +61,7 @@
---
## ?? FEATURE 1: ValidatePDF (Synchron) - **NEXT**
## ?? FEATURE 1: ValidatePDF (Synchron) - **In Progress**
**Was macht dieses Feature?**
- Client sendet PDF als Base64 (JSON)
@@ -77,7 +77,7 @@ Response: { "pageCount": 5, "fileSizeBytes": 1024, "pdfVersion": "1.4", "hasAtta
---
### ? Step 1.0: Foundation (bereits erledigt!)
### ? Step 1.0: Foundation (ABGESCHLOSSEN)
**Was wurde bereits erstellt:**
- ? Domain Layer (Exceptions, Enums, Value Objects)
@@ -92,36 +92,36 @@ Response: { "pageCount": 5, "fileSizeBytes": 1024, "pdfVersion": "1.4", "hasAtta
---
### ?? Step 1.1: Application Layer (MediatR Setup + ValidatePDF Feature) - **NEXT**
### ? Step 1.1: Application Layer (MediatR Setup + ValidatePDF Feature) - **ABGESCHLOSSEN**
**Ziel:** MediatR + FluentValidation + ValidatePDF Handler
**Was wird erstellt:**
**Was wurde erstellt:**
#### 1.1.1: MediatR Setup
- **Datei:** `Application/DependencyInjection.cs`
- ? **Datei:** `Application/DependencyInjection.cs`
- Registriert MediatR
- Registriert FluentValidation
- Registriert Pipeline Behaviors (Validation + Logging)
#### 1.1.2: Pipeline Behaviors
- **Datei:** `Application/Common/Behaviors/ValidationBehavior.cs`
- ? **Datei:** `Application/Common/Behaviors/ValidationBehavior.cs`
- Führt FluentValidation automatisch aus (vor jedem Handler)
- Wirft `ValidationException` bei Fehler
- **Datei:** `Application/Common/Behaviors/LoggingBehavior.cs`
- ? **Datei:** `Application/Common/Behaviors/LoggingBehavior.cs`
- Loggt jeden Request (mit Performance-Tracking)
- Nutzt Serilog
- Nutzt `ILogger<T>` (Clean Architecture konform!)
#### 1.1.3: ValidatePDF Feature (Vertical Slice)
- **Ordner:** `Application/Features/Documents/ValidatePdf/`
- ? **Ordner:** `Application/Features/Documents/ValidatePdf/`
- **Datei:** `ValidatePdfQuery.cs`
- ? **Datei:** `ValidatePdfQuery.cs`
```csharp
public record ValidatePdfQuery(Base64String PdfContent) : IRequest<PdfMetadata>;
```
- **Datei:** `ValidatePdfHandler.cs`
- ? **Datei:** `ValidatePdfHandler.cs`
```csharp
public class ValidatePdfHandler : IRequestHandler<ValidatePdfQuery, PdfMetadata>
{
@@ -135,7 +135,7 @@ Response: { "pageCount": 5, "fileSizeBytes": 1024, "pdfVersion": "1.4", "hasAtta
}
```
- **Datei:** `ValidatePdfValidator.cs`
- ? **Datei:** `ValidatePdfValidator.cs`
```csharp
public class ValidatePdfValidator : AbstractValidator<ValidatePdfQuery>
{
@@ -147,14 +147,14 @@ Response: { "pageCount": 5, "fileSizeBytes": 1024, "pdfVersion": "1.4", "hasAtta
```
#### 1.1.4: DTOs
- **Ordner:** `Application/Common/DTOs/`
- ? **Ordner:** `Application/Common/DTOs/`
- **Datei:** `ValidatePdfRequest.cs`
- ? **Datei:** `ValidatePdfRequest.cs`
```csharp
public record ValidatePdfRequest(string Base64Pdf);
```
- **Datei:** `ValidatePdfResponse.cs`
- ? **Datei:** `ValidatePdfResponse.cs`
```csharp
public record ValidatePdfResponse(
int PageCount,
@@ -166,9 +166,9 @@ Response: { "pageCount": 5, "fileSizeBytes": 1024, "pdfVersion": "1.4", "hasAtta
```
#### 1.1.5: Tests
- **Datei:** `Tests/Unit/Application/Features/ValidatePdf/ValidatePdfHandlerTests.cs`
- Test: `Handle_ValidPdf_ReturnsPdfMetadata`
- Test: `Handle_NullPdfContent_ThrowsValidationException`
- ? **Datei:** `Tests/Unit/Application/Features/ValidatePdf/ValidatePdfHandlerTests.cs`
- ? Test: `Handle_ValidPdf_ReturnsPdfMetadata`
- ? Test: `Handle_PdfProcessorThrowsException_PropagatesException`
**Akzeptanzkriterien:**
- ? Build erfolgreich
@@ -177,7 +177,7 @@ Response: { "pageCount": 5, "fileSizeBytes": 1024, "pdfVersion": "1.4", "hasAtta
---
### ?? Step 1.2: API Layer (Endpoint + Exception Middleware)
### ?? Step 1.2: API Layer (Endpoint + Exception Middleware) - **NEXT**
**Ziel:** HTTP Endpoint + zentrale Exception Handling
@@ -898,10 +898,18 @@ DocumentOperator.Tests/
- ? IPdfProcessor Interface
- ? DevExpressPdfProcessor.ValidateAsync (mit Tests!)
- **Application Layer:**
- ? DependencyInjection.cs (MediatR + FluentValidation)
- ? ValidationBehavior.cs (FluentValidation Pipeline)
- ? LoggingBehavior.cs (ILogger<T> Pipeline)
- ? ValidatePDF Feature (Query, Handler, Validator)
- ? DTOs (ValidatePdfRequest, ValidatePdfResponse)
- ? Tests (ValidatePdfHandlerTests - 2 Tests grün)
### ?? In Progress
- **Feature 1: ValidatePDF**
- ? Step 1.1: Application Layer (MediatR Setup + ValidatePDF Feature) - **NEXT**
- ? Step 1.2: API Layer (Endpoint + Exception Middleware) - **NEXT**
### ? Pending
@@ -995,6 +1003,7 @@ DocumentOperator.Tests/
| 17.01.2025 | Tests | DevExpressPdfProcessorTests.cs erstellt (6 Tests) |
| 17.01.2025 | **ROADMAP** | ?? **Komplett umstrukturiert** (Feature-Driven Development!) |
| 17.01.2025 | **PHASENPLAN** | ?? **Komplett umstrukturiert** (Feature-basiert + Datum korrigiert) |
| 17.01.2025 | **Feature 1 - Step 1.1** | ? **ABGESCHLOSSEN** - Application Layer (MediatR, Behaviors, ValidatePDF Feature, DTOs, Tests) |
---