Commit Graph

529 Commits

Author SHA1 Message Date
Developer 02
54f412ced2 Improve error handling in DeleteObjectProcedureHandler
Refactored DeleteObjectProcedureHandler to inject SqlExceptionOptions and wrap stored procedure execution in a try-catch block. Added logic to throw custom exceptions (DeleteObjectFailedException, BadRequestException) based on result codes and SQL exception numbers, enhancing robustness and configurability of error handling.
2026-01-22 01:53:40 +01:00
Developer 02
51b9c62188 Add SqlException config options and update dependencies
Added ConfigureSqlException methods to DependencyInjection for flexible SQL exception handling configuration. Updated RecApplicationTestBase to use new options. Bumped DigitalData.Core.Exceptions to v1.1.1.
2026-01-22 01:49:59 +01:00
Developer 02
bb5525778d Improve error handling in InsertObjectProcedureHandler
Wrap SQL execution in try-catch and inject SqlExceptionOptions.
Throw BadRequestException with a clear message when insert fails due to missing referenced entities, based on SqlException number. Other SQL exceptions are rethrown. This provides better feedback for foreign key/reference errors.
2026-01-22 01:49:13 +01:00
Developer 02
ee793632df Add SQL exception handling configuration support
Updated Program.cs to configure SQL exception handling using the new "SqlException" section in appsettings.json. Renamed "SqlExceptionTranslator" to "SqlException" and added error message mappings for specific SQL exception numbers to enable custom exception translation.
2026-01-22 01:46:46 +01:00
Developer 02
22bb585f60 Refactor SQL exception handling and config structure
Simplify SQL exception tracking by replacing error message mappings
with a list of relevant error numbers in appsettings.json. Remove
custom error message logic and related classes, introducing
SqlExceptionOptions to hold tracked error codes.
2026-01-22 01:45:50 +01:00
Developer 02
ed7237c8dd Add SqlExceptionTranslator config and options class
Introduce SqlExceptionTranslator section in appsettings.json to map common SQL error codes to user-friendly messages. Add SqlExceptionTranslatorOptions class to manage error code/message mapping and support configuration binding.
2026-01-22 01:13:02 +01:00
Developer 02
f71bcf37e9 Add SqlExceptionTranslator for custom SQL error handling
Introduced SqlExceptionTranslator and ISqlExceptionTranslator to translate SQL exceptions into user-friendly error messages for bad request scenarios. Uses configurable options to identify relevant error numbers and format messages with templates.
2026-01-22 00:34:35 +01:00
Developer 02
c7e366af60 Refactor ResultController ctor, enhance BadRequest logging
Removed IConfiguration from ResultController constructor, now only using IMediator. Added logging for BadRequestException inner exceptions in ExceptionHandlingMiddleware for improved error diagnostics.
2026-01-21 22:24:41 +01:00
86f4e3141e Remove all 'fake' profile endpoints from controllers
Removed API endpoints for invoking, retrieving, and deleting RecActions and Results associated with fake/test profiles in RecActionController and ResultController. Only standard CRUD operations for real profiles are now exposed.
2026-01-21 12:06:19 +01:00
869ba9858f Update ProfileController to use CreatedAtAction in Post
Changed the Post method to return CreatedAtAction, providing a Location header linking to the new profile resource, in line with RESTful best practices.
2026-01-20 16:38:53 +01:00
304490d661 Add explicit @RC handling in SQL for delete/update procs
Updated DeleteObjectProcedureHandler and UpdateObjectProcedureHandler to declare, initialize, and select the @RC variable in their SQL command strings. This ensures the stored procedure return code is explicitly captured and returned by the query.
2026-01-20 15:39:54 +01:00
470120e5e9 Add ProfileView entity mapping to RecDbContext
Mapped ProfileView to the VWREC_PROFILE view in the dbo schema.
Configured primary key and property-to-column mappings for all
relevant fields, enabling read access to profile data via EF Core.
2026-01-19 10:03:17 +01:00
4bc6df4d91 Revert "Refactor BaseCrudApi to use generic type parameters"
This reverts commit 5197ad1481.
2026-01-16 14:39:12 +01:00
383932e7e7 Remove [Table] attributes from DTO classes
Removed explicit table mapping attributes from EndpointAuthDto, ProfileDto, and RecActionDto to decouple DTOs from database schema definitions.
2026-01-16 13:17:44 +01:00
e3494d50b7 Add ReC.Abstractions.Application project to solution
Added new ReC.Abstractions.Application project targeting .NET 8.0, with implicit usings and nullable enabled. Updated solution file to include the project under the "core" folder and configured build settings for Debug and Release.
2026-01-16 13:06:37 +01:00
5197ad1481 Refactor BaseCrudApi to use generic type parameters
BaseCrudApi is now defined as BaseCrudApi<TCreate, TUpdate, TDelete>,
with each CRUD method using its respective type parameter. This
improves type safety and clarity for API payloads. Method signatures
and XML documentation have been updated accordingly.
2026-01-16 12:29:17 +01:00
dbfb7e7e47 Refactor API classes to use BaseCrudApi for CRUD ops
Introduce BaseCrudApi to encapsulate common CRUD logic for API resource classes. Refactor CommonApi, EndpointAuthApi, EndpointParamsApi, EndpointsApi, ProfileApi, RecActionApi, and ResultApi to inherit from BaseCrudApi, removing duplicated CRUD methods and constructors. This centralizes CRUD operations, reduces code duplication, and improves maintainability.
2026-01-16 11:53:14 +01:00
b9a40bb12e Refactor API method names for consistency and clarity
Renamed public API methods across ReC.Client.Api classes to use concise and uniform names (e.g., CreateAsync, UpdateAsync, DeleteAsync, GetAsync, InvokeAsync). Removed obsolete NETFRAMEWORK preprocessor blocks. Updated summary comment for Results property in ReCClient.cs. These changes improve naming consistency and code clarity throughout the client library.
2026-01-16 11:42:03 +01:00
8ddaf1d13e Update ResultApi to use "api/Result" endpoint paths
Replaced all occurrences of "api/OutRes" with "api/Result" in ResultApi.cs for GET, POST, PUT, and DELETE operations. This ensures all result-related API requests now target the correct "Result" endpoint.
2026-01-16 11:37:38 +01:00
14532a15bf Add NETFRAMEWORK-specific usings to API files
Added conditional using directives for System.Net.Http, System.Threading, and System.Threading.Tasks in multiple API files. These usings are now included only when targeting .NET Framework, improving compatibility and preventing unnecessary imports on other platforms.
2026-01-16 11:35:37 +01:00
0149a77f21 Add ReCClientHelpers for query and JSON request helpers
Introduced internal static class ReCClientHelpers with methods to build query strings from key/value pairs and to create JsonContent payloads for HTTP requests. Includes conditional compilation for .NET Framework compatibility and XML documentation for both methods. Added necessary using directives.
2026-01-16 11:34:19 +01:00
a17d260c6c Refactor ReCClient to use modular API group classes
Refactored ReCClient to expose grouped endpoint APIs as properties (e.g., RecActions, Results, Profiles, etc.), each handled by its own class. Removed direct endpoint methods from ReCClient and delegated them to these new API classes. Cleaned up using directives and improved code modularity for better maintainability and discoverability.
2026-01-16 11:34:06 +01:00
b639df0a39 Add ResultApi for HTTP access to output result endpoints
Introduced the ResultApi class in the ReC.Client.Api namespace to provide asynchronous methods for retrieving, creating, updating, and deleting output results via HTTP. The class uses an injected HttpClient, supports cancellation tokens, and leverages helper methods for query construction and JSON serialization.
2026-01-16 11:33:51 +01:00
0fddf5669f Add RecActionApi client for RecAction endpoint operations
Introduced RecActionApi in ReC.Client.Api to provide a typed API client for RecAction endpoints. Includes methods for invoking, retrieving, creating, updating, and deleting Rec actions, with support for cancellation tokens and helper-based serialization. All methods are documented with XML comments.
2026-01-16 11:33:36 +01:00
9c46b9f2da Add ProfileApi for profile CRUD operations via HttpClient
Introduced ProfileApi class in ReC.Client.Api to handle profile-related API endpoints. Supports retrieving, creating, updating, and deleting profiles using an injected HttpClient. Methods accept cancellation tokens and utilize helper methods for query building and JSON serialization. Includes XML documentation for all methods and parameters.
2026-01-16 11:32:44 +01:00
87d9769d9b Add EndpointsApi for CRUD operations on endpoints
Introduced EndpointsApi class in ReC.Client.Api to handle create, update, and delete operations for endpoint definitions via HTTP requests. Methods are generic, support cancellation tokens, and use a helper for JSON serialization of payloads.
2026-01-16 11:32:31 +01:00
19ecf104fa Add EndpointParamsApi for endpoint parameter operations
Introduced the EndpointParamsApi class in ReC.Client.Api to handle create, update, and delete operations for endpoint parameters via HTTP. Methods support generic payloads, cancellation tokens, and use JSON serialization helpers. Added necessary using directives for HTTP and threading.
2026-01-16 11:30:46 +01:00
5b5b034e78 Add EndpointAuthApi for endpoint authentication operations
Introduced the EndpointAuthApi class in ReC.Client.Api to handle endpoint authentication API interactions. This class provides async methods for creating, updating, and deleting endpoint authentication configurations using HttpClient, with support for cancellation tokens and JSON payload serialization. XML documentation is included for clarity.
2026-01-16 11:30:30 +01:00
5ebb3f72e3 Add CommonApi for generic HTTP object operations
Introduced the CommonApi class in the ReC.Client.Api namespace to provide generic methods for creating, updating, and deleting objects via HTTP. The class uses an injected HttpClient and supports asynchronous operations with optional cancellation tokens. All methods serialize payloads to JSON using ReCClientHelpers.ToJsonContent. XML documentation was added for clarity.
2026-01-16 11:29:54 +01:00
3cfecbf598 Rename OutResController to ResultController and update docs
Renamed the controller class to ResultController for clarity and added the ReC.Application.Results.Queries using directive. Updated class documentation and parameter descriptions to better reflect the controller's purpose.
2026-01-16 11:17:41 +01:00
4895b9c8f8 Refactor: move OutResults to Results namespace
Refactored all "Result" related command and query classes from ReC.Application.OutResults to ReC.Application.Results. Updated all relevant using statements and reorganized files accordingly. No functional changes; this improves project structure and clarity.
2026-01-16 11:13:06 +01:00
36fe78e152 Remove obsolete CreateResultViewCommand and handler
Deleted the CreateResultViewCommand.cs file, including the obsolete CreateResultViewCommand and CreateResultViewCommandHandler classes. These were previously used for creating ResultView entities, but are now replaced by related procedures or views. All associated code and using directives have been removed.
2026-01-16 11:09:02 +01:00
b65810bbbb Add XML docs to ResultType enum members
Added summary XML documentation to each member of the ResultType enum in the ReC.Client namespace, clarifying the purpose of Full, OnlyHeader, and OnlyBody options.
2026-01-16 11:05:17 +01:00
278fcfd75b Remove obsolete sync API methods from ReCClient
All synchronous (blocking) HTTP API methods have been removed from the ReCClient class, leaving only their asynchronous counterparts. These sync methods were previously marked as [Obsolete] and simply wrapped the async methods with .GetAwaiter().GetResult(). Additionally, the ToJsonContent method's return type was updated from HttpContent to JsonContent for improved type specificity.
2026-01-16 11:04:11 +01:00
41db75b183 Add TaskSyncExtensions for sync Task execution (.NET FW)
Introduced TaskSyncExtensions class with Sync extension methods to allow synchronous execution of Task and Task<TResult> instances. This enables blocking on async code and is conditionally compiled for .NET Framework builds.
2026-01-16 11:03:53 +01:00
f4a921e268 Adjust BuildQuery param types for .NET Framework compatibility
Use conditional compilation to set BuildQuery's tuple Value type
to object for .NET Framework and object? for other targets,
ensuring compatibility with nullable reference types across
different .NET versions.
2026-01-16 10:58:26 +01:00
cdb52dc6fd Add strongly-typed HTTP API methods to ReCClient
Introduce async/sync methods for all major API controllers in ReCClient, supporting GET, POST, PUT, and DELETE with JSON serialization. Add utility methods for query building and JSON content. Mark sync wrappers as [Obsolete]. Add System.Net.Http.Json dependency and supporting usings. Introduce ResultType enum. This greatly expands ReCClient's API coverage and usability.
2026-01-16 10:54:46 +01:00
f14f6c1f15 Rename GetProfile method to Get in ProfileController
Renamed the GetProfile method to Get in the ProfileController to standardize method naming. No changes were made to the method's functionality or parameters.
2026-01-16 10:48:42 +01:00
6a24719342 Remove obsolete MappingProfile classes from Endpoints/RecActions
Removed AutoMapper MappingProfile classes from ReC.Application.Endpoints and ReC.Application.RecActions. These profiles mapped command objects to DTOs with default values. The change reflects a move toward using procedures or views for these mappings.
2026-01-16 10:40:28 +01:00
631ab8cba5 Remove obsolete OutRes command/query validators
Deleted DeleteOutResCommandValidator and ReadOutResQueryValidator classes, which were marked as obsolete. These validators are no longer needed due to a shift toward using related procedures or views for validation.
2026-01-16 10:37:57 +01:00
872878b9d7 Remove obsolete OutRes and RecAction CQRS classes
Removed deprecated command, query, and mapping classes for OutRes and RecAction entities, including their handlers and AutoMapper profiles. These components were previously marked as obsolete and have been superseded by database procedures or views. This cleanup eliminates redundant code and enforces the use of the updated data access patterns.
2026-01-16 10:36:43 +01:00
5a30b0ece4 Remove ObtainEndpointCommand and its handler
Deleted the ObtainEndpointCommand, its handler, and related using directives. This command was previously used to obtain or create Endpoint entities by URI, but has been removed in favor of using a related procedure or view as indicated by its Obsolete attribute.
2026-01-16 10:36:10 +01:00
37200617ea Remove unused entity-to-DTO mappings from DtoMappingProfile
Cleaned up DtoMappingProfile by removing mappings for several domain entities (OutRes, Connection, Endpoint, EndpointAuth, EndpointParam, Profile, RecAction) to their DTOs. Only view-to-DTO mappings remain. Also removed unused using directives.
2026-01-16 10:35:21 +01:00
8ab66db1f2 Remove obsolete entity DbSets and configs from RecDbContext
Removed all DbSet properties and Fluent API configurations for obsolete domain entities (EndpointParam, OutRes, Connection, Endpoint, EndpointAuth, Profile, RecAction) from RecDbContext. These entities are now accessed via views, further enforcing the transition to view-based data access. Only view-based models remain configured in the context.
2026-01-16 10:29:27 +01:00
cbd52721ac Remove obsolete DbSets from IRecDbContext interface
Removed DbSet properties for entities marked as obsolete in IRecDbContext, including EndpointParam, OutRes, Connection, Endpoint, EndpointAuth, Profile, and RecAction. Retained only DbSets for views and query results to encourage use of views instead of direct entity access. This streamlines the interface and aligns with the intended data access pattern.
2026-01-16 10:24:09 +01:00
3003559d7a Remove obsolete navigation properties from RecActionView
Removed Root, Endpoint, EndpointAuth, and SqlConnection navigation properties from RecActionView, along with their [ForeignKey] and [Obsolete] attributes. This streamlines the data model by retaining only foreign key IDs and related string properties, reducing direct entity navigation in favor of using related procedures or views.
2026-01-16 10:21:50 +01:00
6cabdbb6a3 Remove obsolete entity classes in favor of views
Removed Connection, Endpoint, EndpointAuth, EndpointParam, OutRes, Profile, and RecAction classes, which represented database tables and were marked as obsolete. This cleanup supports the transition to using database views or an updated data access approach. All related code, including attributes and properties, has been deleted.
2026-01-16 10:20:22 +01:00
4dd54e206e Update EndpointAuth references to fully qualified name
Replaced unqualified EndpointAuth with Domain.Entities.EndpointAuth
in DtoMappingProfile and IRecDbContext to improve clarity and
avoid potential naming conflicts.
2026-01-16 10:18:40 +01:00
84cf5c8e4d Add EndpointsController for endpoint CRUD operations
Introduced EndpointsController with POST, PUT, and DELETE API endpoints for managing endpoints. Utilizes MediatR to handle insert, update, and delete procedures, and retrieves configuration values as needed. Includes proper routing and response type annotations.
2026-01-16 10:15:07 +01:00
84d6e7a511 Add EndpointParamsController for CRUD via procedures
Introduced EndpointParamsController to manage endpoint parameter records using stored procedures. The controller supports POST (insert), PUT (update), and DELETE operations, leverages MediatR for command handling, and uses dependency injection for configuration and mediator services. Endpoints are documented and specify response types.
2026-01-16 10:13:33 +01:00