Compare commits

...

26 Commits

Author SHA1 Message Date
b57de5a97d Add metadata and XML doc generation to project
Enhanced the project configuration by enabling XML documentation file generation with the `<GenerateDocumentationFile>` property. Added metadata properties such as `<PackageId>`, `<Authors>`, `<Company>`, `<Product>`, and versioning details to prepare the project for packaging and distribution. Configured the `<DocumentationFile>` property to specify the output path for the generated documentation.
2026-10-10 21:21:03 +02:00
2513d0f5b6 Add IIS publish profiles and update project file
Added `IISProfileNet8.pubxml` to define publish settings for the
application, including target framework `net8.0`, runtime
identifier `win-x64`, and deployment configuration for IIS.

Included `IISProfileNet8.pubxml.user` for user-specific metadata
such as publish history. Updated `DigitalData.TaskFlow.API.csproj`
to track the `.user` file under the `<None>` item group.
2026-10-10 21:18:49 +02:00
70e82567d8 Refactor workflows and improve API responses
- Added `BackToPerMethodId` constant and updated validation rules in `CloseWorkflowCommandValidator`.
- Refactored `GetWorkflowsQueryHandler` for simpler `hasListingData` logic.
- Replaced strongly-typed properties with `JsonElement` in `ContractsSourceBlock` and `FerdinandSourceBlock`.
- Updated `WorkflowListingReadModel` to use smaller data types for efficiency.
- Refactored `WorkflowRepository` to use JSON-based data retrieval and parsing.
- Introduced `MetaOnlyResponse` and `WorkflowsResponse` for consistent API responses.
- Updated `DocumentsController` and `WorkflowsController` to use new response types.
- Added `ApiKeyAuthMiddleware` for API key validation and integrated it into the middleware pipeline.
- Refactored `ExceptionHandlingMiddleware` to use `MetaOnlyResponse` for error handling.
- Performed general cleanup and modernization for improved readability and maintainability.
2026-10-10 20:47:31 +02:00
600374a6f0 feat(api): integrate Serilog bootstrap and in-app log viewer 2026-10-10 16:53:37 +02:00
1754aa64a2 chore(api): configure Serilog settings and logging packages 2026-10-10 16:53:03 +02:00
1c2c9cf3b8 Remove Microsoft.OpenApi package reference
The `Microsoft.OpenApi` package reference (version 3.10.2) was removed from the `DigitalData.TaskFlow.API.csproj` file. This change suggests that the project no longer requires this dependency, potentially due to a shift in functionality or the use of an alternative library.
2026-10-10 16:26:48 +02:00
41d49e4b89 fix(api): fail fast on unexpected null document payload 2026-10-10 16:12:56 +02:00
b6aec7a16b feat(infrastructure): add DB options and workflow close outcome evaluation 2026-10-10 16:12:17 +02:00
be41adc0f3 feat(application): enforce validation and API error mapping rules 2026-10-10 16:12:05 +02:00
f8e877ac06 feat(domain): add close workflow outcome semantics 2026-10-10 16:11:27 +02:00
c5a43ef2a0 feat(api): surface 403/404/409 responses via middleware and docs 2026-10-10 14:58:01 +02:00
315dee2f6c feat(application): map closing outcomes to API exceptions 2026-10-10 14:57:56 +02:00
3126f025be Add workflow and document APIs, middleware, and Swagger
Introduced `CloseWorkflowRequest` for closing workflows.
Added `DocumentsController` for document downloads and
`WorkflowsController` for workflow retrieval and closing.

Implemented `ExceptionHandlingMiddleware` for global exception
handling with structured API responses.

Enhanced Swagger configuration with metadata and production
support. Added `Scalar.AspNetCore` for API reference mapping.

Updated project dependencies and improved API documentation.
2026-10-10 13:50:26 +02:00
b44be4f9e2 Enhance workflow handling and enforce stricter exceptions
Enhanced `GetWorkflowsQueryHandler` to validate listing data
in workflow sources and return appropriate responses. Updated
`DocumentRepository.GetAsync` and `WorkflowRepository.CloseAsync`
to throw `NotSupportedException` for unimplemented functionality,
ensuring these methods cannot be used until finalized. Added
`DigitalData.TaskFlow.Domain.Enums` dependency to support new
logic in `GetWorkflowsQueryHandler`.
2026-10-10 11:34:17 +02:00
88456e7f87 feat(infrastructure): add EF Core context and repository implementations 2026-10-10 11:18:27 +02:00
1fbcc2d197 refactor(application): centralize API envelope creation and command mapping 2026-10-10 11:18:21 +02:00
b3b52a8c48 Update documentation for repo structure and DB practices
Added detailed sections to `AGENTS.md`:
- "Repo Snapshot (verified)" to describe the .NET 8 solution structure and current implementation state.
- "High-value Commands" with instructions for building and running the solution.
- "Architecture That Matters During Edits" to outline dependency direction, key libraries, and response contract.
- "Current Implementation Gaps (easy to miss)" to highlight incomplete implementations and areas needing verification.
- "Config/Security Gotcha" to warn about sensitive data in `appsettings.json`.

Updated `README.md`:
- Added "Wichtiger Hinweis zu DB-Spaltennamen" to explain DB column mapping practices and emphasize the need for final verification of stored procedure result sets.
- Clarified that DB field names are mapped only in the Infrastructure layer, not in Domain models.
2026-10-10 11:15:10 +02:00
4fa57efca4 docs: add layer readmes for architecture boundaries 2026-10-09 23:06:49 +02:00
ed06e460c3 feat(application): add workflow and document request handlers 2026-10-09 23:06:05 +02:00
4f0718a4f5 feat(application): add CQRS pipeline infrastructure and repository contracts 2026-10-09 23:06:00 +02:00
986d0aa256 feat(domain): add workflow API core models and meta codes 2026-10-09 23:05:47 +02:00
b0fd71e193 Add MediatR, FluentValidation, AutoMapper, and EF Core
Updated application and infrastructure layers to include MediatR, FluentValidation, AutoMapper, and Entity Framework Core.

- Added new dependencies to `DigitalData.TaskFlow.Application.csproj` and `DigitalData.TaskFlow.Infrastructure.csproj` for MediatR, FluentValidation, AutoMapper, and EF Core.
- Configured MediatR with options and license key support.
- Registered validators and AutoMapper profiles in the application layer.
- Introduced `MediatROptions` and `SwaggerOptions` for configuration.
- Updated `appsettings.json` with connection strings and configuration sections for MediatR and Swagger.
- Replaced placeholder comments in `DependencyInjection` classes with actual service registrations.
- Upgraded `Swashbuckle.AspNetCore` and added `FluentValidation.AspNetCore` for API validation.
2026-10-09 16:29:58 +02:00
ee107d74c4 Add DI setup for modular architecture
Introduced `DependencyInjection.cs` in Application and Infrastructure layers to centralize service registration. Updated project files to include necessary package references (`Microsoft.Extensions.Configuration.Abstractions` and `Microsoft.Extensions.DependencyInjection.Abstractions`) and project dependencies between layers. Integrated service registration in `Program.cs` to enable modular architecture for the API.
2026-10-09 15:24:17 +02:00
41a395af99 Add Domain, Application, and Infrastructure projects
Added three new projects: `DigitalData.TaskFlow.Domain`,
`DigitalData.TaskFlow.Application`, and
`DigitalData.TaskFlow.Infrastructure` to the solution.
Updated the solution file to include their paths, GUIDs,
build configurations, and nested structure.

Each project targets `.NET 8.0`, uses `Microsoft.NET.Sdk`,
and enables implicit usings and nullable reference types.
Introduced an `ExtensibilityGlobals` section with a
`SolutionGuid` for better solution management.
2026-10-09 15:18:32 +02:00
3c6d1b14de Add initial ASP.NET Core project structure
This commit introduces the initial setup for the DigitalData.TaskFlow solution:
- Added `DigitalData.TaskFlow.sln` to organize the project structure into `src`, `presentation`, `core`, and `infrastructure` folders.
- Created `DigitalData.TaskFlow.API` project targeting .NET 8.0 with nullable reference types and Swagger/OpenAPI support.
- Added `Program.cs` to configure the ASP.NET Core application with services, middleware, and Swagger UI.
- Added `launchSettings.json` for development profiles and environment variables.
- Added `appsettings.json` and `appsettings.Development.json` for logging and configuration.
2026-10-09 15:14:33 +02:00
1428d989aa Update .gitignore to exclude specific files and patterns
Added `FodyWeavers.xsd` to the `.gitignore` file to prevent it
from being tracked by version control. Also added a new `/ignore`
entry to exclude files or directories matching this pattern.
These changes help avoid committing unnecessary or sensitive files.
2026-10-09 15:13:01 +02:00
64 changed files with 2537 additions and 0 deletions

1
.gitignore vendored
View File

@@ -414,3 +414,4 @@ FodyWeavers.xsd
# Built Visual Studio Code Extensions
*.vsix
/ignore

30
AGENTS.md Normal file
View File

@@ -0,0 +1,30 @@
# AGENTS
## Repo Snapshot (verified)
- This is a .NET 8 solution with 4 projects: API (`src/presentation/DigitalData.TaskFlow.API`), Application, Domain, Infrastructure.
- `Program.cs` only wires DI + Swagger + `MapControllers`; there are currently no controller classes, so no HTTP endpoints are exposed yet.
- There is no test project in the repository right now.
## High-value Commands
- Restore/build whole solution from repo root:
- `dotnet restore DigitalData.TaskFlow.sln`
- `dotnet build DigitalData.TaskFlow.sln`
- Run API project:
- `dotnet run --project src/presentation/DigitalData.TaskFlow.API/DigitalData.TaskFlow.API.csproj`
- Focused build for one layer:
- `dotnet build src/core/DigitalData.TaskFlow.Application/DigitalData.TaskFlow.Application.csproj`
## Architecture That Matters During Edits
- Dependency direction is strict: `API -> Application -> Domain`; `Infrastructure` depends on `Application` + `Domain` and is injected by API.
- Application layer uses MediatR + FluentValidation pipeline behavior (`ValidationBehavior<,>`) + AutoMapper profile (`ApplicationMappingProfile`).
- Response contract is centralized in Domain `ApiEnvelope<T>` + `MetaEntry`; use `ApiEnvelopeFactory` for consistent `meta.code/message` mapping.
- Infrastructure registers `TaskFlowDbContext` and repository interfaces in `DependencyInjection.cs`; missing `ConnectionStrings:TaskFlowDb` throws at startup.
- DB row-shape models (for procedures/views) live in Infrastructure (`Persistence/Models`), not in Domain.
## Current Implementation Gaps (easy to miss)
- `DocumentRepository` and `WorkflowRepository.CloseAsync` are still baseline/stub implementations returning placeholder data.
- `WorkflowListingReadModel` column mapping is based on read-only DB metadata and observed SP result sets; final shape must be re-verified from DB metadata (`sp_describe_first_result_set` or equivalent) before production hardening.
- `Swagger:EnabledInProduction` exists in config model but is not used in `Program.cs` yet.
## Config/Security Gotcha
- `src/presentation/DigitalData.TaskFlow.API/appsettings.json` currently contains a concrete SQL connection string and a MediatR license key; treat this file as sensitive and avoid propagating those values in docs, logs, or commits.

