Commit Graph

253 Commits

Author SHA1 Message Date
009bb623b5 Add EnsureEntity<T> method to DbModelOptions
Introduce EnsureEntity<T>(bool isVirtual) to validate and ensure entity options exist for a given type in either Entities or VirtualEntities. Throws an exception if options are missing.
2025-12-10 14:24:45 +01:00
f8e7f8c974 Switch DbModelOptions to use dictionaries for entities
Changed Entities and VirtualEntities from IEnumerable to Dictionary<string, T> in DbModelOptions, enabling direct access by string keys and improving lookup efficiency.
2025-12-10 13:56:41 +01:00
959b56c4bb Add ColumnNames property to EntityBaseOptions
Added a new ColumnNames property that exposes the column names from the ColumnMappings dictionary as an IEnumerable<string> in the EntityBaseOptions record. This provides convenient access to mapped column names alongside existing property name access.
2025-12-10 13:52:49 +01:00
5a56125444 Add PropertyNames property to EntityBaseOptions
Introduce PropertyNames as a read-only property exposing the keys of ColumnMappings. Refactor EnsureProperties to use PropertyNames for improved clarity and maintainability.
2025-12-10 13:52:16 +01:00
48039b8fd5 Rename ColumnName to ColumnMappings in EntityBaseOptions
Renamed the ColumnName property to ColumnMappings in the EntityBaseOptions record for improved clarity and consistency. Updated all internal references accordingly; no changes to logic or initialization.
2025-12-10 13:46:23 +01:00
31d1d9d171 Add EnsureProperties<T> for attribute-based config validation
Added EnsureProperties<T>() to EntityBaseOptions, enabling automatic validation of required properties marked with MustConfiguredAttribute via reflection. This reduces manual configuration and improves maintainability.
2025-12-10 13:43:58 +01:00
1419455b36 Add MustConfiguredAttribute and update project file
Added MustConfiguredAttribute for property usage in ReC.Domain.Attributes. Removed explicit "Attributes\" folder reference from ReC.Domain.csproj since the folder now contains code.
2025-12-10 13:32:42 +01:00
a6111cdc66 Rename Columns to ColumnName; add Attributes folder
Renamed the Columns property to ColumnName in EntityBaseOptions.cs,
updating all references accordingly. Added an "Attributes" folder
entry to ReC.Domain.csproj for future organization.
2025-12-10 13:30:47 +01:00
3caa6b9bd3 Add params overload for EnsureProperties in EntityBaseOptions
Added a public EnsureProperties method accepting a params string[] in EntityBaseOptions. This provides a more convenient way to ensure multiple properties are configured, internally delegating to the existing IEnumerable-based method.
2025-12-10 13:28:38 +01:00
fb08a45c57 Add EnsureProperties method to EntityBaseOptions
Introduce EnsureProperties to validate required property names
against the Columns dictionary, throwing an exception if any
are missing. This helps enforce configuration completeness.
2025-12-10 13:26:42 +01:00
0588ba33d8 Add DbModelOptions record for entity configuration
Introduced DbModelOptions in ReC.Infrastructure.Options to encapsulate collections of EntityOptions and VirtualEntityOptions, providing a structured way to configure entities and virtual entities. Both properties are initialized to empty collections by default.
2025-12-10 12:42:23 +01:00
535fdbb7b4 Refactor entity options to use shared base class
Introduce EntityBaseOptions with Columns property.
Update EntityOptions and VirtualEntityOptions to inherit from EntityBaseOptions for improved code reuse and consistency.
2025-12-10 12:32:34 +01:00
4206a962ff Refactor option records and improve namespace structure
Renamed Table to TableOptions and moved it, along with EntityOptions and VirtualEntityOptions, to the ReC.Infrastructure.Options.Shared namespace. Split records into separate files for better modularity and updated EntityOptions to reference TableOptions. This enhances code organization and naming consistency.
2025-12-10 12:24:39 +01:00
ae059e4416 Add VirtualEntityOptions and EntityOptions records
Introduced two new record types: VirtualEntityOptions (currently empty) and EntityOptions, which encapsulates a Table instance. These additions lay groundwork for future entity configuration options.
2025-12-10 12:16:50 +01:00
d771dbbc9e Add Table record in ReC.Infrastructure.Options namespace
Introduced a new Table record with Name and optional Schema properties under the ReC.Infrastructure.Options namespace. This addition provides a structured way to represent database table metadata.
2025-12-10 12:10:06 +01:00
73ffaaab08 Remove RecActionView entity and its database mapping
Deleted the RecActionView class, including all properties and data annotations, removing its mapping to the VWREC_ACTION view and related relationships from the codebase.
2025-12-10 12:06:20 +01:00
b79fcf936b Refactor RecAction mapping to Fluent API in DbContext
Moved all RecAction table and column mappings from data annotations in the entity class to Fluent API configuration in RecDbContext. Also consolidated the OutRes relationship setup into the new configuration block, removing redundant mapping code. RecAction is now a plain class without EF attributes.
2025-12-10 12:04:43 +01:00
674c14dd7c Refactor Profile mapping to use Fluent API in DbContext
Moved table and column mapping for Profile from data annotations
in the entity class to Fluent API configuration in RecDbContext.
Removes dependency on DataAnnotations in Profile.cs and
centralizes entity configuration in the DbContext.
2025-12-10 12:02:20 +01:00
b326e7e1b3 Refactor EndpointAuth EF mapping to Fluent API
Moved EF Core configuration for EndpointAuth from data annotations in the entity class to Fluent API in RecDbContext. This centralizes table, key, and property mappings, improving maintainability and consistency.
2025-12-10 12:00:21 +01:00
3f8ba7d76c Move Endpoint entity config to Fluent API in DbContext
Removed data annotations from Endpoint class and defined its table, key, and column mappings using Fluent API in RecDbContext. This centralizes entity configuration and improves code maintainability.
2025-12-10 11:58:42 +01:00
13346b610a Refactor Connection entity to use Fluent API mapping
Removed data annotations from Connection.cs and moved all table and column mapping to RecDbContext's OnModelCreating using the Fluent API. This centralizes entity configuration and removes dependencies on DataAnnotations in the entity class.
2025-12-10 11:56:14 +01:00
8bc9b85049 Move RawHeader column mapping to Fluent API config
Removed data annotation from HeaderQueryResult and mapped RawHeader to REQUEST_HEADER using Fluent API in RecDbContext. Centralizes entity configuration in the DbContext.
2025-12-10 11:50:55 +01:00
141e77f315 Remove EF Core data annotations from OutRes entity
Refactored the OutRes class to eliminate all Entity Framework Core data annotations, including table, key, column, and foreign key attributes. The entity now contains only property definitions, decoupling it from direct database schema mapping and allowing for alternative configuration or usage outside of EF Core.
2025-12-10 11:48:59 +01:00
f9a4d93495 Add OutRes entity mapping to RecDbContext
Configured OutRes entity to map to TBREC_OUT_RESULT table,
including primary key and property-to-column mappings.
2025-12-10 11:47:58 +01:00
79f771b3ea Remove EF Core data annotations from EndpointParam class
Refactored EndpointParam by removing all Entity Framework Core
data annotations and related using directives. The class now
contains only plain C# properties, with database mapping
responsibilities likely moved to Fluent API or another ORM
configuration approach.
2025-12-10 11:35:45 +01:00
8738c15804 Configure EndpointParam entity in RecDbContext
Added mapping for EndpointParam to TBREC_CFG_ENDPOINT_PARAMS table, including key and property-to-column configurations in OnModelCreating.
2025-12-10 11:34:28 +01:00
70c07c9595 Enhance RecActionView entity mapping in DbContext
Added explicit table and column mappings for RecActionView in DbContext. The entity is now mapped to the "VWREC_ACTION" table in the "dbo" schema, with each property aligned to its corresponding database column for improved accuracy.
2025-12-10 11:29:27 +01:00
96fe9c99da Move BodyQueryResult column mapping to Fluent API
Replaced data annotation with Fluent API configuration for BodyQueryResult.RawBody column mapping in RecDbContext, centralizing entity configuration and removing the [Column("REQUEST_BODY")] attribute from the entity class.
2025-12-10 11:05:09 +01:00
1e62a70866 Enable cascade delete for RecAction-OutRes relationship
Added DeleteBehavior.Cascade to the RecAction-OutRes one-to-one relationship in RecDbContext. Now, deleting a RecAction will also delete its related OutRes entity automatically. Previously, the delete behavior was not specified.
2025-12-10 10:38:55 +01:00
f4aa0b5965 Redirect root URL to Swagger UI; add required usings
Added several using directives to Program.cs for new dependencies. Updated HTTP pipeline to redirect requests from "/" to "/swagger" when Swagger is enabled, improving developer experience by automatically showing the API documentation.
2025-12-10 10:12:13 +01:00
1700fe978d Bump version to 1.0.2-beta in ReC.API.csproj
Updated project, assembly, and file versions to 1.0.2-beta/1.0.2.0 for new beta release. No other changes made.
2025-12-09 13:58:21 +01:00
37c88812e1 Simplify InvokeRecActionsCommandHandler dependencies and logic
Refactored InvokeRecActionsCommandHandler to only require ISender,
removing IServiceScopeFactory, IHttpClientFactory, and ILogger.
Replaced concurrent invocation and error handling with a simple
sequential loop, streamlining batch recommendation action execution.
2025-12-09 13:56:35 +01:00
34efb662ec Update version and assembly metadata to 1.0.1-beta
Updated `<Version>`, `<AssemblyVersion>`, and `<FileVersion>`
to reflect the minor version update from 1.0.0-beta to
1.0.1-beta. `<InformationalVersion>` remains unchanged.
2025-12-08 13:08:53 +01:00
dcbff90ed8 Remove 400 Bad Request response from Delete method
The `[ProducesResponseType(StatusCodes.Status400BadRequest)]`
attribute was removed from the `Delete` method in the
`OutResController` class. This change simplifies the API
response documentation, leaving only the `204 No Content`
response explicitly defined. The method is no longer expected
to return a `400 Bad Request` status code, reflecting a change
in behavior or a decision to streamline the API's response
documentation.
2025-12-08 11:52:58 +01:00
404a1c4793 Add Delete method for fake profile in OutResController
Added a new `Delete` method to the `OutResController` class to
delete all output results for a fake/test profile. The method
is accessible via the `DELETE /fake` route and supports
cancellation via a `CancellationToken`.

