Commit Graph

467 Commits

Author SHA1 Message Date
11206cf84f Throw exception on failed InsertObject identifier return
Replace default return of 0 with InsertObjectFailedException when the stored procedure does not return a valid identifier. Exception message includes serialized request for easier debugging. Added necessary imports for exception and JSON serialization.
2026-01-12 16:27:45 +01:00
b48ebd8e88 Refactor InsertObjectFailedException constructors
Refactored InsertObjectFailedException to use explicit constructors: parameterless, message-only, and message with inner exception. Removed constructors with optional parameters for clearer and more standard .NET exception handling.
2026-01-12 16:21:16 +01:00
12d17e0808 Add InsertObjectFailedException custom exception class
Introduced InsertObjectFailedException in the ReC.Application.Common.Exceptions namespace. This exception provides constructors for custom messages and inner exceptions, and is intended to signal failures during object insertion operations.
2026-01-12 16:16:52 +01:00
1dee3180d5 Refactor InsertObjectProcedure into entity-based regions
Organized properties into regions by target entity for clarity.
No functional changes; update improves code readability
and maintainability.
2026-01-12 16:07:52 +01:00
bd4046a6c1 Add InsertObjectProcedureValidator with entity-specific rules
Introduced InsertObjectProcedureValidator using FluentValidation to enforce required fields and string length constraints for InsertObjectProcedure. Validation rules are applied conditionally based on the Entity type, ensuring correct data for ACTION, ENDPOINT, PROFILE, RESULT, and ENDPOINT_PARAMS. Optional string fields also receive length checks.
2026-01-12 16:03:10 +01:00
af6f94c1ed Improve handling of stored procedure return value type
Check if return value is already a long before parsing its
string representation. This enhances robustness and efficiency
when the value is of the correct type.
2026-01-12 15:48:03 +01:00
7bfb56b664 Add InsertObjectProcedure MediatR command and handler
Introduces InsertObjectProcedure and its handler to support generic, parameterized insertion of various object types (ACTION, ENDPOINT, etc.) via a single stored procedure. The handler maps request properties to SQL parameters, executes the procedure, and returns the output GUID. This enables flexible and unified object creation through MediatR.
2026-01-12 15:19:54 +01:00
1a6eced316 Rename InsertObject to InsertObjectProcedure
Renamed the InsertObject MediatR request record to InsertObjectProcedure and moved it from InsertObject.cs to InsertObjectProcedure.cs. The structure and functionality remain unchanged; it still defines an Entity property with a default value of "ACTION".
2026-01-12 14:35:16 +01:00
c82749bcbf Add TODO comment for appsettings.json config in DbContext
A TODO comment was added above OnModelCreating in RecDbContext to note that configuration should be updated to use appsettings.json in the future. No functional changes were made.
2026-01-12 14:25:15 +01:00
e8fa149532 Move InsertObjectResult mapping to Fluent API
Removed [Column] attribute from InsertObjectResult and configured column mapping for NewObjectId in RecDbContext using the Fluent API. This centralizes entity mapping logic in the DbContext.
2026-01-12 14:20:41 +01:00
aaa7beb92a Add RecResults DbSet for InsertObjectResult entities
Added RecResults DbSet to IRecDbContext and RecDbContext to support managing InsertObjectResult entities. Updated IRecDbContext to include the new DbSet and ensured SaveChangesAsync is defined. Enables querying and persisting InsertObjectResult via EF Core.
2026-01-12 14:19:19 +01:00
5cce52ec27 Add ProfileViews and RecResultViews to IRecDbContext
Updated IRecDbContext to include DbSet properties for ProfileView and ResultView entities, enabling management of these collections within the context.
2026-01-12 14:17:34 +01:00
3f36f048b2 Add InsertObjectResult class for object insert results
Introduced InsertObjectResult in ReC.Domain.QueryOutput with a required NewObjectId property mapped to the "oGUID" column. This class will be used to represent the result of object insert operations. Added necessary using directive for data annotations.
2026-01-12 14:17:04 +01:00
92e8d9e778 Move query result classes to QueryOutput namespace
BodyQueryResult and HeaderQueryResult were relocated from ReC.Domain.Entities to ReC.Domain.QueryOutput. Updated all references in IRecDbContext and RecDbContext to use the new namespace.
2026-01-12 14:11:05 +01:00
2d04670fef Set default Entity to "ACTION" in InsertObject
Added XML summary to Entity property describing valid values.
Changed default value from null to "ACTION" for clarity.
2026-01-12 14:08:03 +01:00
c0085b4c18 Add InsertObject record for MediatR-based insert requests
Introduced InsertObject record in ReC.Application.Common.Procedures namespace. This record implements MediatR's IRequest<long> and includes a non-nullable Entity property to support object insertion operations.
2026-01-12 13:54:04 +01:00
59ea5e3e67 Update action invocation logic and remove EndpointAuth include
Changed invocation filter to use Results.Any() instead of Root.OutRes.
Removed eager loading of EndpointAuth from the query.
2026-01-12 13:26:54 +01:00
a9f2c4c2f7 Add Action and Profile relationships to Result entity
Added navigation properties and foreign key relationships from Result to Action (one-to-many) and Profile (many-to-one) entities using ActionId and ProfileId. This enhances entity associations in the data model.
2026-01-12 13:03:56 +01:00
001f4bf2c5 Configure one-to-many relationship for Profile-Actions
Added entity mapping to establish a one-to-many relationship between profiles and actions, with actions referencing their parent profile via the ProfileId foreign key.
2026-01-12 12:54:00 +01:00
bfe6c12ee0 Annotate ProfileView and add Actions property
ProfileView is now mapped to the VWREC_PROFILE table using the
[Table] attribute. Added an Actions property to support related
RecActionView collections.
2026-01-12 12:50:05 +01:00
e1260e49f0 Add one-to-many Action-Results relationship mapping
Added entity configuration to define a one-to-many relationship between Actions and Results. Each Action can have multiple Results, and each Result references its parent Action via the ActionId foreign key.
2026-01-12 12:47:21 +01:00
8b86eca838 Add obsolete navigation props to RecActionView class
Added Results, Root, Endpoint, EndpointAuth, and SqlConnection navigation properties to RecActionView, all marked as [Obsolete] to guide usage toward related procedures or views. Foreign key attributes applied where relevant.
2026-01-12 12:39:53 +01:00
fb12cb6c98 Refactor ResultView logic under OutResults namespace
Moved ReadResultViewQuery and its handler from ResultViews to OutResults namespace. Merged ResultView mapping profile into OutResults.MappingProfiles and removed the old MappingProfile class. Updated controller references accordingly for improved organization.
2026-01-12 11:32:39 +01:00
2635bfb223 Move CreateResultViewCommand to OutResults.Commands
Relocated CreateResultViewCommand and its handler from ResultViews.Commands to OutResults.Commands. Updated all namespace references and using directives accordingly. Modified the project file to include the new folder structure. No functional changes to the command or handler logic.
2026-01-12 11:30:46 +01:00
5245cd04ff Refactor: move RecActionViewQuery and MappingProfile
Moved ReadRecActionViewQuery and MappingProfile from RecActionViews to RecActions namespace. Updated all references and using directives accordingly. This organizational change consolidates related queries and mapping profiles for improved clarity and maintainability.
2026-01-12 11:27:51 +01:00
9d5334e7dc Move RecActionView commands to RecActions namespace
Refactored InvokeBatchRecActionViewsCommand and InvokeRecActionViewCommand to ReC.Application.RecActions.Commands. Updated related handlers, records, and extension methods to use the new namespace. Removed obsolete using statement in RecActionController. No functional changes; organizational update only.
2026-01-12 11:21:26 +01:00
e5bb61376a Mark ObtainEndpointCommand and mapping as obsolete
Mark ObtainEndpointCommand, its handler, and related mapping
profile as [Obsolete] with guidance to use the new procedure
or view-based approach. This deprecates the old command and
mapping logic in favor of updated patterns.
2026-01-12 11:07:17 +01:00
d3aa8c715b Mark fake OutRes endpoints and queries as [Obsolete]
Added [Obsolete] attribute to "fake" Get methods in OutResController, as well as to ReadOutResQuery, ReadOutResHandler, and ReadOutResQueryValidator. These components are now deprecated in favor of related procedures or views. No functional changes were made.
2026-01-12 11:02:27 +01:00
6720e66b23 Mark DeleteOutResCommand and related classes as obsolete
Added the [Obsolete("Use the related procedure or view.")] attribute to DeleteOutResCommand, its handler, and its validator to indicate these should no longer be used and to guide consumers toward the recommended procedure or view.
2026-01-12 11:00:21 +01:00
71470fc21d Mark CreateOutResCommandHandler and MappingProfiles obsolete
Both CreateOutResCommandHandler and the MappingProfiles constructor are now marked with [Obsolete] attributes, warning developers to use the related procedure or view instead. This signals that these components are deprecated and may be removed in the future.
2026-01-12 10:59:24 +01:00
9191ec4179 Update [Obsolete] messages to mention procedures or views
Updated [Obsolete] attribute messages across several commands,
handlers, and the mapping profile to clarify that related
procedures or views should be used instead. Added [Obsolete]
to CreateOutResCommand. No functional changes made.
2026-01-12 10:52:41 +01:00
e0d83c0a14 Mark RecAction commands and endpoints as obsolete
Added [Obsolete("Use the related procedure.")] to RecAction creation and deletion commands, handlers, mapping profile, and related controller endpoints to indicate deprecation. No functional changes were made.
2026-01-12 10:50:39 +01:00
03bcfb6fc9 refactor(ProfileView): move to Views directory 2026-01-12 10:36:39 +01:00
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
6263848a0a Update DigitalData.Core.Infrastructure to v2.6.1
Upgraded the DigitalData.Core.Infrastructure NuGet package from version 2.6.0 to 2.6.1 in ReC.Infrastructure.csproj to include the latest fixes and improvements.
2026-01-12 10:26:23 +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
7c687c0541 Remove Root property from ResultView entity
Removed the Root navigation property and its [ForeignKey("Id")] attribute from the ResultView class, as it is no longer needed. No other changes were made to the class structure.
2025-12-17 12:50:48 +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
9b800dce20 Add POST endpoint to create ResultView in controller
Added a new HTTP POST action to ResultViewController that accepts a CreateResultViewCommand in the request body. On success, it returns a 201 Created response with a reference to the Get action for the created resource. This enables clients to create new ResultView entries via the API.
2025-12-17 11:17:14 +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
868e11ff62 Annotate ProfileView with table mapping attribute
Added [Table("VWREC_PROFILE", Schema = "dbo")] to ProfileView to specify its database table mapping. Included necessary using directive for DataAnnotations.Schema.
2025-12-17 09:39:25 +01:00
38d819adac Map ResultView to VWREC_RESULT with Table attribute
Explicitly map ResultView entity to "VWREC_RESULT" in the "dbo" schema using the [Table] attribute to ensure correct Entity Framework mapping.
2025-12-17 09:38:32 +01:00