60
DigitalData.TaskFlow.sln Normal file
View File

@@ -0,0 +1,60 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "presentation", "presentation", "{BC4CBCBB-D810-4AA5-855C-C9E8FDADA008}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{06231918-0EB3-49B0-B6CA-2A441D58B02F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "infrastructure", "infrastructure", "{FD60D353-ABC5-4C93-92E5-069EE28B452E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.TaskFlow.API", "src\presentation\DigitalData.TaskFlow.API\DigitalData.TaskFlow.API.csproj", "{DAECF4CE-7AE3-4DBE-8D32-F5F2B4EC8AEC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.TaskFlow.Domain", "src\core\DigitalData.TaskFlow.Domain\DigitalData.TaskFlow.Domain.csproj", "{EA5328FE-D015-4DAF-838D-57B4218ADA15}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.TaskFlow.Application", "src\core\DigitalData.TaskFlow.Application\DigitalData.TaskFlow.Application.csproj", "{104944BD-55C2-458C-B0C6-1B41C84B2C08}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.TaskFlow.Infrastructure", "src\infrastructure\DigitalData.TaskFlow.Infrastructure\DigitalData.TaskFlow.Infrastructure.csproj", "{D4459BE4-B483-46E8-9052-523646D24B90}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DAECF4CE-7AE3-4DBE-8D32-F5F2B4EC8AEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DAECF4CE-7AE3-4DBE-8D32-F5F2B4EC8AEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DAECF4CE-7AE3-4DBE-8D32-F5F2B4EC8AEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DAECF4CE-7AE3-4DBE-8D32-F5F2B4EC8AEC}.Release|Any CPU.Build.0 = Release|Any CPU
{EA5328FE-D015-4DAF-838D-57B4218ADA15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA5328FE-D015-4DAF-838D-57B4218ADA15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA5328FE-D015-4DAF-838D-57B4218ADA15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA5328FE-D015-4DAF-838D-57B4218ADA15}.Release|Any CPU.Build.0 = Release|Any CPU
{104944BD-55C2-458C-B0C6-1B41C84B2C08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{104944BD-55C2-458C-B0C6-1B41C84B2C08}.Debug|Any CPU.Build.0 = Debug|Any CPU
{104944BD-55C2-458C-B0C6-1B41C84B2C08}.Release|Any CPU.ActiveCfg = Release|Any CPU
{104944BD-55C2-458C-B0C6-1B41C84B2C08}.Release|Any CPU.Build.0 = Release|Any CPU
{D4459BE4-B483-46E8-9052-523646D24B90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D4459BE4-B483-46E8-9052-523646D24B90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4459BE4-B483-46E8-9052-523646D24B90}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4459BE4-B483-46E8-9052-523646D24B90}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{BC4CBCBB-D810-4AA5-855C-C9E8FDADA008} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{06231918-0EB3-49B0-B6CA-2A441D58B02F} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{FD60D353-ABC5-4C93-92E5-069EE28B452E} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{DAECF4CE-7AE3-4DBE-8D32-F5F2B4EC8AEC} = {BC4CBCBB-D810-4AA5-855C-C9E8FDADA008}
{EA5328FE-D015-4DAF-838D-57B4218ADA15} = {06231918-0EB3-49B0-B6CA-2A441D58B02F}
{104944BD-55C2-458C-B0C6-1B41C84B2C08} = {06231918-0EB3-49B0-B6CA-2A441D58B02F}
{D4459BE4-B483-46E8-9052-523646D24B90} = {FD60D353-ABC5-4C93-92E5-069EE28B452E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {95DC4052-26B6-44D1-8B13-9D934628204D}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,48 @@
using FluentValidation;
using MediatR;
namespace DigitalData.TaskFlow.Application.Common.Behaviors;
/// <summary>
/// Runs FluentValidation validators before a MediatR request reaches its handler.
/// </summary>
/// <typeparam name="TRequest">Request type.</typeparam>
/// <typeparam name="TResponse">Response type.</typeparam>
public sealed class ValidationBehavior<TRequest, TResponse>(IEnumerable<IValidator<TRequest>> validators)
: IPipelineBehavior<TRequest, TResponse>
where TRequest : notnull
{
/// <summary>
/// Validates the request and continues the pipeline when validation succeeds.
/// </summary>
/// <param name="request">Current request instance.</param>
/// <param name="next">Next pipeline delegate.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Handler response when validation passes.</returns>
/// <exception cref="ValidationException">Thrown when one or more validation errors are found.</exception>
public async Task<TResponse> Handle(
TRequest request,
RequestHandlerDelegate<TResponse> next,
CancellationToken cancellationToken)
{
if (!validators.Any())
{
return await next(cancellationToken);
}
var context = new ValidationContext<TRequest>(request);
var validationResults = await Task.WhenAll(validators.Select(v => v.ValidateAsync(context, cancellationToken)));
var failures = validationResults
.SelectMany(r => r.Errors)
.Where(f => f is not null)
.ToList();
if (failures.Count != 0)
{
throw new ValidationException(failures);
}
return await next(cancellationToken);
}
}

View File

@@ -0,0 +1,32 @@
using DigitalData.TaskFlow.Domain.Enums;
namespace DigitalData.TaskFlow.Application.Common.Exceptions;
/// <summary>
/// Represents an API-facing exception that carries HTTP and domain meta information.
/// </summary>
public class ApiException : Exception
{
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
/// <param name="statusCode">HTTP status code to return.</param>
/// <param name="metaCode">Domain meta code to return.</param>
/// <param name="message">Response message.</param>
public ApiException(int statusCode, MetaCode metaCode, string message)
: base(message)
{
StatusCode = statusCode;
MetaCode = metaCode;
}
/// <summary>
/// Gets the HTTP status code.
/// </summary>
public int StatusCode { get; }
/// <summary>
/// Gets the domain meta code.
/// </summary>
public MetaCode MetaCode { get; }
}

View File

@@ -0,0 +1,19 @@
using DigitalData.TaskFlow.Domain.Enums;
namespace DigitalData.TaskFlow.Application.Common.Exceptions;
/// <summary>
/// Represents a 409 API exception.
/// </summary>
public sealed class ConflictApiException : ApiException
{
/// <summary>
/// Initializes a new instance of the <see cref="ConflictApiException"/> class.
/// </summary>
/// <param name="metaCode">Domain meta code to return.</param>
/// <param name="message">Response message.</param>
public ConflictApiException(MetaCode metaCode, string message)
: base(409, metaCode, message)
{
}
}

View File

@@ -0,0 +1,18 @@
using DigitalData.TaskFlow.Domain.Enums;
namespace DigitalData.TaskFlow.Application.Common.Exceptions;
/// <summary>
/// Represents a 403 API exception.
/// </summary>
public sealed class ForbiddenApiException : ApiException
{
/// <summary>
/// Initializes a new instance of the <see cref="ForbiddenApiException"/> class.
/// </summary>
/// <param name="message">Response message.</param>
public ForbiddenApiException(string message)
: base(403, MetaCode.NoAccess, message)
{
}
}

View File

@@ -0,0 +1,18 @@
using DigitalData.TaskFlow.Domain.Enums;
namespace DigitalData.TaskFlow.Application.Common.Exceptions;
/// <summary>
/// Represents a 400 API exception.
/// </summary>
public sealed class InvalidRequestApiException : ApiException
{
/// <summary>
/// Initializes a new instance of the <see cref="InvalidRequestApiException"/> class.
/// </summary>
/// <param name="message">Response message.</param>
public InvalidRequestApiException(string message)
: base(400, MetaCode.InvalidRequest, message)
{
}
}

View File

@@ -0,0 +1,18 @@
using DigitalData.TaskFlow.Domain.Enums;
namespace DigitalData.TaskFlow.Application.Common.Exceptions;
/// <summary>
/// Represents a 404 API exception.
/// </summary>
public sealed class NotFoundApiException : ApiException
{
/// <summary>
/// Initializes a new instance of the <see cref="NotFoundApiException"/> class.
/// </summary>
/// <param name="message">Response message.</param>
public NotFoundApiException(string message)
: base(404, MetaCode.NotFound, message)
{
}
}

View File

@@ -0,0 +1,49 @@
using DigitalData.TaskFlow.Domain.Common;
using DigitalData.TaskFlow.Domain.Enums;
namespace DigitalData.TaskFlow.Application.Common.Factories;
/// <summary>
/// Creates standard API envelope instances with centralized meta code/message handling.
/// </summary>
public static class ApiEnvelopeFactory
{
/// <summary>
/// Creates a successful or business-result response envelope.
/// </summary>
/// <typeparam name="T">Payload type.</typeparam>
/// <param name="data">Payload data.</param>
/// <param name="code">Business result code.</param>
/// <param name="message">Optional custom message. If not supplied, a default message is resolved from <paramref name="code"/>.</param>
/// <returns>Response envelope containing meta and payload.</returns>
public static ApiEnvelope<T> Create<T>(T data, MetaCode code = MetaCode.Ok, string? message = null)
{
return new ApiEnvelope<T>
{
Meta =
[
new MetaEntry
{
Code = (int)code,
Message = message ?? ResolveDefaultMessage(code)
}
],
Data = data
};
}
private static string ResolveDefaultMessage(MetaCode code)
{
return code switch
{
MetaCode.Ok => "OK",
MetaCode.NoOpenWorkflows => "Keine offenen Workflows",
MetaCode.NoAccess => "Kein Zugriff",
MetaCode.InvalidRequest => "Ungultiger Request",
MetaCode.InternalError => "Interner Fehler",
MetaCode.NotFound => "Vorgang nicht gefunden",
MetaCode.AlreadyClosed => "Vorgang bereits abgeschlossen",
_ => "Interner Fehler"
};
}
}

View File

@@ -0,0 +1,17 @@
using DigitalData.TaskFlow.Domain.Documents;
namespace DigitalData.TaskFlow.Application.Common.Interfaces;
/// <summary>
/// Defines document-specific data access operations.
/// </summary>
public interface IDocumentRepository : IRepository
{
/// <summary>
/// Gets document binary content for the given document identifier.
/// </summary>
/// <param name="id">Document identifier.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Binary document payload when found; otherwise <see langword="null"/>.</returns>
Task<DocumentBinaryResult?> GetAsync(string id, CancellationToken cancellationToken);
}

View File

@@ -0,0 +1,8 @@
namespace DigitalData.TaskFlow.Application.Common.Interfaces;
/// <summary>
/// Defines a marker contract for repository abstractions in the application layer.
/// </summary>
public interface IRepository
{
}

View File

@@ -0,0 +1,34 @@
using DigitalData.TaskFlow.Domain.Closing;
using DigitalData.TaskFlow.Domain.Workflows;
namespace DigitalData.TaskFlow.Application.Common.Interfaces;
/// <summary>
/// Defines workflow-specific data access operations for reading and closing workflow items.
/// </summary>
public interface IWorkflowRepository : IRepository
{
/// <summary>
/// Gets grouped workflow data for the given WISAG user identifier.
/// </summary>
/// <param name="wisagId">WISAG user identifier.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Workflow data grouped by source.</returns>
Task<WorkflowSourcesResponse> GetAsync(int wisagId, CancellationToken cancellationToken);
/// <summary>
/// Applies a closing decision to a workflow process.
/// </summary>
/// <param name="wisagId">WISAG user identifier.</param>
/// <param name="source">Source system name.</param>
/// <param name="processId">Process identifier.</param>
/// <param name="decision">Closing decision payload.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Closing operation result.</returns>
Task<CloseWorkflowResult> CloseAsync(
int wisagId,
string source,
int processId,
CloseWorkflowDecision decision,
CancellationToken cancellationToken);
}

View File

@@ -0,0 +1,19 @@
using AutoMapper;
using DigitalData.TaskFlow.Application.Features.Workflows.Commands.CloseWorkflow;
using DigitalData.TaskFlow.Domain.Closing;
namespace DigitalData.TaskFlow.Application.Common.Mappings;
/// <summary>
/// Defines AutoMapper configuration for application-level mappings.
/// </summary>
public sealed class ApplicationMappingProfile : Profile
{
/// <summary>
/// Initializes mapping configuration.
/// </summary>
public ApplicationMappingProfile()
{
CreateMap<CloseWorkflowCommand, CloseWorkflowDecision>();
}
}

View File

@@ -0,0 +1,39 @@
using DigitalData.TaskFlow.Application.Options;
using FluentValidation;
using MediatR;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System.Reflection;
using DigitalData.TaskFlow.Application.Common.Behaviors;
namespace DigitalData.TaskFlow.Application;
public static class DependencyInjection
{
public static IServiceCollection AddApplicationServices(this IServiceCollection services, IConfiguration configuration)
{
var mediatROptions = configuration
.GetSection(MediatROptions.SectionName)
.Get<MediatROptions>();
services
.AddOptions<MediatROptions>()
.Bind(configuration.GetSection(MediatROptions.SectionName));
services.AddMediatR(config =>
{
config.RegisterServicesFromAssembly(typeof(DependencyInjection).Assembly);
if (!string.IsNullOrWhiteSpace(mediatROptions?.LuckyPennySoftLicenseKey))
{
config.LicenseKey = mediatROptions.LuckyPennySoftLicenseKey;
}
});
services.AddValidatorsFromAssembly(typeof(DependencyInjection).Assembly);
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidationBehavior<,>));
services.AddAutoMapper(_ => { }, Assembly.GetExecutingAssembly());
return services;
}
}