Included XML documentation for the method, describing its
purpose, parameters, and return type. Added `[ProducesResponseType]`
attributes to specify possible HTTP response codes: `204 No Content`
for success and `400 Bad Request` for invalid requests.

The method uses `IMediator` to send a `DeleteOutResCommand`
with a `ProfileId` obtained from the `IConfiguration` instance.
2025-12-08 11:50:30 +01:00
1cdd28738a Add Delete endpoint to OutResController
Added a new HTTP DELETE endpoint to the OutResController to allow deletion of output results based on criteria provided in the DeleteOutResCommand. The endpoint supports cancellation via a CancellationToken and returns a 204 No Content response on success. Updated using directives to include necessary namespaces for commands and queries. Added response type annotations for better API documentation.
2025-12-08 11:47:05 +01:00
45c7259ce8 Add XML documentation for DeleteOutResCommand and handler
Enhanced the `DeleteOutResCommand` and `DeleteOutResCommandHandler`
with detailed XML documentation comments. These comments describe
the purpose, usage, and deletion logic, including criteria based
on `ActionId` or `ProfileId`. Improved clarity for maintainers
and users of the codebase.
2025-12-08 11:45:17 +01:00
6d9985051e Add DeleteOutResCommandHandler for repository deletion
Updated using directives to include necessary dependencies for
repository and domain entities. Introduced the
DeleteOutResCommandHandler class to handle DeleteOutResCommand
requests. The handler uses IRepository<OutRes> to delete records
based on ActionId or ProfileId. Implemented asynchronous
deletion logic with support for cancellation tokens.
2025-12-08 11:42:08 +01:00
b9f5a3f10c Add DeleteOutResCommandValidator for input validation
Introduce DeleteOutResCommandValidator using FluentValidation
to enforce business rules for the DeleteOutResCommand. Added
a validation rule to ensure at least one of ActionId or
ProfileId is provided, with a descriptive error message if
neither is present. Included necessary using directives for
FluentValidation and the relevant namespace.
2025-12-08 11:28:43 +01:00
243cc97aa2 Add DeleteOutResCommand for CQRS pattern
Introduced the `DeleteOutResCommand` record in the `ReC.Application.OutResults.Commands` namespace. This command implements the `IRequest` interface from `MediatR` and includes two nullable properties: `ActionId` and `ProfileId`. Added the `MediatR` library to support the CQRS pattern.
2025-12-08 11:17:11 +01:00
bb43bfa064 Refactor property in RecActionView class
Replaced the `ProfileSequence` property with `Sequence` in the
`RecActionView` class. Updated the database column mapping
from `PROFILE_SEQUENCE` to `SEQUENCE`. This change aligns
with updates to the database schema and improves naming
consistency.
2025-12-08 11:04:52 +01:00
b4966585ae Enhance logging, Swagger, and XML documentation support 2025-12-08 10:44:15 +01:00
ae548d530f Enable Swagger via configuration setting
Added a condition in `Program.cs` to enable Swagger when the `UseSwagger` configuration value is `true`, in addition to the development environment.

