Commit Graph

182 Commits

Author SHA1 Message Date
284ced6059 refactor(ResultView): move to Views directory 2026-01-12 10:34:27 +01:00
88c6e6d214 refactor(RecActionView): move to Views directory 2026-01-12 10:33:59 +01:00
83f173fdc4 Update DigitalData.Core package versions in csproj files
Upgraded DigitalData.Core.Abstraction.Application to v1.6.0 in ReC.Application.csproj and DigitalData.Core.Infrastructure to v2.6.0 in ReC.Infrastructure.csproj. No other changes made.
2025-12-19 11:01:05 +01:00
48e9812224 Add handler for CreateResultViewCommand with repository
Added CreateResultViewCommandHandler to process creation of ResultView entities using IRepository<ResultView>. Also updated using directives to include necessary repository and entity namespaces.
2025-12-17 11:55:23 +01:00
1199c61ae8 Add AuthScopedFilter to set AddedWho via middleware
Introduce AuthScopedFilter to automatically set the AddedWho property on IAuthScoped commands using configuration, and register it globally for all controllers. Remove manual AddedWho assignment from ResultViewController. Make AddedWho nullable in AuthScope and IAuthScoped.
2025-12-17 11:52:59 +01:00
a55b51e504 Set AddedWho from config in Create; make property mutable
Changed AuthScope.AddedWho to be mutable (get; set;). In ResultViewController, set AddedWho from configuration in the Create action and throw an error if missing. Ensures AddedWho is always set and configuration issues are clearly reported.
2025-12-17 11:51:48 +01:00
752f781f54 Add AuthScopedValidator and register FluentValidation
Introduced AuthScopedValidator to enforce non-empty AddedWho on IAuthScoped entities with a clear error message. Registered all validators from the assembly in DI to enable automatic validation for authentication-scoped entities.
2025-12-17 11:37:58 +01:00
0fa1a418de Refactor validation behavior and update result view command
Refactored ValidationBehavior to use C# 12 primary constructors and file-scoped namespaces, simplifying the Handle method logic. Updated CreateResultViewCommand to implement IAuthScoped and IRequest, replaced AddedWho with a non-serialized Scope property, and added necessary usings and namespace.
2025-12-17 11:16:48 +01:00
cc54539aba Refactor scope handling with new IScoped and AuthScope
Introduce IScoped<TScope> interface for unified scope access and add AuthScope record. Remove legacy IScopedRequest interfaces to streamline scope management across the application.
2025-12-17 11:16:22 +01:00
ac4c4cb69a Add generic scoped request interfaces for MediatR support
Introduced IScopedRequestBase<TScope>, IScopedRequest<TScope>, and IScopedRequest<TScope, TResponse> interfaces to enable requests with scope information. These interfaces extend MediatR's IRequest types and enforce non-nullable scope types for improved request handling.
2025-12-17 10:41:04 +01:00
73ccb9e43b Add AutoMapper profile for CreateResultViewCommand mapping
Introduced a MappingProfile in ReC.Application.ResultViews to map CreateResultViewCommand to ResultView, setting AddedWhen to DateTime.UtcNow during mapping. Included necessary using directives.
2025-12-17 10:26:29 +01:00
b6ab59ae4a Add CreateResultViewCommand class for result view creation
Introduced CreateResultViewCommand in the ReC.Application.ResultViews.Commands namespace. This class includes properties for ActionId, StatusCode, Header, Body, and AddedWho, and will be used as a command or DTO for creating ResultView entities.
2025-12-17 10:13:33 +01:00
d8d77652ac Implement ReadResultViewQuery handler with filtering
Added ReadResultViewQueryHandler to support querying ResultView entities with optional filters (Id, ActionId, ProfileId). Integrated repository and AutoMapper, included error handling for no results, and improved using directives.
2025-12-15 17:11:23 +01:00
62612897bd Add ReadResultViewQuery and clean up DTO namespace
Introduced ReadResultViewQuery for querying result views with optional filters (Id, ActionId, ProfileId). Cleaned up ResultViewDto.cs by removing an unused using directive and reformatting the namespace declaration. Added necessary usings to support the new query.
2025-12-15 17:05:49 +01:00
99c50fb348 Make ResultViewDto immutable; add Root property
Refactored ResultViewDto to use init-only properties for immutability. Added a new Root property of type OutResDto?. Included a using directive for ReC.Domain.Entities to support the new property.
2025-12-15 17:02:11 +01:00
152189fefd Refactor: Rename RecResultViewDto to ResultViewDto
Replaced all usage of RecResultViewDto with ResultViewDto for improved naming consistency. Updated AutoMapper profile to map ResultView to ResultViewDto. Removed RecResultViewDto.cs and added ResultViewDto.cs with the same properties. No functional changes.
2025-12-15 16:57:05 +01:00
5a4b8427be Rename RecResultView entity to ResultView throughout codebase
Replaced RecResultView with ResultView, updating all references in DbContext, entity mapping, and AutoMapper profiles. Added the new ResultView class and removed the old RecResultView class. No changes to properties or structure.
2025-12-15 16:56:37 +01:00
e4a644a636 Add mappings for RecResultView and ProfileView DTOs
Added AutoMapper profile mappings for RecResultView to RecResultViewDto and ProfileView to ProfileViewDto to enable automatic entity-to-DTO conversions.
2025-12-15 16:55:45 +01:00
25c6c41b26 Add RecResultViewDto for result view data representation
Introduced RecResultViewDto in the ReC.Application.Common.Dto namespace. This DTO encapsulates properties for result entity view data, including related action and profile details, status, content, and audit information.
2025-12-15 16:53:25 +01:00
4e209e29fc Refactor ReadRecActionViewQuery for optional ProfileId
Refactored ReadRecActionViewQuery to remove base class inheritance and make ProfileId optional. Simplified query construction and filtering logic in the handler to conditionally filter by ProfileId only when provided. Removed unused constructors and methods for a cleaner API.
2025-12-15 15:07:26 +01:00
78aaea67e6 Refactor InvokeBatchRecActionViewsCommand structure
Decouple InvokeBatchRecActionViewsCommand from ReadRecActionQueryBase, making it a plain IRequest with an explicit ProfileId property. Update the extension and handler to use the new structure, improving clarity and separation of concerns.
2025-12-15 15:06:46 +01:00
98261f4e21 Refactor ProfileType to enum in RecActionViewDto
Changed ProfileType from string? to ProfileType? enum for improved type safety. Updated URI scheme assignment to use ToUriBuilderScheme(), centralizing scheme mapping logic.
2025-12-15 15:05:56 +01:00
3621820060 Refactor RecActionView Profile property; add ProfileViewDto
Changed RecActionView.Profile to use ProfileView type instead of Profile entity. Added new ProfileViewDto class to represent profile data as a DTO, including related properties and audit fields.
2025-12-15 14:01:11 +01:00
289b6109e4 Refactor DeleteRecActionsCommand to use RecAction entity
Switched from using RecActionDto to RecAction entity in the
DeleteRecActionsCommandHandler and updated repository types
and using statements accordingly. This aligns the handler
with domain-driven design and improves consistency.
2025-12-15 13:24:11 +01:00
679c065aaa Refactor CreateRecAction to use domain entities
Switched from using RecActionDto to RecAction domain entity in the CreateRecActionCommandHandler and updated relevant imports. This aligns the command handler with domain-driven design principles.
2025-12-15 13:23:56 +01:00
a02cac8778 Refactor handler to use AutoMapper and entity repository
Updated ObtainEndpointCommandHandler to depend on IRepository<Endpoint> and IMapper. Now maps Endpoint entities to EndpointDto using AutoMapper before returning, ensuring proper separation of concerns and DTO exposure.
2025-12-15 13:08:21 +01:00
42fd176fad Refactor RestType null check with pattern matching
Refactored the null check for action.RestType to use pattern matching, assigning it to a local variable restType if not null. Now throws DataIntegrityException if RestType is null, and uses restType for creating the HttpRequestMessage. This improves code clarity and ensures RestType is non-null in subsequent logic.
2025-12-15 12:53:43 +01:00
e529027587 Refactor HTTP method handling to use RestType enum
Replaced string-based HTTP method mapping with a strongly-typed RestType enum for improved type safety. Updated the ToHttpMethod extension to accept RestType, validate its value, and convert it to the appropriate HttpMethod. This reduces errors from invalid or misspelled method names.
2025-12-15 12:48:10 +01:00
a0233fd876 Update RecActionViewDto: new props, type changes, renames
Renamed ProfileSequence to Sequence. Added display name properties for enums/types (e.g., EndpointAuthTypeName, RestTypeName, ErrorActionName). Added EndpointAuthApiKey. Changed RestType to enum and ErrorAction to nullable, with corresponding name properties.
2025-12-15 12:37:33 +01:00
784b4b1f05 Refactor to use DTOs instead of domain entities
Replaced references to ReC.Domain.Entities with ReC.Application.Common.Dto across multiple files to use DTOs in the application layer. Updated MappingProfile.cs namespace to ReC.Application.RecActionViews and adjusted using statements accordingly. These changes improve separation of concerns and ensure commands and mappings operate on DTOs rather than domain entities.
2025-12-15 11:58:43 +01:00
576b2d59d9 Update IRecDbContext to use domain model DbSet types
Changed DbSet properties in IRecDbContext from DTO types to their corresponding domain model classes for Connections, Endpoints, EndpointAuths, Profiles, and RecActions. This aligns the interface with the domain model and removes reliance on DTOs.
2025-12-15 11:30:48 +01:00
3da16ba640 Introduce DTOs and refactor app layer to use them
Added DTO classes for Connection, Endpoint, EndpointAuth, EndpointParam, Profile, and RecAction. Updated AutoMapper profiles, DbContext, and command handlers to use DTOs instead of domain entities. This decouples the application layer from the domain model, improving maintainability and flexibility. Cleaned up some using directives and file headers.
2025-12-12 15:16:38 +01:00
71a0220c3f Refactor: replace RecActionDto with RecActionViewDto
Standardize usage of RecActionViewDto across the codebase:
- Update pipeline behaviors, mapping profiles, and commands to use RecActionViewDto.
- Remove RecActionDto and introduce RecActionViewDto with equivalent properties and methods.
- Adjust query handlers and related interfaces to work with RecActionViewDto.
This clarifies DTO usage and aligns the model with domain intent.
2025-12-12 15:04:43 +01:00
f53603083a Refactor batch invocation to use RecActionViews
Replaced all batch RecAction logic with RecActionViews equivalents. Updated controller methods to call InvokeBatchRecActionView instead of InvokeBatchRecAction. Removed InvokeBatchRecActionsCommand and its handler, and added InvokeBatchRecActionViewsCommand with similar logic for RecActionViews. This shifts batch processing from RecActions to RecActionViews across the codebase.
2025-12-12 15:00:26 +01:00
92e7d44d3b Rename InvokeRecActionCommand to InvokeRecActionViewCommand
Refactored the RecAction invocation logic by renaming and moving InvokeRecActionCommand.cs to InvokeRecActionViewCommand.cs. Updated all class, record, and extension method names accordingly. The command handling logic remains unchanged, but all references and namespaces now reflect the new naming. Removed the old InvokeRecActionCommand.cs file.
2025-12-12 14:58:33 +01:00
f8211e9e9d Refactor RecAction query to use ReadRecActionViewQuery
Replaced ReadRecActionQuery and its handler with ReadRecActionViewQuery and ReadRecActionViewQueryHandler. Updated controller methods to use the new query type. This change clarifies and consolidates RecAction view query logic, improving code organization and domain alignment.
2025-12-12 14:52:11 +01:00
1782844543 Refactor RecAction commands to new namespace
Moved CreateRecActionCommand and DeleteRecActionsCommand (and their handlers) from ReCActionViews.Commands to ReCActions.Commands. Updated all references in controller and mapping profile. Removed old files to improve code organization. No changes to command logic.
2025-12-12 14:47:48 +01:00
2aa7cabcbd Refactor RecActions to RecActionViews namespaces
Renamed command and query files, namespaces, and usings from RecActions to RecActionViews for improved clarity and organization. Updated controller and mapping profile references accordingly. No changes to business logic or handler implementations.
2025-12-12 14:43:32 +01:00
28f35101f9 Refactor auth type to enum in RecActionDto and handler
Changed EndpointAuthType from string to enum in RecActionDto. Updated InvokeRecActionCommandHandler to use enum values in switch statements for improved type safety and maintainability.
2025-12-12 14:00:09 +01:00
46b7ae29cd Update IRecDbContext DbSets and add new entity sets
Changed DbSet properties to get/set in IRecDbContext, renamed Actions to RecActionViews for consistency, and added DbSets for Connections, Endpoints, EndpointAuths, Profiles, and RecActions. Updated RecDbContext implementation accordingly.
2025-12-12 13:42:49 +01:00
84e403f411 Refactor API key auth handling with switch and error check
Refactored the "API Key" authentication logic to use a switch
statement on the API key location, improving code clarity.
Added a default case to throw a DataIntegrityException for
unsupported API key locations, enhancing error handling.
2025-12-12 13:21:09 +01:00
3b77345aee Refactor API key location to use enum instead of string
Changed EndpointAuthApiKeyAddTo from string? to ApiKeyLocation? enum in RecActionDto for type safety. Updated related logic in InvokeRecActionCommandHandler to use the enum, and added the necessary using directive for ReC.Domain.Constants.
2025-12-12 13:17:54 +01:00
c422de445d Refactor ErrorAction to use enum for type safety
Changed RecActionDto.ErrorAction from string to ErrorAction enum, updating all related logic to use enum values instead of strings. Added necessary using directives. This improves type safety, reduces risk of typos, and enhances maintainability.
2025-12-12 13:04:23 +01:00
282ce3a0b7 Move ErrorAction enum to domain layer namespace
Changed ErrorAction enum namespace from ReC.Application.Common.Constants to ReC.Domain.Constants to better reflect its domain relevance. Removed the file's BOM. Enum members remain unchanged.
2025-12-12 13:00:24 +01:00
26f2da1313 Add ErrorAction enum for error handling actions
Introduced the ErrorAction enum in the ReC.Application.Common.Constants namespace with Stop and Continue values to standardize error response actions across the application.
2025-12-12 12:55:57 +01:00
bc700e2cd2 Refactor HTTP client name constant usage
Replaced the old HttpClientName constant in Constants.cs with a new Http.ClientName in the ReC.Application.Common.Constants namespace. Updated all references and using directives accordingly to improve code organization and maintainability.
2025-12-12 12:54:57 +01:00
87e1bb9187 Refactor: centralize HTTP client naming with Constants
Introduced a Constants class to define a unique HttpClientName for HTTP client registration and usage. Updated DependencyInjection and InvokeRecActionCommandHandler to use this centralized name, improving consistency and reducing risk of name collisions.
2025-12-12 12:42:39 +01:00
68cc919bad Handle unsupported auth types with NotImplementedException
Throw NotImplementedException for unsupported authentication types
in InvokeRecActionCommandHandler, including details like ProfileId
and Id in the exception message for easier debugging. This prevents
silent failures when encountering unknown authentication methods.
2025-12-12 12:02:51 +01:00
374365d250 Refactor HttpClient usage and NTLM auth handling
Centralize HttpClient configuration using IHttpClientFactory with a named "Default" client. Move NTLM authentication logic from HttpClientHandler to request-level options, improving testability and aligning with .NET best practices.
2025-12-12 12:01:22 +01:00
8c79b3a156 Add support for multiple HTTP auth methods in REST actions
Expanded InvokeRecActionCommandHandler to support API Key, Bearer/JWT/OAuth2, Basic, and NTLM authentication schemes. Added necessary imports and logic for header/query manipulation and credential handling. Left placeholders for Digest, OAuth 1.0, and AWS Signature. Improves flexibility and robustness of outgoing HTTP requests.
2025-12-12 11:20:02 +01:00