View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="16.2.0" />
<PackageReference Include="FluentValidation" Version="12.1.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.1.1" />
<PackageReference Include="MediatR" Version="14.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="11.0.0-rc.1.26425.128" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="11.0.0-rc.1.26425.128" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="11.0.0-rc.1.26425.128" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DigitalData.TaskFlow.Domain\DigitalData.TaskFlow.Domain.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,56 @@
using DigitalData.TaskFlow.Application.Common.Factories;
using DigitalData.TaskFlow.Application.Common.Exceptions;
using DigitalData.TaskFlow.Application.Common.Interfaces;
using DigitalData.TaskFlow.Domain.Common;
using DigitalData.TaskFlow.Domain.Documents;
using DigitalData.TaskFlow.Domain.Enums;
using FluentValidation;
using MediatR;
namespace DigitalData.TaskFlow.Application.Features.Documents.Queries.GetDocument;
/// <summary>
/// Represents a request to retrieve binary document content by document identifier.
/// </summary>
/// <param name="Id">Document identifier.</param>
public sealed record GetDocumentQuery(string Id) : IRequest<ApiEnvelope<DocumentBinaryResult>>;
/// <summary>
/// Validates <see cref="GetDocumentQuery"/> requests.
/// </summary>
public sealed class GetDocumentQueryValidator : AbstractValidator<GetDocumentQuery>
{
/// <summary>
/// Initializes validation rules for <see cref="GetDocumentQuery"/>.
/// </summary>
public GetDocumentQueryValidator()
{
RuleFor(x => x.Id)
.NotEmpty();
}
}
/// <summary>
/// Handles <see cref="GetDocumentQuery"/> requests.
/// </summary>
public sealed class GetDocumentQueryHandler(IDocumentRepository documentRepository)
: IRequestHandler<GetDocumentQuery, ApiEnvelope<DocumentBinaryResult>>
{
/// <summary>
/// Executes the query and returns binary document data in the standard API envelope.
/// </summary>
/// <param name="request">Query request.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Document response envelope.</returns>
public async Task<ApiEnvelope<DocumentBinaryResult>> Handle(GetDocumentQuery request, CancellationToken cancellationToken)
{
var document = await documentRepository.GetAsync(request.Id, cancellationToken);
if (document is null)
{
throw new NotFoundApiException("Dokument nicht gefunden");
}
return ApiEnvelopeFactory.Create(document);
}
}

View File

@@ -0,0 +1,121 @@
using DigitalData.TaskFlow.Application.Common.Exceptions;
using DigitalData.TaskFlow.Application.Common.Interfaces;
using DigitalData.TaskFlow.Application.Common.Factories;
using AutoMapper;
using DigitalData.TaskFlow.Domain.Closing;
using DigitalData.TaskFlow.Domain.Common;
using DigitalData.TaskFlow.Domain.Enums;
using FluentValidation;
using MediatR;
namespace DigitalData.TaskFlow.Application.Features.Workflows.Commands.CloseWorkflow;
/// <summary>
/// Represents a request to close a workflow process using a selected closing method.
/// </summary>
/// <param name="WisagId">WISAG user identifier.</param>
/// <param name="Source">Source system name.</param>
/// <param name="ProcessId">Process identifier.</param>
/// <param name="ClosingMethodId">Selected closing method identifier.</param>
/// <param name="Comment">Optional user comment.</param>
/// <param name="RejectionReasonId">Optional rejection reason identifier.</param>
public sealed record CloseWorkflowCommand(
int WisagId,
string Source,
int ProcessId,
int ClosingMethodId,
string? Comment,
int? RejectionReasonId)
: IRequest<ApiEnvelope<CloseWorkflowResult>>;
/// <summary>
/// Validates <see cref="CloseWorkflowCommand"/> requests.
/// </summary>
public sealed class CloseWorkflowCommandValidator : AbstractValidator<CloseWorkflowCommand>
{
private static readonly string[] AllowedSources = ["Ferdinand", "Contracts"];
private const int ApproveMethodId = 2;
private const int RejectMethodId = 3;
private const int BackToPerMethodId = 4;
/// <summary>
/// Initializes validation rules for <see cref="CloseWorkflowCommand"/>.
/// </summary>
public CloseWorkflowCommandValidator()
{
RuleFor(x => x.WisagId)
.GreaterThan(0);
RuleFor(x => x.ProcessId)
.GreaterThan(0);
RuleFor(x => x.ClosingMethodId)
.GreaterThan(0);
RuleFor(x => x.Source)
.NotEmpty()
.Must(source => AllowedSources.Contains(source))
.WithMessage("Source must be one of the supported source systems.");
RuleFor(x => x.ClosingMethodId)
.Must(methodId => methodId is ApproveMethodId or RejectMethodId or BackToPerMethodId)
.WithMessage("Unbekannte closing_method_id");
RuleFor(x => x.Comment)
.NotEmpty()
.When(x => x.ClosingMethodId is RejectMethodId or BackToPerMethodId)
.WithMessage("Kommentar ist fur diese closing_method Pflicht");
RuleFor(x => x.RejectionReasonId)
.NotNull()
.When(x => x.ClosingMethodId == RejectMethodId)
.WithMessage("rejection_reason_id ist fur diese closing_method Pflicht");
}
}
/// <summary>
/// Handles <see cref="CloseWorkflowCommand"/> requests.
/// </summary>
public sealed class CloseWorkflowCommandHandler(IWorkflowRepository workflowRepository, IMapper mapper)
: IRequestHandler<CloseWorkflowCommand, ApiEnvelope<CloseWorkflowResult>>
{
/// <summary>
/// Executes the closing request and returns the operation result in the standard API envelope.
/// </summary>
/// <param name="request">Command request.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Closing result envelope.</returns>
public async Task<ApiEnvelope<CloseWorkflowResult>> Handle(CloseWorkflowCommand request, CancellationToken cancellationToken)
{
var decision = mapper.Map<CloseWorkflowDecision>(request);
var result = await workflowRepository.CloseAsync(
request.WisagId,
request.Source,
request.ProcessId,
decision,
cancellationToken);
if (result.Outcome == CloseWorkflowOutcome.NoAccess)
{
throw new ForbiddenApiException("Kein Zugriff");
}
if (result.Outcome == CloseWorkflowOutcome.NotImplemented)
{
throw new InvalidOperationException("Closing integration is not finalized yet.");
}
if (result.ProcessId <= 0)
{
throw new NotFoundApiException("Vorgang nicht gefunden");
}
if (!result.IsClosed)
{
throw new ConflictApiException(MetaCode.AlreadyClosed, "Vorgang bereits abgeschlossen");
}
return ApiEnvelopeFactory.Create(result);
}
}

View File

@@ -0,0 +1,67 @@
using DigitalData.TaskFlow.Application.Common.Factories;
using DigitalData.TaskFlow.Application.Common.Interfaces;
using DigitalData.TaskFlow.Domain.Common;
using DigitalData.TaskFlow.Domain.Enums;
using DigitalData.TaskFlow.Domain.Workflows;
using FluentValidation;
using MediatR;
namespace DigitalData.TaskFlow.Application.Features.Workflows.Queries.GetWorkflows;
/// <summary>
/// Represents a request to fetch grouped workflow data for a WISAG user.
/// </summary>
/// <param name="WisagId">WISAG user identifier.</param>
public sealed record GetWorkflowsQuery(int WisagId) : IRequest<ApiEnvelope<WorkflowSourcesResponse>>;
/// <summary>
/// Validates <see cref="GetWorkflowsQuery"/> requests.
/// </summary>
public sealed class GetWorkflowsQueryValidator : AbstractValidator<GetWorkflowsQuery>
{
/// <summary>
/// Initializes validation rules for <see cref="GetWorkflowsQuery"/>.
/// </summary>
public GetWorkflowsQueryValidator()
{
RuleFor(x => x.WisagId)
.GreaterThan(0);
}
}
/// <summary>
/// Handles <see cref="GetWorkflowsQuery"/> requests.
/// </summary>
public sealed class GetWorkflowsQueryHandler(IWorkflowRepository workflowRepository)
: IRequestHandler<GetWorkflowsQuery, ApiEnvelope<WorkflowSourcesResponse>>
{
/// <summary>
/// Executes the query and returns a workflow payload wrapped in the standard API envelope.
/// </summary>
/// <param name="request">Query request.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Workflow response envelope.</returns>
public async Task<ApiEnvelope<WorkflowSourcesResponse>> Handle(GetWorkflowsQuery request, CancellationToken cancellationToken)
{
var data = await workflowRepository.GetAsync(request.WisagId, cancellationToken);
if (data.Sources.Count == 0)
{
return ApiEnvelopeFactory.Create(data, MetaCode.NoAccess);
}
var hasListingData = data.Sources.Any(source => source switch
{
FerdinandSourceBlock ferdinand => ferdinand.Listing.Count > 0,
ContractsSourceBlock contracts => contracts.Listing.Count > 0,
_ => false
});
if (!hasListingData)
{
return ApiEnvelopeFactory.Create(data, MetaCode.NoOpenWorkflows);
}
return ApiEnvelopeFactory.Create(data);
}
}

