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 - 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) |
---