Commit Graph

716 Commits

Author SHA1 Message Date
1ad7ff3b34 Add InfoDetail property to ResultViewDto
Added a nullable string property InfoDetail with a public setter to the ResultViewDto record for storing additional detailed information. No changes were made to the existing Error property.
2026-04-02 20:36:03 +02:00
bcfbd851bd Simplify RecStatus to OK/Error and update extensions
Refactored the RecStatus enum to only include OK and Error values,
removing all HTTP status code mappings and related documentation.
Updated RecStatusExtensions to map HTTP 2xx codes to OK and all
others to Error, and removed obsolete conversion and success logic.
This clarifies the separation between general operation status and
protocol-specific details.
2026-04-02 20:35:48 +02:00
2e157656a7 Update validator registration assembly in DI setup
Changed validator registration to use the assembly containing InsertObjectProcedureValidator instead of AuthScopedValidator, ensuring the correct set of validators are included in the dependency injection container.
2026-03-30 15:36:18 +02:00
8042a6f898 Update project version to 2.1.0-beta
Bump version numbers in ReC.API.csproj from 2.0.2-beta to 2.1.0-beta, including Version, AssemblyVersion, FileVersion, and InformationalVersion fields. No other changes were made.
2026-03-30 14:53:01 +02:00
f25fc627fe Update AutoMapper to version 16.1.1
Upgraded the AutoMapper NuGet package in ReC.Application.csproj from version 15.1.0 to 16.1.1 to ensure compatibility with the latest features and bug fixes. No other dependencies were changed.
2026-03-30 14:48:17 +02:00
d6af24cd91 Remove PlaceholderResolutionException class
Deleted the PlaceholderResolutionException class and its namespace. This exception was previously used for unresolved placeholders due to missing properties. All related properties and custom messages have been removed.
2026-03-30 14:33:23 +02:00
bb5eac023c Change ReplacePlaceholders to return NULL for unresolved
Previously, ReplacePlaceholders threw PlaceholderResolutionException when a placeholder could not be resolved. Now, unresolved placeholders are replaced with "NULL" instead. All exception references and related tests have been updated to reflect this new behavior. Documentation has also been revised accordingly.
2026-03-30 14:33:13 +02:00
77baf395ce Update ReplacePlaceholders mapping to use single argument
Removed src.Profile from ReplacePlaceholders calls in DtoMappingProfile for PreprocessingQuery and PostprocessingQuery mappings, now passing only src as the argument. This simplifies the mapping logic and aligns with the updated method signature.
2026-03-30 14:32:31 +02:00
6c9eab6df6 Refactor ResultViewDto status and add info/error fields
Replaced StatusCode with a RecStatus Status property in ResultViewDto. Added Info and Error string properties to provide additional result details. Imported ReC.Domain.Constants for RecStatus usage.
2026-03-30 13:21:48 +02:00
c64794755d Remove "EXEC" from stored procedure call in builder
Standardize StoredProcedureBuilder usage by omitting the "EXEC" keyword when specifying the procedure name. This ensures consistent and correct invocation of stored procedures.
2026-03-30 13:21:11 +02:00
de2185bf0a Specify byte as underlying type for ResultType enum
Changed ResultType enum declaration to explicitly use byte as its underlying type for improved memory efficiency and clarity.
2026-03-30 13:20:40 +02:00
fde9735b27 Remove redundant Result property validation in InsertObject
Removed the rule requiring Result to have StatusId, Info, or Error set. Now only ResultActionId is required when Result is present.
2026-03-30 13:20:21 +02:00
0342b9e0c6 Unify error status code as RecStatus.Failed
Renamed RecStatus.QueryFailed to RecStatus.Failed and updated all usages and documentation to reflect its broader purpose as a general failure code for any operation, not just SQL queries. Improved consistency in error handling and status reporting across the codebase.
2026-03-30 11:55:58 +02:00
47698b9046 Rename ToStatus to ToRecStatus for HttpStatusCode conversion
Standardize extension method naming by renaming ToStatus to ToRecStatus for converting HttpStatusCode to RecStatus across the codebase. Updated all usages and related tests for consistency and clarity.
2026-03-30 11:40:26 +02:00
a03d21ebc6 Rename StatusExtensions to RecStatusExtensions for clarity
Renamed the StatusExtensions class and related XML documentation references to RecStatusExtensions to better reflect its association with the RecStatus enum and improve code clarity and consistency.
2026-03-30 11:39:37 +02:00
acff0aca89 Rename Status enum to RecStatus across the codebase
Refactored all usages of the Status enum to RecStatus to improve clarity and prevent naming conflicts with other status enums (e.g., HTTP status codes). Updated command handlers, behaviors, data models, and extension methods to use RecStatus, and adjusted related serialization logic accordingly. This makes the domain-specific status handling more explicit and maintainable.
2026-03-30 11:35:22 +02:00
ce0e53baf6 Update test for InsertResultCommand Status property change
Refactored InsertResultProcedure_runs_via_mediator to use the new Status property (set via HttpStatusCode.OK.ToStatus()) instead of the old StatusId integer. Added necessary using directives to support updated types and methods.
2026-03-30 11:33:42 +02:00
620c0eff22 Add ToStatus extension for HttpStatusCode to Status conversion
Introduced a ToStatus extension method in StatusExtensions to enable direct conversion from HttpStatusCode to Status by casting. This simplifies mapping between HTTP status codes and internal Status values.
2026-03-30 11:33:28 +02:00
68f4486fa1 Make Status required in InsertResultCommand
Changed the Status property in InsertResultCommand from nullable to required, ensuring that a Status value must always be provided when creating an instance. This improves data integrity and prevents accidental omission of the Status field.
2026-03-30 11:33:08 +02:00
2b5e63cb45 Update result status handling in InsertResultCommand
Replaced StatusId with Status property in InsertResultCommand, mapping HTTP status codes to application-specific status enums using ToStatus(). Exception handling now sets Status to QueryFailed. Removed usage of StatusId.
2026-03-30 11:22:57 +02:00
e9e697fa0d Update to use Result.Status instead of StatusId in insert proc
Changed the parameter for "pRESULT_STATUS_ID" from request.Result?.StatusId to request.Result?.Status in InsertObjectProcedureHandler. This aligns with updates to the data model or business logic, ensuring the correct status property is used when inserting objects.
2026-03-30 11:22:27 +02:00
606eccb855 Add Status to InsertResultCommand for query outcome reporting
Enhance PostprocessingBehavior and PreprocessingBehavior to set the Status property on InsertResultCommand. Status is now set to QuerySuccess on successful execution and QueryFailed on exceptions, improving clarity of query execution results.
2026-03-30 11:11:51 +02:00
3146acfa45 Refactor InsertResultCommand to use Status enum
Replaced StatusId (short?) with Status (Status?) in InsertResultCommand, moving from a numeric status identifier to a more descriptive or structured status representation from ReC.Domain.Constants.
2026-03-30 11:11:28 +02:00
f363872e7a Refactor ResultView: replace StatusCode with Status object
Replaced the short? StatusCode property in ResultView with a Status object to provide a more descriptive representation of status information. This change improves code clarity and supports richer status handling.
2026-03-30 10:51:58 +02:00
ed4683323d Change Status enum underlying type to short
Explicitly set the Status enum's underlying type to short instead of the default int to optimize memory usage and clarify intent. No other changes were made.
2026-03-30 10:50:33 +02:00
4aeef10ef7 Add StatusExtensions with HTTP status mapping methods
Added StatusExtensions.cs with extension methods for Status and HttpStatusCode:
- ToHttpStatusCode maps Status to nullable HttpStatusCode if possible.
- IsSuccess checks if a Status or HttpStatusCode represents a successful response.
- Handles both direct Status values and those convertible to HTTP codes.
2026-03-30 10:41:39 +02:00
e04e90d8c6 Add Status enum for HTTP and SQL operation status codes
Introduced Status enum in ReC.Domain.Constants to unify status reporting for both HTTP responses and SQL query execution results. The enum includes all standard HTTP status codes and custom codes for SQL query success/failure, with detailed documentation for each value. This standardizes status handling across web and database operations.
2026-03-30 10:41:09 +02:00
93b5f976d3 Refactor stored procedure SQL construction and execution
Centralize stored procedure SQL generation in StoredProcedureBuilder,
allowing handlers to specify procedure name and return variable.
Removes manual SQL string building from DeleteObjectProcedure and
UpdateObjectProcedure handlers, reducing boilerplate and improving
maintainability.
2026-03-30 09:30:07 +02:00
b66a49f74d Refactor: add StoredProcedureBuilder for SQL calls
Introduce StoredProcedureBuilder to centralize and simplify the construction of SQL stored procedure calls and parameter lists. Refactor DeleteObjectProcedureHandler, InsertObjectProcedureHandler, and UpdateObjectProcedureHandler to use this utility, replacing manual StringBuilder and parameter management. Improves code readability, reduces duplication, and standardizes parameter handling, including output parameters.
2026-03-27 15:11:16 +01:00
70dc52139d Refactor SQL param and command construction in procedures
Refactored InsertObject, UpdateObject, and DeleteObject procedure handlers to dynamically build SQL command strings and parameter lists. Introduced local Add functions to include only non-null parameters, improving code clarity and reducing unnecessary SQL parameter passing. The logic for handling stored procedure results and exceptions remains unchanged.
2026-03-27 14:58:56 +01:00
210ed9be8d Refactor SQL construction with StringBuilder for clarity
Refactored DeleteObjectProcedureHandler, InsertObjectProcedureHandler, and UpdateObjectProcedureHandler to use StringBuilder for building SQL command strings. This improves readability and maintainability without changing the logic or parameters. Added System.Text using directives as needed.
2026-03-27 14:54:27 +01:00
b2544b64e3 Refactor: use named params in SP calls, cleanup usings
Updated Delete, Insert, and Update object procedure handlers to use named parameters in SQL stored procedure calls instead of positional parameters, improving clarity and reducing risk of misalignment. Also removed unused using statements from UpdateObjectProcedure.cs.
2026-03-27 14:21:45 +01:00
0b1e0d25ca Explicitly set SqlDbType.TinyInt for relevant SQL parameters
Updated InsertObjectProcedureHandler and UpdateObjectProcedureHandler to explicitly specify SqlDbType.TinyInt for parameters representing TINYINT columns. Also improved handling of nullable and enum values for these parameters to ensure correct type casting and null handling. This enhances type safety and prevents potential SQL type conversion issues.
2026-03-27 14:19:19 +01:00
c1027abfc6 Specify SqlDbType.SmallInt for relevant SqlParameters
Explicitly set SqlDbType.SmallInt for parameters related to small integer fields in UpdateObjectProcedureHandler. This improves type safety and prevents potential data conversion issues by ensuring correct parameter types are sent to SQL Server.
2026-03-27 13:30:28 +01:00
40c8fa359c Specify SqlDbType.SmallInt for relevant SqlParameters
Explicitly set SqlDbType.SmallInt for parameters related to endpoint params, SQL connection, profile language, and endpoint params group. This ensures correct type handling and prevents potential data conversion issues with the database.
2026-03-27 13:29:43 +01:00
1375f5f0e4 Set @pRESULT_STATUS_ID param type to SmallInt explicitly
Explicitly specify SqlDbType.SmallInt for the @pRESULT_STATUS_ID parameter when calling the stored procedure. This change ensures correct type handling and helps prevent potential SQL type mismatches or conversion errors.
2026-03-27 13:13:36 +01:00
29bc0cf8b5 Relax RESULT validation to allow StatusId, Info, or Error
Previously, RESULT required a non-null StatusId. Now, validation passes if at least one of StatusId, Info, or Error is provided, making the requirements more flexible.
2026-03-27 09:46:43 +01:00
c8b264cef6 Improve null safety in InsertObjectProcedureValidator
Updated validation logic to use null-forgiving operators and added null checks for nested properties in When clauses. This ensures rules are only applied when parent objects are not null, preventing possible null reference errors and improving overall robustness.
2026-03-27 09:40:33 +01:00
078525d85d Refactor RecAction invoke endpoint to use profileId param
Changed the HTTP POST route to accept a profileId instead of a command object, updated XML documentation accordingly, and refactored the method to construct the command internally using the provided profileId before sending it to the mediator. This improves clarity and API usability.
2026-03-27 09:26:13 +01:00
b3dfdd1e5c Update namespaces to Common.Dto for DTO-related files
Refactored PlaceholderExtensions, DtoMappingProfile, and InvokeActionTests
to use the ReC.Application.Common.Dto namespace instead of
ReC.Application.Common.Behaviors.Action. Updated using directives and
namespaces to improve code organization for DTO-related logic.
2026-03-26 16:52:54 +01:00
bd78ada686 Remove all DTO class definitions from application
Deleted the contents of several DTO files, including ConnectionDto, EndpointAuthDto, EndpointDto, EndpointParamDto, OutResDto, ProfileDto, and RecActionDto. These files previously contained record definitions for data transfer objects used throughout the application. All related code, including properties and using directives, has been removed, leaving the files empty.
2026-03-26 15:48:49 +01:00
2b4773a4c0 Remove Root and ActionId from ResultViewDto
Removed the Root (OutResDto?) and ActionId (long?) properties from the ResultViewDto record to simplify its structure and remove unused fields.
2026-03-26 15:48:35 +01:00
ff7d6c99ae Update RecActionViewDto mapping and add Profile property
Refactored DtoMappingProfile to pass both the source object and its Profile to ReplacePlaceholders when mapping queries. Added a nullable Profile property to RecActionViewDto to include full profile details in the DTO.
2026-03-26 15:48:06 +01:00
fa438e70cb Allow ReplacePlaceholders to handle null objects safely
Updated ReplacePlaceholders to accept nullable objects and skip nulls during placeholder resolution, preventing NullReferenceExceptions when nulls are passed in the objects array.
2026-03-26 15:32:00 +01:00
4931d3b8aa Map queries with placeholders replaced in DTOs
Updated RecActionView to RecActionViewDto mapping to replace placeholders in PreprocessingQuery and PostprocessingQuery using ReplacePlaceholders. Added necessary using directive for the extension method.
2026-03-26 15:28:08 +01:00
6aae26bfb6 Update using directive to new Action namespace
Replaced the using directive for InvokeAction with Action in InvokeActionTests.cs to reflect recent namespace reorganization. No other changes were made.
2026-03-26 15:23:30 +01:00
38d8ef6e93 Update namespace in PlaceholderExtensions.cs
Changed namespace from ReC.Application.Common.Behaviors.InvokeAction to ReC.Application.Common.Behaviors.Action for consistency. No other code changes were made.
2026-03-26 14:58:01 +01:00
7bc5428bd4 Refactor: move query behaviors to Action namespace
Updated the namespaces for BodyQueryBehavior and HeaderQueryBehavior from ReC.Application.Common.Behaviors to ReC.Application.Common.Behaviors.Action. Adjusted related imports in DependencyInjection.cs to reflect this change for improved code organization.
2026-03-26 14:40:50 +01:00
c405f369ac Add unit tests for InvokeAction placeholder replacement
Introduce InvokeActionTests.cs with comprehensive tests for:
- Placeholder replacement logic (ReplacePlaceholders) across int, bool, string, DateTime, DateTimeOffset types, multiple placeholders, and various prefix formats.
- Value extraction by column name (GetValueByColumnName), including models with and without [Column] attributes.
- Exception handling for unresolvable placeholders and invalid input scenarios.
These tests ensure robust coverage of both normal and error cases.
2026-03-26 14:37:58 +01:00
c2e073dade Add ReplacePlaceholders for SQL-style string interpolation
Introduce ReplacePlaceholders to PlaceholderExtensions, enabling replacement of {#...#COLUMN_NAME} placeholders in strings with property values from provided objects. Uses a generated regex for matching and converts values to SQL-compatible literals. Throws PlaceholderResolutionException if a column cannot be resolved. Refactored class to partial to support regex generation.
2026-03-26 14:37:29 +01:00