View File

@@ -0,0 +1,8 @@
namespace DigitalData.TaskFlow.Application.Options;
public sealed class MediatROptions
{
public const string SectionName = "MediatR";
public string? LuckyPennySoftLicenseKey { get; init; }
}

View File

@@ -0,0 +1,41 @@
# DigitalData.TaskFlow.Application
Dieses Projekt enthaelt die Use-Case-Schicht der Anwendung.
## Zweck
Die Application-Schicht orchestriert fachliche Anwendungsfaelle. Sie nimmt Requests entgegen, validiert diese, ruft Domain-nahe Abstraktionen auf und liefert strukturierte Ergebnisse zurueck.
## Aktueller Inhalt
- `DependencyInjection.cs`
- Registriert zentrale Application-Dienste:
- MediatR
- FluentValidation
- AutoMapper
- Bindet `MediatR`-Optionen inklusive Lizenzschluessel.
- `Options/`
- `MediatROptions`: Konfiguration fuer MediatR (z. B. `LuckyPennySoftLicenseKey`).
## Geplante Inhalte (naechste Phasen)
- `Features/`
- Queries/Commands fuer Workflows, Closing und Documents.
- `Validators/`
- FluentValidation-Regeln pro Request.
- `Common/Behaviors/`
- Pipeline-Behavior (z. B. zentrale Request-Validierung).
- `Common/Interfaces/`
- Repository-Abstraktionen fuer Datenzugriff.
- `Mappings/`
- AutoMapper-Profile zwischen Infrastrukturmodellen und Domainmodellen.
## Architektur-Regeln
- Keine direkten SQL- oder EF-Core-Aufrufe.
- Keine HTTP-spezifischen Controller-Abhaengigkeiten.
- Kommunikation nach aussen nur ueber Interfaces.
## Rolle im Gesamtsystem
Diese Schicht ist der zentrale Ausfuehrungspunkt fuer Use-Cases und verbindet die API-Schicht mit Domain und Infrastructure, ohne Technologie-Details nach oben durchzureichen.

View File

@@ -0,0 +1,22 @@
namespace DigitalData.TaskFlow.Domain.Closing;
/// <summary>
/// Represents the user decision payload for closing a workflow process.
/// </summary>
public sealed record CloseWorkflowDecision
{
/// <summary>
/// Gets the selected closing method identifier.
/// </summary>
public required int ClosingMethodId { get; init; }
/// <summary>
/// Gets the optional comment attached to the decision.
/// </summary>
public string? Comment { get; init; }
/// <summary>
/// Gets the optional rejection reason identifier.
/// </summary>
public int? RejectionReasonId { get; init; }
}

View File

@@ -0,0 +1,32 @@
namespace DigitalData.TaskFlow.Domain.Closing;
/// <summary>
/// Defines business outcomes of a close workflow attempt.
/// </summary>
public enum CloseWorkflowOutcome
{
/// <summary>
/// Workflow can be closed successfully.
/// </summary>
Closed = 0,
/// <summary>
/// Caller has no access to the requested workflow.
/// </summary>
NoAccess = 1,
/// <summary>
/// Workflow process was not found.
/// </summary>
NotFound = 2,
/// <summary>
/// Workflow is already closed and cannot be closed again.
/// </summary>
AlreadyClosed = 3,
/// <summary>
/// Closing cannot be completed yet because write integration is not finalized.
/// </summary>
NotImplemented = 4
}

View File

@@ -0,0 +1,22 @@
namespace DigitalData.TaskFlow.Domain.Closing;
/// <summary>
/// Represents the result of a workflow closing operation.
/// </summary>
public sealed record CloseWorkflowResult
{
/// <summary>
/// Gets the process identifier.
/// </summary>
public required int ProcessId { get; init; }
/// <summary>
/// Gets a value indicating whether the process was closed successfully.
/// </summary>
public required bool IsClosed { get; init; }
/// <summary>
/// Gets the business outcome of the close request.
/// </summary>
public CloseWorkflowOutcome Outcome { get; init; } = CloseWorkflowOutcome.Closed;
}

View File

@@ -0,0 +1,18 @@
namespace DigitalData.TaskFlow.Domain.Common;
/// <summary>
/// Represents the standard API envelope that contains meta information and payload data.
/// </summary>
/// <typeparam name="T">Type of the payload in the response.</typeparam>
public sealed record ApiEnvelope<T>
{
/// <summary>
/// Gets the list of metadata entries describing the business result.
/// </summary>
public required IReadOnlyList<MetaEntry> Meta { get; init; }
/// <summary>
/// Gets the payload data returned by the endpoint.
/// </summary>
public T? Data { get; init; }
}

View File

@@ -0,0 +1,17 @@
namespace DigitalData.TaskFlow.Domain.Common;
/// <summary>
/// Represents a single metadata item describing the business result state of an API response.
/// </summary>
public sealed record MetaEntry
{
/// <summary>
/// Gets the domain-specific result code.
/// </summary>
public required int Code { get; init; }
/// <summary>
/// Gets the human-readable message that belongs to <see cref="Code"/>.
/// </summary>
public required string Message { get; init; }
}

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,27 @@
namespace DigitalData.TaskFlow.Domain.Documents;
/// <summary>
/// Represents binary document content returned by the document endpoint.
/// </summary>
public sealed record DocumentBinaryResult
{
/// <summary>
/// Gets the raw binary content.
/// </summary>
public required byte[] Content { get; init; }
/// <summary>
/// Gets the MIME content type.
/// </summary>
public required string ContentType { get; init; }
/// <summary>
/// Gets the file name used for download.
/// </summary>
public required string FileName { get; init; }
/// <summary>
/// Gets the content length in bytes.
/// </summary>
public required long Length { get; init; }
}

View File

@@ -0,0 +1,42 @@
namespace DigitalData.TaskFlow.Domain.Enums;
/// <summary>
/// Defines domain-level result codes used in API meta responses.
/// </summary>
public enum MetaCode
{
/// <summary>
/// Operation completed successfully.
/// </summary>
Ok = 0,
/// <summary>
/// Request is valid but no open workflows are available.
/// </summary>
NoOpenWorkflows = 1,
/// <summary>
/// Caller has no access to the requested resource.
/// </summary>
NoAccess = 2,
/// <summary>
/// Request is invalid or authentication failed according to endpoint rules.
/// </summary>
InvalidRequest = 4,
/// <summary>
/// Internal server error occurred.
/// </summary>
InternalError = 5,
/// <summary>
/// Requested resource was not found.
/// </summary>
NotFound = 6,
/// <summary>
/// Target workflow was already closed.
/// </summary>
AlreadyClosed = 7
}

View File

@@ -0,0 +1,33 @@
# DigitalData.TaskFlow.Domain
Dieses Projekt bildet den fachlichen Kern von `DigitalData.TaskFlow`.
## Zweck
Die Domain-Schicht enthaelt ausschließlich fachliche Modelle und Begriffe. Hier wird beschrieben, **was** das System fachlich darstellt, nicht **wie** Daten gelesen/geschrieben werden.
## Aktueller Inhalt
- `Common/`
- `ApiEnvelope<T>`: Standard-Response-Huelle mit `Meta` und `Data`.
- `MetaEntry`: Einzelner Meta-Eintrag (`Code`, `Message`).
- `Enums/`
- `MetaCode`: Fachliche Status-Codes (z. B. `Ok`, `NoAccess`, `AlreadyClosed`).
- `Workflows/`
- Modelle fuer den Endpoint `GET /workflows/{wisagid}`.
- Enthalten Quellblock-Struktur (`SourceBlock`, `FerdinandSourceBlock`, `ContractsSourceBlock`) und Untermodelle (`ProfileItem`, `WorkflowListingItem`, `ApprovalItem`, `DocumentReferenceItem`, `ClosingMethodItem`, `RejectionReasonItem`).
- `Closing/`
- Modelle fuer den Endpoint `POST /workflows/{wisagid}/{source}/{processid}/closing`.
- `CloseWorkflowDecision` (Eingabe), `CloseWorkflowResult` (Ergebnis).
- `Documents/`
- `DocumentBinaryResult` fuer den Endpoint `GET /documents/{id}`.
## Architektur-Regeln
- Keine EF-Core-, HTTP-, SQL- oder Infrastruktur-Abhaengigkeiten.
- Keine Controller- oder Middleware-Logik.
- Modelle bleiben in PascalCase; technische DB-Namensabweichungen werden spaeter in Infrastructure gemappt.
## Warum diese Schicht wichtig ist
Die Domain stellt eine stabile, technologieunabhaengige Sprache bereit. Dadurch koennen API, Application und Infrastructure getrennt entwickelt werden, ohne den fachlichen Vertrag zu verlieren.

View File

@@ -0,0 +1,32 @@
namespace DigitalData.TaskFlow.Domain.Workflows;
/// <summary>
/// Represents a completed approval action for a workflow process.
/// </summary>
public sealed record ApprovalItem
{
/// <summary>
/// Gets the process identifier.
/// </summary>
public required int ProcessId { get; init; }
/// <summary>
/// Gets the approval sequence index.
/// </summary>
public required int Sequence { get; init; }
/// <summary>
/// Gets the user name or identifier of the approver.
/// </summary>
public required string ApprovedBy { get; init; }
/// <summary>
/// Gets the UTC timestamp when approval was recorded.
/// </summary>
public required DateTime ApprovedAtUtc { get; init; }
/// <summary>
/// Gets the optional approval comment.
/// </summary>
public string? Comment { get; init; }
}

View File

@@ -0,0 +1,27 @@
namespace DigitalData.TaskFlow.Domain.Workflows;
/// <summary>
/// Represents a workflow closing option available for user decision.
/// </summary>
public sealed record ClosingMethodItem
{
/// <summary>
/// Gets the closing method identifier.
/// </summary>
public required int ClosingMethodId { get; init; }
/// <summary>
/// Gets the display name of the method.
/// </summary>
public required string Name { get; init; }
/// <summary>
/// Gets a value indicating whether a comment is mandatory for this method.
/// </summary>
public required bool CommentRequired { get; init; }
/// <summary>
/// Gets a value indicating whether this method represents a rejection.
/// </summary>
public required bool IsRejection { get; init; }
}

