Commit Graph

547 Commits

Author SHA1 Message Date
27d731a5b0 Bump version to 2.0.0-beta in ReC.API.csproj
Updated <Version>, <AssemblyVersion>, <FileVersion>, and <InformationalVersion> fields from 1.0.3-beta to 2.0.0-beta to reflect a major version change, indicating significant updates or breaking changes in the project.
2026-01-22 10:41:26 +01:00
b8f797f14d Make EndpointAuthType non-nullable with default NoAuth
Changed EndpointAuthType in RecActionViewDto from nullable to non-nullable and set its default value to EndpointAuthType.NoAuth to ensure it always has a valid value.
2026-01-22 10:37:37 +01:00
6feef53733 Update namespaces and usings for Insert procedures
Refactored InsertActionProcedure to the RecActions.Commands namespace and updated its usings to import InsertObjectProcedure. Added missing using for RecActions.Commands in InsertObjectProcedure.cs. These changes improve code organization and clarify command responsibilities.
2026-01-22 10:17:08 +01:00
878e096c57 Refactor TypeId to use RestType enum in InsertActionProcedure
Changed TypeId from byte? to RestType? in InsertActionProcedure for stronger typing. Updated InsertObjectProcedureHandler to cast RestType to byte? when creating SQL parameters. Added using directive for ReC.Domain.Constants to support the new enum type.
2026-01-22 09:55:35 +01:00
2ded140ad5 Rename SqlExceptionNumber to BadRequestSqlExceptionNumber
Clarify intent by renaming SqlExceptionNumber to BadRequestSqlExceptionNumber in both configuration and code. This makes it explicit that these SQL exception numbers are mapped to HTTP 400 Bad Request errors. All relevant usages and settings have been updated accordingly.
2026-01-22 09:33:54 +01:00
e2ca249d13 Add SQL exception 50000 to handled exception numbers
Updated appsettings.json to include 50000 in the SqlExceptionNumber array, allowing the application to recognize and handle SQL exceptions with this number in addition to existing ones. This change can be applied at runtime without requiring a restart.
2026-01-22 09:31:41 +01:00
e782eab62a Refactor handlers to use IOptionsMonitor for SQL options
Refactored Delete, Insert, and Update procedure handlers to inject IOptionsMonitor<SqlExceptionOptions> instead of SqlExceptionOptions, enabling dynamic configuration updates. Updated all references to use CurrentValue. Added necessary using directives and cleaned up redundant usings in InsertObjectProcedure.cs.
2026-01-22 09:21:39 +01:00
d8e08b237d Simplify SqlException config structure in appsettings.json
Removed the "ErrorMessages" wrapper from the SqlException section,
placing "SqlExceptionNumber" directly under "SqlException".
No changes to the exception numbers themselves. Improved
readability and clarity of the configuration.
2026-01-22 02:04:52 +01:00
Developer 02
88cb1dc16a Handle SqlException in UpdateObjectProcedureHandler
Wrap stored procedure execution in try-catch to handle SqlException.
Throw BadRequestException for configured SQL error numbers.
Update constructor to accept SqlExceptionOptions.
Add necessary using directives for new exception handling.
2026-01-22 01:54:07 +01:00
Developer 02
8d6a09213e Simplify BadRequestException error message on insert failure
Replaced the detailed error message for insert failures with only the original exception message from SqlException, removing extra guidance about referenced entities.
2026-01-22 01:53:55 +01:00
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
5dee104377 Handle SQL exceptions in InsertActionProcedure test
Wrap InsertActionProcedure_runs_via_mediator in a try-catch block to handle SQL exceptions for duplicate key and foreign key violations, marking the test as passed with explanatory messages. Also, add EndpointId to the test data and improve assertion clarity. This increases test robustness against common DB constraint issues in integration testing.
2026-01-20 16:22:30 +01:00
36e1d5fad1 Update test assertions to allow any non-default int result
Previously, tests asserted that procedure results were exactly 0.
Now, assertions require only that results are not the default int
value, making the tests more flexible to non-zero outcomes.
2026-01-20 16:10:40 +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
ff4ab9efe2 Handle NotFoundException gracefully in query tests
Updated ProfileQueryTests, RecActionQueryTests, and ResultQueryTests to catch NotFoundException and pass tests with an explanatory message when test data is missing or entities are not found. This improves test robustness and reduces false negatives due to unavailable test data. Also renamed a test in ResultQueryTests to reflect the new behavior.
2026-01-19 10:16:53 +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
ce35ef588f Add integration test project with MediatR procedure tests
Added ReC.Tests project with integration tests for stored procedure commands and queries via MediatR, covering endpoints, actions, results, and profiles. Introduced a test base for DI/configuration, helper for private property access, and updated the solution to include the new test suite. Tests use NUnit and cover both positive and negative scenarios.
2026-01-16 15:24:51 +01:00
df665e3b98 Remove ReC.Abstractions.Application from solution
Deleted the "ReC.Abstractions.Application" project from ReC.sln, including its project entry, build configurations, and nested project references.
2026-01-16 14:40:12 +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
489180f5a1 Restructure solution folders in ReC.sln
Added "infrastructure", "presentation", and "core" solution folders. Moved projects into these new folders and updated the NestedProjects section to reflect the new organization. Adjusted parent GUIDs accordingly.
2026-01-16 11:07:19 +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