Commit Graph

609 Commits

Author SHA1 Message Date
a6b0cbaf9d Rename InsertEndpointAuthProcedure to InsertEndpointAuthCommand
Refactored all usages of InsertEndpointAuthProcedure to InsertEndpointAuthCommand, including method signatures, handler interfaces, and test cases, to better align with CQRS naming conventions for write operations.
2026-03-24 11:35:58 +01:00
0162d059da Refactor: Rename DeleteEndpointAuthProcedure to Command
Renamed DeleteEndpointAuthProcedure to DeleteEndpointAuthCommand across the codebase, including controller, handler, and tests, to improve naming consistency and align with CQRS conventions for write operations.
2026-03-24 11:31:33 +01:00
302fee4908 Refactor tests to send commands directly to mediator
Refactored test code to remove ToObjectProcedure usage and send command objects directly to the mediator. Updated update procedure tests to use Data and Id properties. Replaced custom Execute*Procedure methods with sender.Send. Cleaned up unused usings. These changes improve consistency and reflect updates to command structures.
2026-03-24 11:29:15 +01:00
3e10176d98 Add PreprocessingBehavior for action command pipeline
Introduced PreprocessingBehavior implementing MediatR's IPipelineBehavior for InvokeRecActionViewCommand. This behavior executes a preprocessing SQL query if specified, and halts processing if an error occurs and ErrorAction is set to Stop. Added necessary using directives for dependencies.
2026-03-24 11:14:11 +01:00
4f0f99e0f8 Refactor InsertResultProcedure execution method
Replaced sender.ExecuteInsertProcedure with sender.Send for executing InsertResultProcedure. Removed the _options.AddedWho parameter, passing only the procedure object and cancellation token. The construction of InsertResultProcedure remains unchanged.
2026-03-24 11:11:36 +01:00
8fb4b4005c Refactor UpdateObjectProcedure to use DTO properties
Replaced *Procedure properties in UpdateObjectProcedure with corresponding DTO types (e.g., UpdateActionDto, UpdateEndpointDto, etc.) and added the necessary DTO namespace import. This decouples the record from procedure logic, improving separation of concerns and data transfer handling.
2026-03-24 11:11:12 +01:00
b3bb7144ef Refactor IUpdateProcedure to generic with Id and Data props
Changed IUpdateProcedure to a generic interface IUpdateProcedure<T>, adding Id (long) and Data (T) properties for improved type safety and flexibility in update procedures. The interface continues to inherit from IRequest<int>.
2026-03-24 11:10:47 +01:00
eff6350d77 Refactor update procedures to use DTO-based pattern
Refactored Update*Procedure records to encapsulate update data in dedicated DTOs (e.g., UpdateActionDto, UpdateEndpointDto) via a generic Data property. Updated interfaces to be generic and modified handlers to pass only the DTO to UpdateObjectProcedure. This improves maintainability, reduces duplication, and standardizes update logic across entities.
2026-03-24 11:09:46 +01:00
114b5de71d Add Update DTOs for partial entity updates in Procedures
Introduced six new DTO record classes under ReC.Application.Common.Procedures.UpdateProcedure.Dto to support partial (nullable) updates for Action, Endpoint, EndpointAuth, EndpointParams, Profile, and Result entities. These DTOs enable PATCH-like update operations by allowing selective property updates. No existing code was modified.
2026-03-24 11:08:37 +01:00
f786192786 Refactor ResultController to use mediator.Send for commands
Standardize command handling by replacing custom mediator methods
with mediator.Send in ResultController. Update PUT endpoint to
remove id route parameter and rely on payload for identification.
2026-03-24 11:07:42 +01:00
50741bfdd3 Refactor RecActionController to use MediatR Send only
Simplified controller by removing IConfiguration dependency and unused usings. Refactored all endpoints to use MediatR's Send method with command objects, eliminating custom mediator extension methods and route parameters like id. This streamlines command handling and reduces dependencies.
2026-03-24 11:06:20 +01:00
561eafe48c Refactor ProfileController to use MediatR Send method
Replaces custom Execute*Procedure methods with MediatR's Send for insert, update, and delete operations. Removes obsolete using directives. Updates the PUT endpoint to accept the profile ID in the request body instead of the route.
2026-03-24 11:04:41 +01:00
84358ced96 Refactor EndpointsController to use standard MediatR pattern
Removed IConfiguration dependency and replaced custom mediator
extension methods with standard mediator.Send calls for endpoint
commands. Simplified method signatures and removed unused usings.
Updated PUT endpoint to accept UpdateEndpointProcedure directly.
2026-03-24 11:03:28 +01:00
d2e97a2fef Refactor EndpointParamsController to use MediatR.Send
Removed IConfiguration dependency and custom MediatR extension methods from EndpointParamsController. All command handling now uses mediator.Send directly, and route/config parameters have been eliminated from endpoints. Cleaned up unused usings and streamlined controller logic.
2026-03-24 11:02:58 +01:00
d505c8415e Refactor EndpointAuthController to use MediatR Send
Replaced custom procedure execution methods with MediatR's Send method in EndpointAuthController. Removed obsolete using directives and updated the PUT endpoint to no longer require an id route parameter, expecting the id in the payload instead. This streamlines the controller and aligns it with standard MediatR practices.
2026-03-24 10:58:43 +01:00
a590ffd2dc Refactor InsertProfileProcedure to use MediatR handler
Refactored InsertProfileProcedure by removing the ToObjectProcedure method and introducing InsertProfileProcedureHandler, which implements IRequestHandler and delegates insert logic via MediatR's ISender. Updated using directives to include MediatR. This aligns profile insertion with the MediatR request/response pattern.
2026-03-24 10:14:58 +01:00
94da75ce37 Add MediatR handler for DeleteProfileProcedure command
Introduce DeleteProfileProcedureHandler using MediatR's IRequestHandler to process DeleteProfileProcedure requests. The handler sends a DeleteObjectProcedure via ISender, replacing the previous ToObjectProcedure method. Also, add necessary using directives and refactor logic to centralize command handling.
2026-03-24 10:14:10 +01:00
9c1ffd7df8 Refactor UpdateEndpointProcedure and add handler
Refactored UpdateEndpointProcedure to implement IUpdateProcedure directly and removed the ToObjectProcedure method. Introduced UpdateEndpointProcedureHandler using MediatR's ISender for command handling, aligning with MediatR patterns and enabling dependency injection.
2026-03-24 10:13:35 +01:00
e31d034266 Refactor InsertEndpointProcedure; add MediatR handler
Refactored InsertEndpointProcedure to remove the ToObjectProcedure method, making it a simple data record. Introduced InsertEndpointProcedureHandler using MediatR's IRequestHandler to handle insert commands asynchronously. Added necessary MediatR using directives.
2026-03-24 10:13:12 +01:00
649d7eff8c Refactor DeleteEndpointProcedure to use MediatR handler
Replaces the ToObjectProcedure method with a dedicated
DeleteEndpointProcedureHandler implementing IRequestHandler.
The handler uses MediatR's ISender to send DeleteObjectProcedure,
improving separation of concerns and aligning with MediatR
request/response patterns.
2026-03-24 10:12:35 +01:00
401d67de4c Refactor UpdateEndpointParamsProcedure to MediatR pattern
Refactored UpdateEndpointParamsProcedure to include all relevant properties and removed the ToObjectProcedure method. Introduced UpdateEndpointParamsProcedureHandler using MediatR's IRequestHandler, delegating update logic via ISender. This improves code structure and maintainability.
2026-03-24 10:11:55 +01:00
ed94415a33 Refactor InsertEndpointParamsProcedure with MediatR handler
Remove ToObjectProcedure method from InsertEndpointParamsProcedure and introduce InsertEndpointParamsProcedureHandler using MediatR's IRequestHandler. This decouples conversion and command logic, aligning with MediatR patterns and improving separation of concerns.
2026-03-24 10:10:14 +01:00
04513a3d08 Refactor endpoint params delete to use MediatR handler
Replaces ToObjectProcedure with DeleteEndpointParamsProcedureHandler using MediatR's request/handler pattern. Improves separation of concerns by delegating deletion logic to the handler and updates imports and namespace accordingly.
2026-03-24 10:09:37 +01:00
d390c3f7b6 Remove DeleteObjectProcedureExtensions and its methods
Deleted the DeleteObjectProcedureExtensions static class and its ExecuteDeleteProcedure extension methods from DeleteObjectProcedure.cs. These methods previously provided convenience for executing delete procedures via ISender. The core DeleteObjectProcedure record and its handler remain unchanged.
2026-03-24 10:08:45 +01:00
a40f20f6d9 Refactor UpdateEndpointAuthProcedure and add handler
Expanded UpdateEndpointAuthProcedure with new properties and removed the ToObjectProcedure method. Introduced UpdateEndpointAuthProcedureHandler using MediatR's ISender for command handling, improving separation of concerns and enabling dependency injection.
2026-03-24 09:59:21 +01:00
ee1f6a8753 Refactor InsertEndpointAuthProcedure handling
Move insert logic from InsertEndpointAuthProcedure to a new InsertEndpointAuthProcedureHandler using MediatR. Remove ToObjectProcedure method and update usings. The record now serves as a pure data structure.
2026-03-24 09:51:59 +01:00
1e35b6e263 Refactor DeleteEndpointAuthProcedure to use MediatR handler
Refactored DeleteEndpointAuthProcedure by removing the ToObjectProcedure method and introducing DeleteEndpointAuthProcedureHandler, which implements IRequestHandler and delegates deletion via MediatR's ISender. Consolidated using directives and namespace declarations.
2026-03-24 09:51:21 +01:00
e152e9a37a Refactor ChangedWho handling in UpdateObjectProcedure
ChangedWho is now initialized directly and no longer settable via a public method. Removed the ChangedBy method and related extension methods. Added a TODO to move ChangedWho assignment to authentication middleware in the future.
2026-03-24 09:48:37 +01:00
554aaa8b6c Refactor InsertObjectProcedure AddedWho handling
Removed AddedBy method and related extension; AddedWho is now set to a default value internally. Added a TODO to move AddedWho assignment to authentication middleware in the future.
2026-03-24 09:47:24 +01:00
329d156d08 Update IUpdateProcedure to use MediatR IRequest<int>
Refactored IUpdateProcedure to inherit from MediatR's IRequest<int> for integration with the MediatR pipeline. Removed the ToObjectProcedure method and added the necessary using directive for MediatR. This simplifies the interface and standardizes request handling.
2026-03-24 09:44:41 +01:00
246362812a Refactor IInsertProcedure for MediatR compatibility
IInsertProcedure now inherits from IRequest<long> to integrate with MediatR's request/response pattern. Removed the ToObjectProcedure method and added the necessary MediatR using directive.
2026-03-24 09:43:57 +01:00
71430918ac Refactor IDeleteProcedure to use MediatR IRequest<int>
IDeleteProcedure now inherits from MediatR's IRequest<int>, aligning it with MediatR request/response patterns. Removed the ToObjectProcedure method from the interface. Added the MediatR using directive. Note: The namespace and using directive are now on the same line, which may need formatting correction.
2026-03-24 09:43:36 +01:00
7a1705365b Add dynamic SQL execution to IRecDbContext interface
Added Database property to IRecDbContext for database operations. Introduced ExecuteDynamicSqlAsync extension method to run arbitrary SQL and return results as JSON. This enables flexible querying and result serialization.
2026-03-24 09:42:59 +01:00
acf136e689 Refactor UpdateProfileProcedure and add MediatR handler
Refactored UpdateProfileProcedure to implement IUpdateProcedure and expanded its properties. Removed ToObjectProcedure method. Introduced UpdateProfileProcedureHandler using MediatR's ISender for command dispatch. Modernized structure to use record types and handler classes.
2026-03-24 09:41:17 +01:00
6b4897702a Refactor DeleteActionProcedure to use MediatR handler
Refactored DeleteActionProcedure to implement IDeleteProcedure directly and removed the ToObjectProcedure method. Introduced DeleteActionProcedureHandler using MediatR's IRequestHandler to delegate deletion logic via ISender. Updated using directives for MediatR integration.
2026-03-19 23:19:07 +01:00
7d4e082958 Refactor InsertActionProcedure to use MediatR handler
Replaces the ToObjectProcedure method with an InsertActionProcedureHandler that implements IRequestHandler using MediatR. The handler maps InsertActionProcedure to InsertObjectProcedure and sends it via ISender. Also updates using statements to include MediatR.
2026-03-19 23:18:57 +01:00
d1dd021952 Refactor UpdateActionProcedure and add handler class
Expanded UpdateActionProcedure with new properties and removed the ToObjectProcedure method. Introduced UpdateActionProcedureHandler using MediatR to handle update logic and delegate to UpdateObjectProcedure. Centralized update logic in the handler for better maintainability.
2026-03-19 23:18:47 +01:00
5afc1791b0 Refactor DeleteResultProcedure to use MediatR handler
Remove ToObjectProcedure method and add DeleteResultProcedureHandler implementing IRequestHandler. The handler sends DeleteObjectProcedure via MediatR, mapping relevant properties. Also update using directives and namespace.
2026-03-19 23:18:38 +01:00
2ec07d7e96 Refactor InsertResultProcedure to use MediatR handler
Refactored InsertResultProcedure by removing its ToObjectProcedure method and introducing InsertResultProcedureHandler, which implements IRequestHandler and delegates object insertion via MediatR's ISender. This shifts conversion logic from the record to the handler and improves separation of concerns.
2026-03-19 23:18:29 +01:00
cbe4f1ba3c Refactor UpdateResultProcedure to use MediatR handler
Refactored UpdateResultProcedure to implement IUpdateProcedure directly and removed the ToObjectProcedure method. Introduced UpdateResultProcedureHandler using MediatR's IRequestHandler pattern, delegating update logic via ISender. This improves code structure and maintainability.
2026-03-19 23:18:17 +01:00
16155da033 Add Info and Error properties to OutResDto
Added two new nullable string properties, Info and Error, to the OutResDto record to support additional informational and error messages in responses.
2026-03-19 18:51:33 +01:00
0aa1414ea6 Add @pRESULT_INFO and @pRESULT_ERROR SQL parameters
Added two new SQL parameters, @pRESULT_INFO and @pRESULT_ERROR, to InsertObjectProcedure.cs. These are set from request.Result.Info and request.Result.Error, or to DBNull.Value if null, to support additional result data in the procedure.
2026-03-19 18:50:47 +01:00
181a9a83fd Add Info and Error properties to InsertResultProcedure
Added nullable string properties Info and Error to the InsertResultProcedure record to allow storing additional information and error messages related to insert operations.
2026-03-19 18:50:34 +01:00
5e3e12bad8 Add Info and Error properties to entity mapping
Added Info and Error properties to the entity configuration, mapping them to the RESULT_INFO and RESULT_ERROR columns in the database using HasColumnName. This allows the entity to store and retrieve additional result information and error details.
2026-03-19 18:49:28 +01:00
6dcc128ad5 Add Info, Error, AddedWho, and ChangedWho to ResultView
Extended ResultView with four new nullable string properties:
Info and Error for additional details and error messages,
and AddedWho and ChangedWho for tracking user metadata.
2026-03-19 18:49:08 +01:00
754ef88644 Bump version to 2.0.2-beta in ReC.API.csproj
Updated project, assembly, and file versions from 2.0.1-beta/2.0.1.0 to 2.0.2-beta/2.0.2.0 to reflect new release. No other changes were made.
2026-03-16 13:46:10 +01:00
95ece6fdcf Remove unused imports from ResultController.cs
Removed unnecessary using statements for ReC.API.Extensions and ReC.API.Models to clean up the code and improve maintainability. No functional changes were made.
2026-03-16 13:44:38 +01:00
87194df697 Refactor and expand REST action authentication support
Refactored authentication logic for REST actions to use a structured switch block, adding explicit support for ApiKey, BearerToken, JwtBearer, OAuth2, BasicAuth, and NTLM authentication types. Introduced dedicated HttpClient/Handler for NTLM with proper disposal. Improved extensibility, clarity, and resource management. Added IOptions and Options usage for configuration.
2026-03-16 13:43:27 +01:00
b38d53248c Force HTTP/1.1 for NTLM when UseHttp1ForNtlm is enabled
Added logic to set HTTP/1.1 and exact version policy for NTLM
authentication requests when the UseHttp1ForNtlm option is true.
This ensures compatibility with NTLM endpoints requiring HTTP/1.1.
2026-03-16 13:41:04 +01:00
56b604bd35 Add UseHttp1ForNtlm option to RecAction config
Added the boolean UseHttp1ForNtlm property to the RecAction section in appsettings.json and RecActionOptions class. This option defaults to false and allows control over using HTTP/1 for NTLM authentication.
2026-03-16 13:38:45 +01:00