View File

@@ -0,0 +1,40 @@
namespace DigitalData.TaskFlow.Domain.Workflows;
using System.Text.Json;
using System.Text.Json.Serialization;
/// <summary>
/// Represents workflow data for the Contracts source system.
/// </summary>
public sealed record ContractsSourceBlock : SourceBlock
{
/// <summary>
/// Gets available approval profiles.
/// </summary>
[JsonPropertyName("profile")]
public required IReadOnlyList<JsonElement> Profile { get; init; }
/// <summary>
/// Gets workflow listing items.
/// </summary>
[JsonPropertyName("Listing")]
public required IReadOnlyList<JsonElement> Listing { get; init; }
/// <summary>
/// Gets already executed approvals.
/// </summary>
[JsonPropertyName("approvals")]
public required IReadOnlyList<JsonElement> Approvals { get; init; }
/// <summary>
/// Gets document references for workflows.
/// </summary>
[JsonPropertyName("document")]
public required IReadOnlyList<JsonElement> Document { get; init; }
/// <summary>
/// Gets available closing methods for workflows.
/// </summary>
[JsonPropertyName("closing_method")]
public required IReadOnlyList<JsonElement> ClosingMethod { get; init; }
}

View File

@@ -0,0 +1,27 @@
namespace DigitalData.TaskFlow.Domain.Workflows;
/// <summary>
/// Represents a lightweight document reference linked to a workflow process.
/// </summary>
public sealed record DocumentReferenceItem
{
/// <summary>
/// Gets the document identifier used for binary retrieval.
/// </summary>
public required string Id { get; init; }
/// <summary>
/// Gets the process identifier.
/// </summary>
public required int ProcessId { get; init; }
/// <summary>
/// Gets the document title.
/// </summary>
public required string Title { get; init; }
/// <summary>
/// Gets the document subtitle.
/// </summary>
public required string Subtitle { get; init; }
}

View File

@@ -0,0 +1,46 @@
namespace DigitalData.TaskFlow.Domain.Workflows;
using System.Text.Json;
using System.Text.Json.Serialization;
/// <summary>
/// Represents workflow data for the Ferdinand source system.
/// </summary>
public sealed record FerdinandSourceBlock : SourceBlock
{
/// <summary>
/// Gets available approval profiles.
/// </summary>
[JsonPropertyName("profile")]
public required IReadOnlyList<JsonElement> Profile { get; init; }
/// <summary>
/// Gets workflow listing items.
/// </summary>
[JsonPropertyName("Listing")]
public required IReadOnlyList<JsonElement> Listing { get; init; }
/// <summary>
/// Gets already executed approvals.
/// </summary>
[JsonPropertyName("approvals")]
public required IReadOnlyList<JsonElement> Approvals { get; init; }
/// <summary>
/// Gets document references for workflows.
/// </summary>
[JsonPropertyName("document")]
public required IReadOnlyList<JsonElement> Document { get; init; }
/// <summary>
/// Gets available closing methods for workflows.
/// </summary>
[JsonPropertyName("closing_method")]
public required IReadOnlyList<JsonElement> ClosingMethod { get; init; }
/// <summary>
/// Gets available rejection reasons for rejection-type methods.
/// </summary>
[JsonPropertyName("rejection_reason")]
public required IReadOnlyList<JsonElement> RejectionReason { get; init; }
}

View File

@@ -0,0 +1,22 @@
namespace DigitalData.TaskFlow.Domain.Workflows;
/// <summary>
/// Represents an approval profile for workflow processing.
/// </summary>
public sealed record ProfileItem
{
/// <summary>
/// Gets the profile identifier.
/// </summary>
public required int ProfileId { get; init; }
/// <summary>
/// Gets the display title of the profile.
/// </summary>
public required string Title { get; init; }
/// <summary>
/// Gets the optional priority value.
/// </summary>
public int? Priority { get; init; }
}

View File

@@ -0,0 +1,17 @@
namespace DigitalData.TaskFlow.Domain.Workflows;
/// <summary>
/// Represents a rejection reason that can be selected for rejection methods.
/// </summary>
public sealed record RejectionReasonItem
{
/// <summary>
/// Gets the rejection reason identifier.
/// </summary>
public required int RejectionReasonId { get; init; }
/// <summary>
/// Gets the display name of the rejection reason.
/// </summary>
public required string Name { get; init; }
}

View File

@@ -0,0 +1,12 @@
namespace DigitalData.TaskFlow.Domain.Workflows;
/// <summary>
/// Base type for source-specific workflow blocks.
/// </summary>
public abstract record SourceBlock
{
/// <summary>
/// Gets the source system name.
/// </summary>
public required string Source { get; init; }
}

View File

@@ -0,0 +1,87 @@
namespace DigitalData.TaskFlow.Domain.Workflows;
/// <summary>
/// Represents a single workflow listing row.
/// </summary>
public sealed record WorkflowListingItem
{
/// <summary>
/// Gets the process identifier.
/// </summary>
public required int ProcessId { get; init; }
/// <summary>
/// Gets the profile identifier associated with the process.
/// </summary>
public required int ProfileId { get; init; }
/// <summary>
/// Gets the voucher type.
/// </summary>
public required string VoucherType { get; init; }
/// <summary>
/// Gets the voucher number.
/// </summary>
public required string VoucherNumber { get; init; }
/// <summary>
/// Gets the voucher date.
/// </summary>
public required DateOnly VoucherDate { get; init; }
/// <summary>
/// Gets the cost center number.
/// </summary>
public required string CostCenter { get; init; }
/// <summary>
/// Gets the cost center description.
/// </summary>
public required string CostCenterDescription { get; init; }
/// <summary>
/// Gets the client number.
/// </summary>
public required int ClientNumber { get; init; }
/// <summary>
/// Gets the client name.
/// </summary>
public required string ClientName { get; init; }
/// <summary>
/// Gets the supplier number.
/// </summary>
public required string SupplierNumber { get; init; }
/// <summary>
/// Gets the supplier name.
/// </summary>
public required string SupplierName { get; init; }
/// <summary>
/// Gets the net amount.
/// </summary>
public required decimal NetAmount { get; init; }
/// <summary>
/// Gets the gross amount.
/// </summary>
public required decimal GrossAmount { get; init; }
/// <summary>
/// Gets the discount amount.
/// </summary>
public required decimal DiscountAmount { get; init; }
/// <summary>
/// Gets the currency.
/// </summary>
public required string Currency { get; init; }
/// <summary>
/// Gets the priority value.
/// </summary>
public required int Priority { get; init; }
}

View File

@@ -0,0 +1,12 @@
namespace DigitalData.TaskFlow.Domain.Workflows;
/// <summary>
/// Represents the workflow payload grouped by source systems.
/// </summary>
public sealed record WorkflowSourcesResponse
{
/// <summary>
/// Gets the source blocks included in the response.
/// </summary>
public required IReadOnlyList<SourceBlock> Sources { get; init; }
}

View File

@@ -0,0 +1,38 @@
using DigitalData.TaskFlow.Application.Common.Interfaces;
using DigitalData.TaskFlow.Infrastructure.Options;
using DigitalData.TaskFlow.Infrastructure.Persistence;
using DigitalData.TaskFlow.Infrastructure.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace DigitalData.TaskFlow.Infrastructure;
public static class DependencyInjection
{
public static IServiceCollection AddInfrastructureServices(this IServiceCollection services, IConfiguration configuration)
{
var connectionString = configuration.GetConnectionString("TaskFlowDb");
var databaseOptions = configuration.GetSection(DatabaseOptions.SectionName).Get<DatabaseOptions>() ?? new DatabaseOptions();
if (string.IsNullOrWhiteSpace(connectionString))
{
throw new InvalidOperationException("Connection string 'TaskFlowDb' is not configured.");
}
services.AddDbContext<TaskFlowDbContext>(options =>
{
options.UseSqlServer(connectionString, sqlOptions =>
{
sqlOptions.CommandTimeout(databaseOptions.CommandTimeoutSeconds);
});
});
services.Configure<DatabaseOptions>(configuration.GetSection(DatabaseOptions.SectionName));
services.AddScoped<IWorkflowRepository, WorkflowRepository>();
services.AddScoped<IDocumentRepository, DocumentRepository>();
return services;
}
}

View File

@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="11.0.0-rc.1.26425.128" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="11.0.0-rc.1.26425.128" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="11.0.0-rc.1.26425.128" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\DigitalData.TaskFlow.Application\DigitalData.TaskFlow.Application.csproj" />
<ProjectReference Include="..\..\core\DigitalData.TaskFlow.Domain\DigitalData.TaskFlow.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Options\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,22 @@
namespace DigitalData.TaskFlow.Infrastructure.Options;
/// <summary>
/// Holds infrastructure database options.
/// </summary>
public sealed class DatabaseOptions
{
/// <summary>
/// Configuration section name.
/// </summary>
public const string SectionName = "Database";
/// <summary>
/// Gets or sets command timeout in seconds for SQL operations.
/// </summary>
public int CommandTimeoutSeconds { get; set; } = 30;
/// <summary>
/// Gets or sets object type passed to workflow listing procedure.
/// </summary>
public string WorkflowListingObjectType { get; set; } = "Ferdinand";
}

View File