Introduced a new `UseSwagger` setting in `appsettings.json` with a default value of `true`, allowing Swagger to be conditionally enabled in non-development environments. This improves flexibility for Swagger usage across different environments.
2025-12-08 10:07:57 +01:00
b71ea7d346 Update log file naming convention in NLog config
The `logFileNamePrefix` variable in the `NLog` configuration was updated to use a period (`.`) instead of a hyphen (`-`) as the separator between the date and the application name.

Old format: `${shortdate}-Rec.API.Web`
New format: `${shortdate}.Rec.API`

This change aligns the log file naming convention with a new standard or improves consistency across file naming practices.
2025-12-05 10:32:11 +01:00
3764fdaf01 Enhance logging and refactor app startup
- Integrated `NLog` for improved logging capabilities.
- Added a logger instance and initialized logging with `NLog`.
- Wrapped app setup in a `try-catch` block to handle startup exceptions.
- Configured logging to use `NLog` in non-development environments.
- Refactored service registration for better organization.
- Retained key configurations for `AddRecServices` and `AddRecInfrastructure`.
- Reorganized middleware pipeline setup for clarity.
- Added exception logging during startup to improve debugging.
2025-12-05 10:27:37 +01:00
5e7287bf86 Update copyright and add NLog dependencies
Updated the copyright year to 2025 for "Digital Data GmbH."
Added `NLog` (v5.2.5) and `NLog.Web.AspNetCore` (v5.3.0)
package references to introduce logging capabilities.
No functional changes were made to the `Swashbuckle.AspNetCore`
package reference, though it was reformatted slightly.
2025-12-05 10:00:58 +01:00
9992086e48 Add NLog configuration and minor property updates
Added a new NLog configuration section in `appsettings.json` to enable structured logging. This includes settings for log file storage, log targets for different levels (Info, Warn, Error, Fatal), and retention policies.

