Compare commits

..

3 Commits

Author SHA1 Message Date
OlgunR
87d7262d0a Replace Logging with Serilog; add new configurations
Replaced the `Logging` configuration in both `appsettings.json`
and `appsettings.Development.json` with Serilog, enabling
structured logging with configurable sinks and enrichment.

Added `DocumentOperatorSettings` to manage temporary files
and logging details. Introduced `RedisSettings` for Redis
integration, including connection string and cache settings.

Added `ApiKeySettings` to support tenant-specific API key
validation with detailed configuration for each tenant.

These changes improve logging, caching, and configuration
management for better maintainability and extensibility.
2026-06-16 09:28:39 +02:00
OlgunR
297f760e7f Refactor project structure and add new features
Restructured project files across all layers:
- Removed `Controllers` folder reference from `DocumentOperator.API.csproj`.
- Added folder structure to `DocumentOperator.Application`, `DocumentOperator.Domain`, and `DocumentOperator.Infrastructure` projects for better organization.

Introduced new API configurations and middleware:
- Added `SerilogConfiguration` and `SwaggerConfiguration` classes.
- Added `ExceptionHandlingMiddleware`, `RequestLoggingMiddleware`, and `TenantResolutionMiddleware`.

Implemented new document processing feature:
- Added `ProcessDocumentCommand`, `ProcessDocumentHandler`, and `ProcessDocumentValidator` classes in the application layer.
2026-06-15 16:21:43 +02:00
OlgunR
b25d593771 Add dependencies for API, Application, and Infrastructure
Added `Asp.Versioning.Http`, `Microsoft.Extensions.Caching.StackExchangeRedis`, and `Serilog.AspNetCore` to `DocumentOperator.API` for API versioning, Redis caching, and structured logging.

Added `Ardalis.Result`, `FluentValidation`, `FluentValidation.DependencyInjectionExtensions`, and `MediatR` to `DocumentOperator.Application` for result handling, validation, and mediator pattern support.

Added `DevExpress.Pdf.Core` and `Microsoft.Extensions.Options.ConfigurationExtensions` to `DocumentOperator.Infrastructure` for PDF processing and configuration management.
2026-06-15 11:00:22 +02:00
15 changed files with 188 additions and 11 deletions

View File

@@ -0,0 +1,6 @@
namespace DocumentOperator.API.Configuration
{
public class SerilogConfiguration
{
}
}

View File

@@ -0,0 +1,6 @@
namespace DocumentOperator.API.Configuration
{
public class SwaggerConfiguration
{
}
}

View File

@@ -7,6 +7,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Asp.Versioning.Http" Version="8.1.1" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="8.0.28" />
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>
@@ -16,8 +19,4 @@
<ProjectReference Include="..\DocumentOperator.Infrastructure\DocumentOperator.Infrastructure.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,6 @@
namespace DocumentOperator.API.Endpoints.v1
{
public class DocumentEndpoints
{
}
}

View File

@@ -0,0 +1,6 @@
namespace DocumentOperator.API.Middleware
{
public class ExceptionHandlingMiddleware
{
}
}

View File

@@ -0,0 +1,6 @@
namespace DocumentOperator.API.Middleware
{
public class RequestLoggingMiddleware
{
}
}

View File

@@ -0,0 +1,6 @@
namespace DocumentOperator.API.Middleware
{
public class TenantResolutionMiddleware
{
}
}

View File

@@ -1,8 +1,16 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
"Serilog": {
"MinimumLevel": {
"Default": "Debug"
}
},
"DocumentOperatorSettings": {
"TempFolderPath": "C:\\Temp\\DocumentOperator\\Dev",
"EnableDetailedLogging": true
},
"RedisSettings": {
"ConnectionString": "localhost:6379"
}
}

View File

@@ -5,5 +5,62 @@
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
"AllowedHosts": "*",
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.AspNetCore": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "Console",
"Args": {
"outputTemplate": "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"
}
},
{
"Name": "File",
"Args": {
"path": "Logs/log-.txt",
"rollingInterval": "Day",
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj} {Properties:j}{NewLine}{Exception}"
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
},
"DocumentOperatorSettings": {
"TempFolderPath": "C:\\Temp\\DocumentOperator",
"TempFileRetentionHours": 24,
"MaxPdfSizeMB": 50,
"EnableDetailedLogging": true
},
"RedisSettings": {
"ConnectionString": "localhost:6379",
"InstanceName": "DocumentOperator:",
"CacheExpirationMinutes": 60
},
"ApiKeySettings": {
"EnableValidation": true,
"Keys": {
"customer-a-key-12345": {
"TenantId": "customer-a",
"TenantName": "Customer A GmbH",
"IsActive": true
},
"customer-b-key-67890": {
"TenantId": "customer-b",
"TenantName": "Customer B AG",
"IsActive": true
}
}
}
}

View File

@@ -6,8 +6,28 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Ardalis.Result" Version="10.1.0" />
<PackageReference Include="FluentValidation" Version="12.1.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.1.1" />
<PackageReference Include="MediatR" Version="14.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DocumentOperator.Domain\DocumentOperator.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Common\Interfaces\" />
<Folder Include="Common\Behaviors\" />
<Folder Include="Common\DTOs\" />
<Folder Include="Common\Mappings\" />
<Folder Include="DependencyInjection\" />
<Folder Include="Features\Documents\ExtractAttachments\" />
<Folder Include="Features\Documents\ConcatenatePdfs\" />
<Folder Include="Features\Documents\ApplyStamp\" />
<Folder Include="Features\Documents\EmbedCertificate\" />
<Folder Include="Features\Documents\ValidatePdf\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DocumentOperator.Application.Features.Documents.ProcessDocument
{
internal class ProcessDocumentCommand
{
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DocumentOperator.Application.Features.Documents.ProcessDocument
{
internal class ProcessDocumentHandler
{
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DocumentOperator.Application.Features.Documents.ProcessDocument
{
internal class ProcessDocumentValidator
{
}
}

View File

@@ -6,4 +6,12 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Common\Exceptions\" />
<Folder Include="Common\Results\" />
<Folder Include="Constants\" />
<Folder Include="Models\Enums\" />
<Folder Include="Models\ValueObjects\" />
</ItemGroup>
</Project>

View File

@@ -6,9 +6,22 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DevExpress.Pdf.Core" Version="25.2.8" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DocumentOperator.Application\DocumentOperator.Application.csproj" />
<ProjectReference Include="..\DocumentOperator.Domain\DocumentOperator.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Configuration\" />
<Folder Include="DependencyInjection\" />
<Folder Include="Services\FileStorage\" />
<Folder Include="Services\DocumentValidation\" />
<Folder Include="Services\PdfProcessing\" />
</ItemGroup>
</Project>