@@ -0,0 +1,111 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace DigitalData.TaskFlow.Infrastructure.Persistence.Models;
/// <summary>
/// Represents a stored procedure row shape for workflow listing data.
/// </summary>
public sealed class WorkflowListingReadModel
{
/// <summary>
/// Gets or sets the process identifier.
/// </summary>
[Column("processid")]
public int ProcessId { get; set; }
/// <summary>
/// Gets or sets the profile identifier.
/// </summary>
[Column("profileid")]
public byte ProfileId { get; set; }
/// <summary>
/// Gets or sets the voucher type.
/// </summary>
[Column("belegart")]
public string VoucherType { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the voucher number.
/// </summary>
[Column("belegnr")]
public string VoucherNumber { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the voucher date.
/// </summary>
[Column("belegdatum")]
public DateTime VoucherDate { get; set; }
/// <summary>
/// Gets or sets the cost center.
/// </summary>
[Column("kostenstelle")]
public string CostCenter { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the cost center description.
/// </summary>
[Column("kostenstellenbezeichnung")]
public string CostCenterDescription { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the client number.
/// </summary>
[Column("mandantnr")]
public short ClientNumber { get; set; }
/// <summary>
/// Gets or sets the client name.
/// </summary>
[Column("mandantbez")]
public string ClientName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the supplier number.
/// </summary>
[Column("lieferantnr")]
public string SupplierNumber { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the supplier name.
/// </summary>
[Column("lieferantbez")]
public string SupplierName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the net amount.
/// </summary>
[Column("netto")]
public double NetAmount { get; set; }
/// <summary>
/// Gets or sets the gross amount.
/// </summary>
[Column("brutto")]
public double GrossAmount { get; set; }
/// <summary>
/// Gets or sets the discount amount.
/// </summary>
[Column("skontobetrag")]
public double DiscountAmount { get; set; }
/// <summary>
/// Gets or sets the currency.
/// </summary>
[Column("waehrung")]
public string Currency { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the priority.
/// </summary>
[Column("priority")]
public byte Priority { get; set; }
/// <summary>
/// Gets or sets the source group text.
/// </summary>
[Column("GROUP_TEXT")]
public string GroupText { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,26 @@
using DigitalData.TaskFlow.Infrastructure.Persistence.Models;
using Microsoft.EntityFrameworkCore;
namespace DigitalData.TaskFlow.Infrastructure.Persistence;
/// <summary>
/// EF Core DbContext for TaskFlow infrastructure data access.
/// </summary>
public sealed class TaskFlowDbContext(DbContextOptions<TaskFlowDbContext> options) : DbContext(options)
{
/// <summary>
/// Gets the keyless result model used for workflow listing procedure reads.
/// </summary>
public DbSet<WorkflowListingReadModel> WorkflowListingReadModels => Set<WorkflowListingReadModel>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<WorkflowListingReadModel>(entity =>
{
entity.HasNoKey();
entity.ToView(null);
});
}
}

View File

@@ -0,0 +1,46 @@
# DigitalData.TaskFlow.Infrastructure
Dieses Projekt implementiert technische Integrationen der Anwendung.
## Zweck
Die Infrastructure-Schicht setzt die in Application definierten Abstraktionen konkret um. Dazu gehoeren Datenbankzugriffe (EF Core, Stored Procedures) und spaeter ggf. DMS- oder externe Service-Anbindungen.
## Aktueller Inhalt
- `DependencyInjection.cs`
- Einstiegspunkt fuer die Registrierung technischer Dienste.
- `Options/`
- Platz fuer Infrastruktur-spezifische Optionen (falls benoetigt).
## Geplante Inhalte (naechste Phasen)
- `Persistence/`
- `TaskFlowDbContext` mit SQL-Server-Konfiguration.
- Entity-Konfigurationen inklusive Feld-Mapping (DB-Namen -> PascalCase-Modelle).
- `Repositories/`
- Implementierungen fuer:
- Workflow-Lesezugriff (u. a. `PRCUST_F19_GET_LISTING_DATA`)
- Workflow-Closing (Write-Procedure)
- Dokument-Binary-Zugriff
- `Persistence/Models/`
- Keyless Modelle fuer Procedure-Ergebnisse.
## Wichtiger Hinweis zu DB-Spaltennamen
- Spaltennamen in `Persistence/Models` (z. B. `WorkflowListingReadModel`) basieren aktuell auf:
- read-only Abfragen auf `sys.columns` (u. a. `TBCUST_F19_LISTING_RESULT`),
- beobachteten Result-Sets von `PRCUST_F19_GET_LISTING_DATA` im `table`-Modus.
- Vor produktiven Aenderungen muss das finale SP-Resultset read-only verifiziert werden, idealerweise mit
`sp_describe_first_result_set` oder einer gleichwertigen Metadata-Pruefung.
- Domain-Modelle bleiben davon getrennt: DB-Feldnamen werden nur in Infrastructure gemappt, nicht in Domain.
## Architektur-Regeln
- Keine Controller- oder HTTP-Logik.
- Keine fachliche Regel-Definition; nur technische Umsetzung.
- SQL-Zugriff stets parameterisiert und sicher.
## Rolle im Gesamtsystem
Infrastructure kapselt alle externen Abhaengigkeiten. Dadurch bleibt die Application-Schicht testbar und von Technologie-Details entkoppelt.

View File

@@ -0,0 +1,25 @@
using DigitalData.TaskFlow.Application.Common.Interfaces;
using DigitalData.TaskFlow.Domain.Documents;
namespace DigitalData.TaskFlow.Infrastructure.Repositories;
/// <summary>
/// Document repository implementation for binary document retrieval.
/// </summary>
public sealed class DocumentRepository : IDocumentRepository
{
/// <summary>
/// Retrieves binary document content by identifier.
/// </summary>
/// <param name="id">Document identifier.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Binary document payload when found; otherwise <see langword="null"/>.</returns>
public Task<DocumentBinaryResult?> GetAsync(string id, CancellationToken cancellationToken)
{
_ = id;
_ = cancellationToken;
throw new NotSupportedException(
"Document retrieval procedure/DMS contract is not finalized yet. Configure final integration before enabling GetAsync.");
}
}

View File

@@ -0,0 +1,254 @@
using DigitalData.TaskFlow.Application.Common.Interfaces;
using DigitalData.TaskFlow.Domain.Closing;
using DigitalData.TaskFlow.Domain.Workflows;
using DigitalData.TaskFlow.Infrastructure.Options;
using DigitalData.TaskFlow.Infrastructure.Persistence;
using DigitalData.TaskFlow.Infrastructure.Persistence.Models;
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
using System.Text.Json;
namespace DigitalData.TaskFlow.Infrastructure.Repositories;
/// <summary>
/// Workflow repository implementation for reading workflow listing data and applying close operations.
/// </summary>
public sealed class WorkflowRepository(TaskFlowDbContext dbContext, IOptions<DatabaseOptions> databaseOptions) : IWorkflowRepository
{
/// <summary>
/// Retrieves grouped workflow data for a user.
/// </summary>
/// <param name="wisagId">WISAG user identifier.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Grouped workflow response.</returns>
public async Task<WorkflowSourcesResponse> GetAsync(int wisagId, CancellationToken cancellationToken)
{
var objectType = string.IsNullOrWhiteSpace(databaseOptions.Value.WorkflowListingObjectType)
? "Ferdinand"
: databaseOptions.Value.WorkflowListingObjectType;
var jsonPayload = await ExecuteListingJsonAsync(wisagId, objectType, cancellationToken);
if (string.IsNullOrWhiteSpace(jsonPayload))
{
return new WorkflowSourcesResponse { Sources = [] };
}
using var document = JsonDocument.Parse(jsonPayload);
if (!document.RootElement.TryGetProperty("response", out var responseElement))
{
return new WorkflowSourcesResponse { Sources = [] };
}
if (TryReadMetaCode(responseElement) == 2)
{
return new WorkflowSourcesResponse { Sources = [] };
}
var sources = new List<SourceBlock>();
if (!responseElement.TryGetProperty("sources", out var sourcesElement) || sourcesElement.ValueKind != JsonValueKind.Array)
{
return new WorkflowSourcesResponse { Sources = sources };
}
foreach (var sourceElement in sourcesElement.EnumerateArray())
{
if (!sourceElement.TryGetProperty("source", out var sourceNameElement))
{
continue;
}
var sourceName = sourceNameElement.GetString();
if (string.Equals(sourceName, "Ferdinand", StringComparison.OrdinalIgnoreCase))
{
sources.Add(new FerdinandSourceBlock
{
Source = "Ferdinand",
Profile = ReadArray(sourceElement, "profile"),
Listing = ReadArray(sourceElement, "Listing"),
Approvals = ReadArray(sourceElement, "approvals"),
Document = ReadArray(sourceElement, "document"),
ClosingMethod = ReadArray(sourceElement, "closing_method"),
RejectionReason = ReadArray(sourceElement, "rejection_reason")
});
continue;
}
if (string.Equals(sourceName, "Contracts", StringComparison.OrdinalIgnoreCase))
{
sources.Add(new ContractsSourceBlock
{
Source = "Contracts",
Profile = ReadArray(sourceElement, "profile"),
Listing = ReadArray(sourceElement, "Listing"),
Approvals = ReadArray(sourceElement, "approvals"),
Document = ReadArray(sourceElement, "document"),
ClosingMethod = ReadArray(sourceElement, "closing_method")
});
}
}
return new WorkflowSourcesResponse { Sources = sources };
}
/// <summary>
/// Applies a closing decision to a workflow item.
/// </summary>
/// <param name="wisagId">WISAG user identifier.</param>
/// <param name="source">Source system name.</param>
/// <param name="processId">Process identifier.</param>
/// <param name="decision">Closing decision payload.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Result of the close operation.</returns>
public Task<CloseWorkflowResult> CloseAsync(
int wisagId,
string source,
int processId,
CloseWorkflowDecision decision,
CancellationToken cancellationToken)
{
_ = decision;
if (!string.Equals(source, "Ferdinand", StringComparison.OrdinalIgnoreCase))
{
return Task.FromResult(new CloseWorkflowResult
{
ProcessId = processId,
IsClosed = false,
Outcome = CloseWorkflowOutcome.NotFound
});
}
return EvaluateCloseOutcomeAsync(wisagId, source, processId, cancellationToken);
}
private async Task<CloseWorkflowResult> EvaluateCloseOutcomeAsync(
int wisagId,
string source,
int processId,
CancellationToken cancellationToken)
{
var rows = await ExecuteListingTableAsync(wisagId, source, cancellationToken);
if (rows.Any(row => row.ProcessId == processId))
{
return new CloseWorkflowResult
{
ProcessId = processId,
IsClosed = true,
Outcome = CloseWorkflowOutcome.Closed
};
}
var metaCode = await TryGetWorkflowMetaCodeAsync(wisagId, source, cancellationToken);
if (metaCode == 2)
{
return new CloseWorkflowResult
{
ProcessId = processId,
IsClosed = false,
Outcome = CloseWorkflowOutcome.NoAccess
};
}
return new CloseWorkflowResult
{
ProcessId = 0,
IsClosed = false,
Outcome = CloseWorkflowOutcome.NotFound
};
}
private async Task<int?> TryGetWorkflowMetaCodeAsync(int wisagId, string objectType, CancellationToken cancellationToken)
{
var jsonPayload = await ExecuteListingJsonAsync(wisagId, objectType, cancellationToken);
if (string.IsNullOrWhiteSpace(jsonPayload))
{
return null;
}
try
{
using var document = JsonDocument.Parse(jsonPayload);
return document.RootElement.TryGetProperty("response", out var responseElement)
? TryReadMetaCode(responseElement)
: null;
}
catch (JsonException)
{
return null;
}
}
private async Task<IReadOnlyList<WorkflowListingReadModel>> ExecuteListingTableAsync(
int wisagId,
string objectType,
CancellationToken cancellationToken)
{
const string resultType = "table";
return await dbContext
.WorkflowListingReadModels
.FromSqlInterpolated($"EXEC dbo.PRCUST_F19_GET_LISTING_DATA @pUSER_ID={wisagId}, @pRESULT_TYPE={resultType}, @pOBJECT_TYPE={objectType}")
.AsNoTracking()
.ToListAsync(cancellationToken);
}
private async Task<string?> ExecuteListingJsonAsync(int wisagId, string objectType, CancellationToken cancellationToken)
{
const string commandText = "EXEC dbo.PRCUST_F19_GET_LISTING_DATA @pUSER_ID, @pRESULT_TYPE, @pOBJECT_TYPE";
const string resultType = "json";
await using var command = dbContext.Database.GetDbConnection().CreateCommand();
command.CommandText = commandText;
command.Parameters.Add(new SqlParameter("@pUSER_ID", wisagId));
command.Parameters.Add(new SqlParameter("@pRESULT_TYPE", resultType));
command.Parameters.Add(new SqlParameter("@pOBJECT_TYPE", objectType));
if (command.Connection is null)
{
return null;
}
if (command.Connection.State != System.Data.ConnectionState.Open)
{
await command.Connection.OpenAsync(cancellationToken);
}
await using var reader = await command.ExecuteReaderAsync(cancellationToken);
if (!await reader.ReadAsync(cancellationToken) || reader.FieldCount == 0 || reader.IsDBNull(0))
{
return null;
}
return reader.GetString(0);
}
private static int? TryReadMetaCode(JsonElement responseElement)
{
if (!responseElement.TryGetProperty("meta", out var metaElement) || metaElement.ValueKind != JsonValueKind.Array)
{
return null;
}
if (metaElement.GetArrayLength() == 0 || !metaElement[0].TryGetProperty("code", out var codeElement))
{
return null;
}
return codeElement.GetInt32();
}
private static IReadOnlyList<JsonElement> ReadArray(JsonElement sourceElement, string propertyName)
{
if (!sourceElement.TryGetProperty(propertyName, out var propertyElement) || propertyElement.ValueKind != JsonValueKind.Array)
{
return [];
}
return propertyElement.EnumerateArray().Select(item => item.Clone()).ToList();
}
}

View File

@@ -0,0 +1,16 @@
using DigitalData.TaskFlow.Domain.Common;
using System.Text.Json.Serialization;
namespace DigitalData.TaskFlow.API.Contracts.Common;
/// <summary>
/// Represents a contract response that contains only metadata.
/// </summary>
public sealed record MetaOnlyResponse
{
/// <summary>
/// Gets metadata entries.
/// </summary>
[JsonPropertyName("meta")]
public required IReadOnlyList<MetaEntry> Meta { get; init; }
}

View File

@@ -0,0 +1,27 @@
using System.Text.Json.Serialization;
namespace DigitalData.TaskFlow.API.Contracts.Workflows;
/// <summary>
/// Represents the request payload for closing a workflow.
/// </summary>
public sealed class CloseWorkflowRequest
{
/// <summary>
/// Gets or sets the selected closing method identifier.
/// </summary>
[JsonPropertyName("closing_method_id")]
public required int ClosingMethodId { get; init; }
/// <summary>
/// Gets or sets an optional user comment.
/// </summary>
[JsonPropertyName("comment")]
public string? Comment { get; init; }
/// <summary>
/// Gets or sets an optional rejection reason identifier.
/// </summary>
[JsonPropertyName("rejection_reason_id")]
public int? RejectionReasonId { get; init; }
}

View File

@@ -0,0 +1,22 @@
using DigitalData.TaskFlow.Domain.Common;
using System.Text.Json.Serialization;
namespace DigitalData.TaskFlow.API.Contracts.Workflows;
/// <summary>
/// Represents the GET workflows response contract.
/// </summary>
public sealed record WorkflowsResponse
{
/// <summary>
/// Gets metadata entries.
/// </summary>
[JsonPropertyName("meta")]
public required IReadOnlyList<MetaEntry> Meta { get; init; }
/// <summary>
/// Gets grouped source blocks.
/// </summary>
[JsonPropertyName("sources")]
public required IReadOnlyList<object> Sources { get; init; }
}

View File

@@ -0,0 +1,36 @@
using DigitalData.TaskFlow.Application.Features.Documents.Queries.GetDocument;
using DigitalData.TaskFlow.API.Contracts.Common;
using DigitalData.TaskFlow.Domain.Common;
using DigitalData.TaskFlow.Domain.Documents;
using MediatR;
using Microsoft.AspNetCore.Mvc;
namespace DigitalData.TaskFlow.API.Controllers;
/// <summary>
/// Provides document binary download endpoints.
/// </summary>
[ApiController]
[Route("api/documents")]
public sealed class DocumentsController(ISender sender) : ControllerBase
{
/// <summary>
/// Returns binary document content by document identifier.
/// </summary>
/// <param name="id">Document identifier.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Binary stream when available.</returns>
[HttpGet("{id}")]
[ProducesResponseType(typeof(FileContentResult), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status403Forbidden)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status500InternalServerError)]
public async Task<IActionResult> GetAsync([FromRoute] string id, CancellationToken cancellationToken)
{
var response = await sender.Send(new GetDocumentQuery(id), cancellationToken);
var data = response.Data ?? throw new InvalidOperationException("Document payload is unexpectedly null.");
return File(data.Content, data.ContentType, data.FileName);
}
}

View File

@@ -0,0 +1,84 @@
using DigitalData.TaskFlow.API.Contracts.Workflows;
using DigitalData.TaskFlow.API.Contracts.Common;
using DigitalData.TaskFlow.Application.Features.Workflows.Commands.CloseWorkflow;
using DigitalData.TaskFlow.Application.Features.Workflows.Queries.GetWorkflows;
using MediatR;
using Microsoft.AspNetCore.Mvc;
namespace DigitalData.TaskFlow.API.Controllers;
/// <summary>
/// Provides workflow read and close endpoints.
/// </summary>
[ApiController]
[Route("api/workflows")]
public sealed class WorkflowsController(ISender sender) : ControllerBase
{
/// <summary>
/// Returns open workflows for a WISAG user identifier.
/// </summary>
/// <param name="wisagId">WISAG user identifier.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Workflow response envelope grouped by source.</returns>
[HttpGet("{wisagId:int}")]
[ProducesResponseType(typeof(WorkflowsResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<WorkflowsResponse>> GetAsync(
[FromRoute] int wisagId,
CancellationToken cancellationToken)
{
var response = await sender.Send(new GetWorkflowsQuery(wisagId), cancellationToken);
var sources = response.Data?.Sources
.Cast<object>()
.ToList()
?? [];
return Ok(new WorkflowsResponse
{
Meta = response.Meta,
Sources = sources
});
}
/// <summary>
/// Applies a closing decision to a workflow process.
/// </summary>
/// <param name="wisagId">WISAG user identifier.</param>
/// <param name="source">Source system name.</param>
/// <param name="processId">Process identifier.</param>
/// <param name="request">Closing request payload.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>Close result envelope.</returns>
[HttpPost("{wisagId:int}/{source}/{processId:int}/closing")]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status400BadRequest)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status401Unauthorized)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status403Forbidden)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status404NotFound)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status409Conflict)]
[ProducesResponseType(typeof(MetaOnlyResponse), StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<MetaOnlyResponse>> CloseAsync(
[FromRoute] int wisagId,
[FromRoute] string source,
[FromRoute] int processId,
[FromBody] CloseWorkflowRequest request,
CancellationToken cancellationToken)
{
var command = new CloseWorkflowCommand(
wisagId,
source,
processId,
request.ClosingMethodId,
request.Comment,
request.RejectionReasonId);
var response = await sender.Send(command, cancellationToken);
return Ok(new MetaOnlyResponse
{
Meta = response.Meta
});
}
}

View File

@@ -0,0 +1,46 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>DigitalData.TaskFlow.API</PackageId>
<Title></Title>
<Authors>Digital Data GmbH</Authors>
<Company>Digital Data GmbH</Company>
<Product>DigitalData.TaskFlow.API</Product>
<Version>1.0.0-beta</Version>
<FileVersion>1.0.0.0</FileVersion>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Copyright>Copyright © 2026 Digital Data GmbH. All rights reserved.</Copyright>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.1" />
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="10.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
<PackageReference Include="Serilog.Sinks.SQLite" Version="7.0.0" />
<PackageReference Include="Serilog.UI" Version="3.2.0" />
<PackageReference Include="Serilog.UI.SqliteProvider" Version="1.1.0" />
<PackageReference Include="Scalar.AspNetCore" Version="2.17.14" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\PublishProfiles\IISProfileNet8.pubxml.user" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\DigitalData.TaskFlow.Application\DigitalData.TaskFlow.Application.csproj" />
<ProjectReference Include="..\..\infrastructure\DigitalData.TaskFlow.Infrastructure\DigitalData.TaskFlow.Infrastructure.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,51 @@
using DigitalData.TaskFlow.API.Contracts.Common;
using DigitalData.TaskFlow.Domain.Common;
using DigitalData.TaskFlow.Domain.Enums;
using System.Text.Json;
namespace DigitalData.TaskFlow.API.Middleware;
/// <summary>
/// Validates required API key header for API endpoints.
/// </summary>
public sealed class ApiKeyAuthMiddleware(RequestDelegate next)
{
private static readonly JsonSerializerOptions JsonOptions = new(JsonSerializerDefaults.Web);
/// <summary>
/// Executes middleware logic.
/// </summary>
/// <param name="context">HTTP context.</param>
public async Task InvokeAsync(HttpContext context)
{
if (!context.Request.Path.StartsWithSegments("/api", StringComparison.OrdinalIgnoreCase))
{
await next(context);
return;
}
if (context.Request.Headers.TryGetValue("X-Api-Key", out var values)
&& !string.IsNullOrWhiteSpace(values.FirstOrDefault()))
{
await next(context);
return;
}
context.Response.StatusCode = StatusCodes.Status401Unauthorized;
context.Response.ContentType = "application/json";
var response = new MetaOnlyResponse
{
Meta =
[
new MetaEntry
{
Code = (int)MetaCode.InvalidRequest,
Message = "Authentifizierung fehlgeschlagen"
}
]
};
await context.Response.WriteAsync(JsonSerializer.Serialize(response, JsonOptions));
}
}

View File

@@ -0,0 +1,111 @@
using DigitalData.TaskFlow.Application.Common.Exceptions;
using DigitalData.TaskFlow.API.Contracts.Common;
using DigitalData.TaskFlow.Domain.Common;
using DigitalData.TaskFlow.Domain.Enums;
using FluentValidation;
using System.Text.Json;
namespace DigitalData.TaskFlow.API.Middleware;
/// <summary>
/// Handles exceptions globally and returns ticket-compatible API envelopes.
/// </summary>
public sealed class ExceptionHandlingMiddleware(RequestDelegate next, ILogger<ExceptionHandlingMiddleware> logger)
{
private static readonly JsonSerializerOptions JsonOptions = new(JsonSerializerDefaults.Web);
/// <summary>
/// Executes the middleware.
/// </summary>
/// <param name="context">HTTP context.</param>
public async Task InvokeAsync(HttpContext context)
{
try
{
await next(context);
}
catch (ApiException apiException)
{
logger.LogWarning(apiException, "API exception intercepted.");
context.Response.StatusCode = apiException.StatusCode;
context.Response.ContentType = "application/json";
var response = new MetaOnlyResponse
{
Meta =
[
new MetaEntry
{
Code = (int)apiException.MetaCode,
Message = apiException.Message
}
]
};
await context.Response.WriteAsync(JsonSerializer.Serialize(response, JsonOptions));
}
catch (ValidationException validationException)
{
logger.LogWarning(validationException, "Validation failed.");
context.Response.StatusCode = StatusCodes.Status400BadRequest;
context.Response.ContentType = "application/json";
var message = validationException.Errors.FirstOrDefault()?.ErrorMessage
?? "Ungultiger Request";
var response = new MetaOnlyResponse
{
Meta =
[
new MetaEntry
{
Code = (int)MetaCode.InvalidRequest,
Message = message
}
]
};
await context.Response.WriteAsync(JsonSerializer.Serialize(response, JsonOptions));
}
catch (NotSupportedException notSupportedException)
{
logger.LogWarning(notSupportedException, "Operation not supported yet.");
context.Response.StatusCode = StatusCodes.Status500InternalServerError;
context.Response.ContentType = "application/json";
var response = new MetaOnlyResponse
{
Meta =
[
new MetaEntry
{
Code = (int)MetaCode.InternalError,
Message = notSupportedException.Message
}
]
};
await context.Response.WriteAsync(JsonSerializer.Serialize(response, JsonOptions));
}
catch (Exception exception)
{
logger.LogError(exception, "Unhandled exception.");
context.Response.StatusCode = StatusCodes.Status500InternalServerError;
context.Response.ContentType = "application/json";
var response = new MetaOnlyResponse
{
Meta =
[
new MetaEntry
{
Code = (int)MetaCode.InternalError,
Message = "Interner Fehler"
}
]
};
await context.Response.WriteAsync(JsonSerializer.Serialize(response, JsonOptions));
}
}
}

View File

@@ -0,0 +1,8 @@
namespace DigitalData.TaskFlow.API.Options;
public sealed class SwaggerOptions
{
public const string SectionName = "Swagger";
public bool EnabledInProduction { get; init; }
}

View File

@@ -0,0 +1,147 @@
using DigitalData.TaskFlow.Application;
using DigitalData.TaskFlow.API.Middleware;
using DigitalData.TaskFlow.API.Options;
using DigitalData.TaskFlow.Infrastructure;
using Microsoft.OpenApi.Models;
using Scalar.AspNetCore;
using Serilog;
using Serilog.Events;
using Serilog.Ui.Core.Extensions;
using Serilog.Ui.SqliteDataProvider.Extensions;
using Serilog.Ui.Web.Extensions;
var tempConfig = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: false)
.Build();
var logDirectoryRaw = tempConfig.GetValue<string>("Application:LogDirectory") ?? "logs";
var logDirectory = Path.IsPathRooted(logDirectoryRaw)
? logDirectoryRaw
: Path.Combine(AppContext.BaseDirectory, logDirectoryRaw);
Directory.CreateDirectory(logDirectory);
var sqliteDbPath = Path.Combine(logDirectory, "logs.db");
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Information()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning)
.MinimumLevel.Override("System", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.File(
path: Path.Combine(logDirectory, "taskflow-.log"),
rollingInterval: RollingInterval.Day,
retainedFileCountLimit: 30,
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}")
.WriteTo.SQLite(sqliteDbPath, storeTimestampInUtc: true)
.CreateBootstrapLogger();
try
{
Log.Information("Starting TaskFlow API");
var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration;
builder.Host.UseSerilog((context, services, loggerConfiguration) =>
{
loggerConfiguration
.ReadFrom.Configuration(context.Configuration)
.ReadFrom.Services(services)
.Enrich.FromLogContext()
.WriteTo.File(
path: Path.Combine(logDirectory, "taskflow-.log"),
rollingInterval: RollingInterval.Day,
retainedFileCountLimit: 30,
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}")
.WriteTo.SQLite(sqliteDbPath, storeTimestampInUtc: true);
if (context.HostingEnvironment.IsDevelopment())
{
loggerConfiguration.WriteTo.Console(
outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}");
}
});
// Add services to the container.
builder.Services.AddApplicationServices(config);
builder.Services.AddInfrastructureServices(config);
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "DigitalData TaskFlow API",
Version = "v1",
Description = """
Integration API for taskFLOW workflow and document operations.
---
- [Serilog Log Viewer](/serilog-ui)
""",
Contact = new OpenApiContact
{
Name = "Digital Data GmbH",
Url = new Uri("https://digitaldata.works/"),
Email = "info-flow@digitaldata.works"
}
});
});
builder.Services
.AddOptions<SwaggerOptions>()
.Bind(config.GetSection(SwaggerOptions.SectionName));
builder.Services.AddSerilogUi(options =>
{
options.UseSqliteServer(databaseOptions =>
{
databaseOptions.WithConnectionString($"Data Source={sqliteDbPath}");
databaseOptions.WithTable("Logs");
});
});
var app = builder.Build();
var swaggerOptions = app.Services
.GetRequiredService<Microsoft.Extensions.Options.IOptions<SwaggerOptions>>()
.Value;
var enableSwagger = app.Environment.IsDevelopment() || swaggerOptions.EnabledInProduction;
app.UseMiddleware<ExceptionHandlingMiddleware>();
app.UseMiddleware<ApiKeyAuthMiddleware>();
app.UseSerilogRequestLogging();
if (enableSwagger)
{
app.UseSwagger();
app.UseSwaggerUI();
app.MapScalarApiReference(options =>
{
options.Title = "DigitalData TaskFlow API";
options.Theme = ScalarTheme.BluePlanet;
});
}
app.UseHttpsRedirection();
app.UseSerilogUi();
app.UseAuthorization();
app.MapControllers();
Log.Information("TaskFlow API started successfully");
app.Run();
}
catch (Exception exception)
{
Log.Fatal(exception, "TaskFlow API failed to start");
throw;
}
finally
{
Log.CloseAndFlush();
}

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<ExcludeApp_Data>false</ExcludeApp_Data>
<ProjectGuid>5e0e17c0-ff5a-4246-bf87-1add85376a27</ProjectGuid>
<DesktopBuildPackageLocation>M:\App&amp;Service\0 DD - Funktionsmodule\TaskFlow\PreRelease\API\net8\$(Version)\DigitalData.TaskFlow.API.zip</DesktopBuildPackageLocation>
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath>EnvelopeGenerator</DeployIisAppPath>
<_TargetId>IISWebDeployPackage</_TargetId>
<TargetFramework>net8.0</TargetFramework>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<EnvironmentName>Production</EnvironmentName>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://go.microsoft.com/fwlink/?LinkID=208121. -->
<Project>
<PropertyGroup>
<History>True|2026-08-18T22:53:21.1836568Z||;True|2026-08-17T17:15:45.8141849+02:00||;True|2026-07-29T14:38:42.8852954+02:00||;True|2026-07-29T12:03:16.6266877+02:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,41 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:3557",
"sslPort": 44339
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5298",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7049;http://localhost:5298",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@@ -0,0 +1,44 @@
# DigitalData.TaskFlow.API
Dieses Projekt stellt die HTTP-Schnittstelle fuer externe Konsumenten bereit.
## Zweck
Die API-Schicht nimmt HTTP-Requests entgegen, leitet diese an die Application-Schicht weiter und liefert standardisierte Responses zurueck.
## Aktueller Inhalt
- `Program.cs`
- Startpunkt der ASP.NET-Core-Anwendung.
- Registriert Application- und Infrastructure-Dienste.
- Enthält Grundkonfiguration fuer Controller und OpenAPI/Swagger.
- `appsettings.json`
- Allgemeine Runtime-Konfiguration (Logging, ConnectionString, MediatR-Lizenz, Swagger-Optionen).
- `Controllers/`
- Zielordner fuer HTTP-Controller (aktuell noch leer).
- `Options/`
- API-spezifische Konfigurationsmodelle (z. B. `SwaggerOptions`).
## Geplante Inhalte (naechste Phasen)
- Controller fuer:
- `GET /workflows/{wisagid}`
- `POST /workflows/{wisagid}/{source}/{processid}/closing`
- `GET /documents/{id}`
- Middleware fuer:
- FluentValidation-Fehlerbehandlung
- Generelle Exception-Behandlung
- OpenAPI-Dokumentation:
- Swagger in Development, optional in Production
- Firmen-/Produkt-Metadaten
- Scalar als alternative UI
## Architektur-Regeln
- Keine direkte SQL- oder EF-Core-Logik im Controller.
- Transport-spezifische Aufgaben bleiben in API; fachliche Verarbeitung erfolgt in Application.
- Einheitliches Response-Schema gemaess Ticket-Vorgabe (`meta.code`, `meta.message`).
## Rolle im Gesamtsystem
Die API ist das Eingangstor fuer externe Systeme (z. B. fabrik19) und sorgt fuer stabile, versionierbare und gut dokumentierte Endpunkte.