Added the `NLog` property to the configuration. Introduced a new `AddedWho` property with the value `ReC.API`.

Removed and re-added the `FakeProfileId` property without changing its value. No changes were made to `LuckyPennySoftwareLicenseKey` or `RecAction` sections.
2025-12-05 09:58:05 +01:00
40019bf693 Update build package path for dynamic versioning
The `<DesktopBuildPackageLocation>` property in `IISProfile.pubxml`
was updated to remove the hardcoded `net8` subdirectory. The path
now dynamically uses the `$(Version)` variable directly under the
`API` directory, improving flexibility and reducing the need for
manual updates when versions change.
2025-12-05 09:37:47 +01:00
4b9e577d41 Add IIS publish profile configuration
Added an XML declaration and structured the IIS publish profile
with a `<Project>` root element and a `<PropertyGroup>`
containing key properties for web publishing. Configured the
publish method as `Package`, set the build configuration to
`Release`, and specified the IIS deployment path. Included
settings for packaging as a single file and defined the build
package location with a version placeholder.
2025-12-05 09:35:45 +01:00
4e6cb20dc2 Add metadata for NuGet packaging in ReC.API.csproj
Enhanced the project file (`ReC.API.csproj`) with metadata
to prepare the package for distribution. Added properties
such as `PackageId`, `Authors`, `Company`, `Product`,
`PackageIcon`, `PackageTags`, `Version`, `AssemblyVersion`,
`FileVersion`, `InformationalVersion`, and `Copyright`.
These changes ensure the package contains detailed
information for consumers and aligns with NuGet standards.
2025-12-05 09:29:58 +01:00