Introduce two new classes in the DigitalData.TaskFlow.API.Models namespace to handle workflow closure requests and responses.
- CloseWorkflowReqBody.cs:
- Added CloseWorkflowReqBody class with properties:
- ClosingMethodId: int, mapped to "closing_method_id".
- Comment: nullable string.
- RejectionReasonId: nullable byte, mapped to "rejection_reason_id".
- CloseWorkflowReqResponse.cs:
- Added CloseWorkflowReqResponse class with Meta property:
- Meta: List of CloseWorkflowResult, initialized to an empty list.
Introduce CloseWorkflowCommandHandler class to handle the
closure of workflows using the MediatR library. This class
implements IRequestHandler and processes CloseWorkflowCommand
requests, returning CloseWorkflowResult objects. It interacts
with IWorkflowRepository to execute the CloseAsync method,
validating the procedure result and throwing an exception if
the result is invalid. Necessary using directives for
DigitalData.TaskFlow.Application.Common.Interfaces and MediatR
are also added.
Introduced a new asynchronous method `CloseAsync` in the
`WorkflowRepository` class to handle workflow process closing.
This method executes the `PRCUST_F19_CLOSING` stored procedure
with parameters for user ID, source, process ID, closing method
ID, comment, and rejection reason ID. It uses `FromSqlInterpolated`
for safe SQL parameterization and retrieves results with
`AsNoTracking()` and `ToListAsync(cancellationToken)`. The method
returns the first result as a `WorkflowClosing` object or `null`.
Introduced a new method `CloseAsync` in the `IWorkflowRepository`
interface to handle workflow item closure and return a procedure
result. Added a new class `WorkflowClosing` in `WorkflowClosing.cs`
as a sealed class inheriting from `ProcedureResultBase`.
Updated `TaskFlowDbContext` to include a `DbSet<WorkflowClosing>`
for keyless workflow close procedure results. Configured the
`WorkflowClosing` entity in `OnModelCreating` with specific
column mappings and a maximum length for the `Result` property.
Introduce CloseWorkflowCommand and CloseWorkflowResult records
in CloseWorkflowCommand.cs within the DigitalData.TaskFlow
namespace. The command encapsulates data for closing a workflow,
including WisagId, Source, ProcessId, ClosingMethodId, Comment,
and RejectionReasonId. The result record provides ResultCode and
ResultMessage to convey the operation's outcome. These changes
utilize MediatR, aligning with the CQRS pattern for state
modification.
Updated the `appsettings.Development.json` and `appsettings.json` files to replace the `ApiKey` value from `null` to `"jGXP7m536fnyTVCh4NROu1wgjaSOrJ5"`. This ensures that a specific API key is used in both development and production environments.
The versioning information for the `DigitalData.TaskFlow.API` project has been updated. The `<Version>`, `<FileVersion>`, and `<AssemblyVersion>` elements have been incremented from `1.1.0-beta` to `1.2.0-beta`, and from `1.1.0.0` to `1.2.0.0` respectively. This minor version update likely includes new features or improvements that maintain backward compatibility.
Removed the `asByte` parameter from XML documentation in `DocumentController.cs`, indicating the method no longer supports byte array returns. Added a new HTTP POST endpoint `CloseAsync` in `WorkflowsController.cs`, which is currently not implemented and throws a `NotImplementedException`. Enhanced `ExceptionHandlingMiddleware.cs` to handle `NotImplementedException` by logging a warning and returning a `501 Not Implemented` response in a problem details format.
Introduce a new entity class `CustDocBase64` mapped to the
`TBCUST_DOC_BASE64` table in the `dbo` schema. This class includes
properties for various document attributes. Update `TaskFlowDbContext`
to include a `DbSet<CustDocBase64>` for querying and interacting with
the table. Configure the entity in `OnModelCreating` to have no key
and map it to the appropriate table and schema.
The versioning information for the DigitalData.TaskFlow.API project has been updated. The <Version>, <FileVersion>, and <AssemblyVersion> elements have been incremented from 1.0.0-beta, 1.0.0.0, and 1.0.0.0 respectively to 1.1.0-beta, 1.1.0.0, and 1.1.0.0. This indicates a minor version update, suggesting that new features or improvements have been added to the project while maintaining backward compatibility.
Add validation in CloseWorkflowCommandHandler to reject "Contracts" as a source for closing operations. Modify ReadArray in WorkflowRepository to accept multiple property names, improving flexibility in data retrieval. Refactor database reader logic to extract JSON payloads more robustly, iterating over all fields and results.
Introduced `ApiKeyAuthOptions` for API key configuration,
including a `Key` property and `SectionName` for binding.
Updated `ApiKeyAuthMiddleware` to validate the `X-Api-Key`
header against the configured API key.
Added conditional middleware application in `Program.cs`
based on the presence of a configured API key. Bound the
`ApiKey` section in `appsettings.json` and
`appsettings.Development.json` to store the API key, with
a default value of `null`. This improves security and
centralizes API key management.
Updated the `.gitignore` file to exclude the `IISProfileNet8.pubxml.user` file from version control. Removed the `IISProfileNet8.pubxml.user` file entirely, which contained environment-specific configuration details such as a `History` property with timestamps and an empty `LastFailureDetails` property. This change prevents sensitive or local configuration data from being tracked in the repository.
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.
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.
- 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.
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.
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.
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`.
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.
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.
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.
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.
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.
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.