View File

@@ -0,0 +1,19 @@
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Warning",
"System": "Warning"
}
}
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@@ -0,0 +1,36 @@
{
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.AspNetCore": "Warning",
"Microsoft.EntityFrameworkCore": "Warning",
"System": "Warning"
}
}
},
"ConnectionStrings": {
"TaskFlowDb": "Server=SDD-VHP04-SQL19\\DD_TESTING01;Database=DD_ECM;User Id=sa;Password=123456789dD!;Encrypt=false;TrustServerCertificate=True;"
},
"MediatR": {
"LuckyPennySoftLicenseKey": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ikx1Y2t5UGVubnlTb2Z0d2FyZUxpY2Vuc2VLZXkvYmJiMTNhY2I1OTkwNGQ4OWI0Y2IxYzg1ZjA4OGNjZjkiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2x1Y2t5cGVubnlzb2Z0d2FyZS5jb20iLCJhdWQiOiJMdWNreVBlbm55U29mdHdhcmUiLCJleHAiOiIxODE2MTI4MDAwIiwiaWF0IjoiMTc4NDYyNDU1NyIsImFjY291bnRfaWQiOiIwMTk4M2M1OWU0YjM3MjhlYmZkMzEwM2MyYTQ4NmU4NSIsImN1c3RvbWVyX2lkIjoiMDE5ODNjNTllNGIzNzI4ZWJmZDMxMDNjMmE0ODZlODUiLCJzdWJfaWQiOiItIiwiZWRpdGlvbiI6IjAiLCJ0eXBlIjoiMiJ9.IUUO926m9crYGYxMjjKD_n9BnUm-EDyjFIn0YmMUCo7C-QTwvB8WhXP8veTSFsBq-leIIDJ4jyl7Pgc_7ciwg1XhUSIs4mkQroEUaSFCGOxw7Pi41WM8MK5YFSaqLTYYXec9zxgiJbGzABbh3CHTSup3okGnVm_CMoPEs91l2c0A6N1JyZy74urd_tF0KGVKf0MOvzdlQIWLQ8o73S4pTv2N-F6UlzI0fdMtTHMLNNQyr0NdWdnuBk_jMBXO-gy5RE_oCRfMTTYRX2n3XLK6pTfXE0Ct338o9F5sH8Ph2lTXSu56cpdsfZOQZGqCH0LoFp1Dd7RJgIgNmBiTGfvDnA"
},
"Swagger": {
"EnabledInProduction": false
},
"Database": {
"CommandTimeoutSeconds": 30,
"WorkflowListingObjectType": "Ferdinand"
},
"Application": {
"LogDirectory": "logs"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}