30 Commits

Author SHA1 Message Date
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
9b3bb925f9 Refactor ResultType enum location and naming for clarity
Move ResultType enum to ReC.API.Models/ResultType.cs and update its values from Header/Body to OnlyHeader/OnlyBody for improved clarity. Update all controller usages and documentation to reflect these changes.
2025-12-17 09:35:24 +01:00
a92d57d9cf Return 404 for null body/header in result controllers
Previously, OutResController and ResultViewController returned HTTP 200 OK with an empty object when the response body or header was null. Now, they return HTTP 404 Not Found in these cases, providing more accurate HTTP status codes for missing resources. Non-null bodies or headers continue to return HTTP 200 OK with the deserialized content.
2025-12-17 09:31:58 +01:00
35 changed files with 189 additions and 64 deletions

View File

@@ -1,6 +1,7 @@
using MediatR;
using Microsoft.AspNetCore.Mvc;
using ReC.API.Extensions;
using ReC.API.Models;
using ReC.Application.OutResults.Commands;
using ReC.Application.OutResults.Queries;
@@ -28,6 +29,7 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
/// <returns>A list of output results for the fake profile.</returns>
[HttpGet("fake")]
[ProducesResponseType(StatusCodes.Status200OK)]
[Obsolete("Use the related procedure or view.")]
public async Task<IActionResult> Get(CancellationToken cancel) => Ok(await mediator.Send(new ReadOutResQuery()
{
ProfileId = config.GetFakeProfileId()
@@ -38,10 +40,11 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
/// </summary>
/// <param name="actionId">The ID of the action to retrieve the result for.</param>
/// <param name="cancel">A token to cancel the operation.</param>
/// <param name="resultType">Specifies which part of the result to return (Full, Header, or Body).</param>
/// <param name="resultType">Specifies which part of the result to return (Full, OnlyHeader, or OnlyBody).</param>
/// <returns>The requested output result or a part of it (header/body).</returns>
[HttpGet("fake/{actionId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[Obsolete("Use the related procedure or view.")]
public async Task<IActionResult> Get([FromRoute] long actionId, CancellationToken cancel, ResultType resultType = ResultType.Full)
{
var res = (await mediator.Send(new ReadOutResQuery()
@@ -52,8 +55,8 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
return resultType switch
{
ResultType.Body => res.Body is null ? Ok(new object { }) : Ok(res.Body.JsonToDynamic()),
ResultType.Header => res.Header is null ? Ok(new object { }) : Ok(res.Header.JsonToDynamic()),
ResultType.OnlyBody => res.Body is null ? NotFound() : Ok(res.Body.JsonToDynamic()),
ResultType.OnlyHeader => res.Header is null ? NotFound() : Ok(res.Header.JsonToDynamic()),
_ => Ok(res),
};
}
@@ -85,23 +88,4 @@ public class OutResController(IMediator mediator, IConfiguration config) : Contr
await mediator.Send(new DeleteOutResCommand() { ProfileId = config.GetFakeProfileId() }, cancel);
return NoContent();
}
}
/// <summary>
/// Defines the type of result to be returned from an output result query.
/// </summary>
public enum ResultType
{
/// <summary>
/// Return the full result object.
/// </summary>
Full,
/// <summary>
/// Return only the header part of the result.
/// </summary>
Header,
/// <summary>
/// Return only the body part of the result.
/// </summary>
Body
}
}

View File

@@ -3,8 +3,7 @@ using Microsoft.AspNetCore.Mvc;
using ReC.API.Extensions;
using ReC.API.Models;
using ReC.Application.RecActions.Commands;
using ReC.Application.RecActionViews.Commands;
using ReC.Application.RecActionViews.Queries;
using ReC.Application.RecActions.Queries;
using System.Text.Json;
namespace ReC.API.Controllers;
@@ -73,6 +72,7 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co
/// <returns>An HTTP 201 Created response.</returns>
[HttpPost]
[ProducesResponseType(StatusCodes.Status201Created)]
[Obsolete("Use the related procedure.")]
public async Task<IActionResult> CreateAction([FromBody] CreateRecActionCommand command, CancellationToken cancel)
{
await mediator.Send(command, cancel);
@@ -91,6 +91,7 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co
/// <returns>An HTTP 201 Created response.</returns>
[HttpPost("fake")]
[ProducesResponseType(StatusCodes.Status201Created)]
[Obsolete("Use the related procedure.")]
public async Task<IActionResult> CreateFakeAction(
CancellationToken cancel,
[FromBody] FakeRequest? request = null,
@@ -126,6 +127,7 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co
/// <returns>An HTTP 204 No Content response upon successful deletion.</returns>
[HttpDelete]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[Obsolete("Use the related procedure.")]
public async Task<IActionResult> Delete([FromQuery] DeleteRecActionsCommand cmd, CancellationToken cancel)
{
await mediator.Send(cmd, cancel);
@@ -139,6 +141,7 @@ public class RecActionController(IMediator mediator, IConfiguration config) : Co
/// <returns>An HTTP 204 No Content response upon successful deletion.</returns>
[HttpDelete("fake")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[Obsolete("Use the related procedure.")]
public async Task<IActionResult> Delete(CancellationToken cancel)
{
await mediator.Send(new DeleteRecActionsCommand()

View File

@@ -1,7 +1,9 @@
using MediatR;
using Microsoft.AspNetCore.Mvc;
using ReC.API.Extensions;
using ReC.Application.ResultViews.Queries;
using ReC.API.Models;
using ReC.Application.OutResults.Commands;
using ReC.Application.OutResults.Queries;
namespace ReC.API.Controllers;
@@ -32,9 +34,16 @@ public class ResultViewController(IMediator mediator, IConfiguration config) : C
return resultType switch
{
ResultType.Body => res.Body is null ? Ok(new object { }) : Ok(res.Body.JsonToDynamic()),
ResultType.Header => res.Header is null ? Ok(new object { }) : Ok(res.Header.JsonToDynamic()),
ResultType.OnlyBody => res.Body is null ? NotFound() : Ok(res.Body.JsonToDynamic()),
ResultType.OnlyHeader => res.Header is null ? NotFound() : Ok(res.Header.JsonToDynamic()),
_ => Ok(res),
};
}
[HttpPost]
public async Task<IActionResult> Create([FromBody] CreateResultViewCommand command, CancellationToken cancel)
{
await mediator.Send(command, cancel);
return CreatedAtAction(nameof(Get), new { actionId = command.ActionId }, command);
}
}

View File

@@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Mvc.Filters;
using ReC.Application.Common.Interfaces;
namespace ReC.API.Middleware;
public class AuthScopedFilter(IConfiguration config) : IAsyncActionFilter
{
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
if (context.ActionArguments.TryGetValue("command", out var command) && command is IAuthScoped authScopedCommand)
{
var addedWho = config["AddedWho"] ?? throw new InvalidOperationException("The required 'AddedWho' configuration is missing. Please contact a system administrator.");
authScopedCommand.Scope.AddedWho = addedWho;
}
await next();
}
}

View File

@@ -0,0 +1,17 @@
namespace ReC.API.Models;
public enum ResultType
{
/// <summary>
/// Return the full result object.
/// </summary>
Full,
/// <summary>
/// Return only the header part of the result.
/// </summary>
OnlyHeader,
/// <summary>
/// Return only the body part of the result.
/// </summary>
OnlyBody
}

View File

@@ -54,7 +54,10 @@ try
});
});
builder.Services.AddControllers();
builder.Services.AddControllers(options =>
{
options.Filters.Add<AuthScopedFilter>();
});
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>

View File

@@ -1,30 +1,29 @@
using FluentValidation;
using MediatR;
namespace ReC.Application.Common.Behaviors
namespace ReC.Application.Common.Behaviors;
public class ValidationBehavior<TRequest, TResponse>(IEnumerable<IValidator<TRequest>> validators) : IPipelineBehavior<TRequest, TResponse>
where TRequest : notnull
{
public class ValidationBehavior<TRequest, TResponse>(IEnumerable<IValidator<TRequest>> validators) : IPipelineBehavior<TRequest, TResponse>
where TRequest : notnull
public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancel)
{
public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancel)
if (validators.Any())
{
if (validators.Any())
{
var context = new ValidationContext<TRequest>(request);
var context = new ValidationContext<TRequest>(request);
var validationResults = await Task.WhenAll(
validators.Select(v =>
v.ValidateAsync(context, cancel)));
var validationResults = await Task.WhenAll(
validators.Select(v =>
v.ValidateAsync(context, cancel)));
var failures = validationResults
.SelectMany(r => r.Errors)
.Where(f => f != null)
.ToList();
var failures = validationResults
.SelectMany(r => r.Errors)
.Where(f => f != null)
.ToList();
if (failures.Count != 0)
throw new ValidationException(failures);
}
return await next(cancel);
if (failures.Count != 0)
throw new ValidationException(failures);
}
return await next(cancel);
}
}

View File

@@ -1,4 +1,5 @@
using ReC.Domain.Entities;
using ReC.Domain.Views;
namespace ReC.Application.Common.Dto;

View File

@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
namespace ReC.Application.Common.Interfaces;
public record AuthScope
{
public string? AddedWho { get; set; }
}
public interface IAuthScoped : IScoped<AuthScope>
{
public string? AddedWho => Scope.AddedWho;
}

View File

@@ -1,5 +1,6 @@
using Microsoft.EntityFrameworkCore;
using ReC.Domain.Entities;
using ReC.Domain.Views;
namespace ReC.Application.Common.Interfaces;

View File

@@ -0,0 +1,10 @@
using MediatR;
using System.Text.Json.Serialization;
namespace ReC.Application.Common.Interfaces;
public interface IScoped<TScope> where TScope : notnull
{
[JsonIgnore]
public TScope Scope { get; }
}

View File

@@ -0,0 +1,14 @@
using FluentValidation;
using ReC.Application.Common.Interfaces;
namespace ReC.Application.Common.Validations;
public class AuthScopedValidator : AbstractValidator<IAuthScoped>
{
public AuthScopedValidator()
{
RuleFor(x => x.AddedWho)
.NotEmpty()
.WithMessage("The 'AddedWho' field is required. A missing value may indicate an API configuration issue. Please contact your system administrator for assistance.");
}
}

View File

@@ -7,11 +7,13 @@ using ReC.Domain.Entities;
namespace ReC.Application.Endpoints.Commands;
[Obsolete("Use the related procedure or view.")]
public class ObtainEndpointCommand : IRequest<EndpointDto>
{
public string Uri { get; init; } = null!;
}
[Obsolete("Use the related procedure or view.")]
public class ObtainEndpointCommandHandler(IRepository<Endpoint> repo, IMapper mapper) : IRequestHandler<ObtainEndpointCommand, EndpointDto>
{
public async Task<EndpointDto> Handle(ObtainEndpointCommand request, CancellationToken cancel)

View File

@@ -6,6 +6,7 @@ namespace ReC.Application.Endpoints;
// TODO: update to inject AddedWho from the current host/user contex
public class MappingProfile : AutoMapper.Profile
{
[Obsolete("Use the related procedure or view.")]
public MappingProfile()
{
CreateMap<ObtainEndpointCommand, EndpointDto>()

View File

@@ -4,6 +4,7 @@ using ReC.Domain.Entities;
namespace ReC.Application.OutResults.Commands;
[Obsolete("Use the related procedure or view.")]
public class CreateOutResCommand : IRequest
{
public required long ActionId { get; set; }
@@ -19,6 +20,7 @@ public class CreateOutResCommand : IRequest
public string? AddedWho { get; set; }
}
[Obsolete("Use the related procedure or view.")]
public class CreateOutResCommandHandler(IRepository<OutRes> repo) : IRequestHandler<CreateOutResCommand>
{
public Task Handle(CreateOutResCommand request, CancellationToken cancel)

View File

@@ -0,0 +1,26 @@
using DigitalData.Core.Abstraction.Application.Repository;
using MediatR;
using ReC.Application.Common.Interfaces;
using ReC.Domain.Views;
using System.Text.Json.Serialization;
namespace ReC.Application.OutResults.Commands;
public class CreateResultViewCommand : IAuthScoped, IRequest
{
public required long ActionId { get; set; }
public required short StatusCode { get; set; }
public string? Header { get; set; }
public string? Body { get; set; }
[JsonIgnore]
public AuthScope Scope { get; } = new();
}
public class CreateResultViewCommandHandler(IRepository<ResultView> repo) : IRequestHandler<CreateResultViewCommand>
{
public Task Handle(CreateResultViewCommand request, CancellationToken cancel) => repo.CreateAsync(request, cancel);
}

View File

@@ -11,6 +11,7 @@ namespace ReC.Application.OutResults.Commands;
/// Deletion can be performed by providing either an <see cref="ActionId"/> or a <see cref="ProfileId"/>.
/// At least one of these properties must be set for the operation to proceed.
/// </remarks>
[Obsolete("Use the related procedure or view.")]
public record DeleteOutResCommand : IRequest
{
/// <summary>
@@ -27,6 +28,7 @@ public record DeleteOutResCommand : IRequest
/// <summary>
/// Handles the execution of the <see cref="DeleteOutResCommand"/>.
/// </summary>
[Obsolete("Use the related procedure or view.")]
public class DeleteOutResCommandHandler(IRepository<OutRes> repo) : IRequestHandler<DeleteOutResCommand>
{
/// <summary>

View File

@@ -2,6 +2,7 @@ using FluentValidation;
namespace ReC.Application.OutResults.Commands;
[Obsolete("Use the related procedure or view.")]
public class DeleteOutResCommandValidator : AbstractValidator<DeleteOutResCommand>
{
public DeleteOutResCommandValidator()

View File

@@ -1,15 +1,20 @@
using ReC.Application.OutResults.Commands;
using ReC.Domain.Entities;
using ReC.Domain.Views;
namespace ReC.Application.OutResults;
// TODO: update to inject AddedWho from the current host/user contex
public class MappingProfiles : AutoMapper.Profile
{
[Obsolete("Use the related procedure or view.")]
public MappingProfiles()
{
CreateMap<CreateOutResCommand, OutRes>()
.ForMember(e => e.AddedWhen, exp => exp.MapFrom(cmd => DateTime.UtcNow))
.ForMember(e => e.AddedWho, exp => exp.MapFrom(cmd => "ReC.API"));
CreateMap<CreateResultViewCommand, ResultView>()
.ForMember(e => e.AddedWhen, exp => exp.MapFrom(cmd => DateTime.UtcNow));
}
}

View File

@@ -8,6 +8,7 @@ using ReC.Domain.Entities;
namespace ReC.Application.OutResults.Queries;
[Obsolete("Use the related procedure or view.")]
public record ReadOutResQuery : IRequest<IEnumerable<OutResDto>>
{
public long? ProfileId { get; init; }
@@ -15,6 +16,7 @@ public record ReadOutResQuery : IRequest<IEnumerable<OutResDto>>
public long? ActionId { get; init; }
}
[Obsolete("Use the related procedure or view.")]
public class ReadOutResHandler(IRepository<OutRes> repo, IMapper mapper) : IRequestHandler<ReadOutResQuery, IEnumerable<OutResDto>>
{
public async Task<IEnumerable<OutResDto>> Handle(ReadOutResQuery request, CancellationToken cancel)

View File

@@ -2,6 +2,7 @@ using FluentValidation;
namespace ReC.Application.OutResults.Queries;
[Obsolete("Use the related procedure or view.")]
public class ReadOutResQueryValidator : AbstractValidator<ReadOutResQuery>
{
public ReadOutResQueryValidator()

View File

@@ -4,10 +4,10 @@ using DigitalData.Core.Exceptions;
using MediatR;
using Microsoft.EntityFrameworkCore;
using ReC.Application.Common.Dto;
using ReC.Domain.Entities;
using ReC.Domain.Views;
using System.Text.Json;
namespace ReC.Application.ResultViews.Queries;
namespace ReC.Application.OutResults.Queries;
public record ReadResultViewQuery : IRequest<IEnumerable<ResultViewDto>>
{

View File

@@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="15.1.0" />
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.5.0" />
<PackageReference Include="DigitalData.Core.Abstraction.Application" Version="1.6.0" />
<PackageReference Include="DigitalData.Core.Application" Version="3.4.0" />
<PackageReference Include="DigitalData.Core.Exceptions" Version="1.1.0" />
<PackageReference Include="FluentValidation" Version="12.1.0" />

View File

@@ -6,6 +6,7 @@ using ReC.Application.Endpoints.Commands;
namespace ReC.Application.RecActions.Commands;
[Obsolete("Use the related procedure or view.")]
public record CreateRecActionCommand : IRequest
{
public long ProfileId { get; init; }
@@ -27,6 +28,7 @@ public record CreateRecActionCommand : IRequest
public long? EndpointAuthId { get; set; }
}
[Obsolete("Use the related procedure or view.")]
public class CreateRecActionCommandHandler(ISender sender, IRepository<RecAction> repo) : IRequestHandler<CreateRecActionCommand>
{
public async Task Handle(CreateRecActionCommand request, CancellationToken cancel)

View File

@@ -6,11 +6,13 @@ using ReC.Domain.Entities;
namespace ReC.Application.RecActions.Commands;
[Obsolete("Use the related procedure or view.")]
public class DeleteRecActionsCommand : IRequest
{
public required long ProfileId { get; init; }
}
[Obsolete("Use the related procedure or view.")]
public class DeleteRecActionsCommandHandler(IRepository<RecAction> repo) : IRequestHandler<DeleteRecActionsCommand>
{
public async Task Handle(DeleteRecActionsCommand request, CancellationToken cancel)

View File

@@ -1,8 +1,8 @@
using MediatR;
using ReC.Application.RecActionViews.Queries;
using ReC.Application.RecActions.Queries;
using ReC.Domain.Constants;
namespace ReC.Application.RecActionViews.Commands;
namespace ReC.Application.RecActions.Commands;
public record InvokeBatchRecActionViewsCommand : IRequest
{

View File

@@ -11,7 +11,7 @@ using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
namespace ReC.Application.RecActionViews.Commands;
namespace ReC.Application.RecActions.Commands;
public record InvokeRecActionViewCommand : IRequest<bool>
{

View File

@@ -1,11 +1,12 @@
using ReC.Application.Common.Dto;
using ReC.Application.RecActions.Commands;
namespace ReC.Application.RecActionViews;
namespace ReC.Application.RecActions;
// TODO: update to inject AddedWho from the current host/user contex
public class MappingProfile : AutoMapper.Profile
{
[Obsolete("Use the related procedure or view.")]
public MappingProfile()
{
CreateMap<CreateRecActionCommand, RecActionDto>()

View File

@@ -1,12 +1,12 @@
using MediatR;
using DigitalData.Core.Abstraction.Application.Repository;
using ReC.Domain.Entities;
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using DigitalData.Core.Exceptions;
using ReC.Application.Common.Dto;
using ReC.Domain.Views;
namespace ReC.Application.RecActionViews.Queries;
namespace ReC.Application.RecActions.Queries;
public record ReadRecActionViewQuery : IRequest<IEnumerable<RecActionViewDto>>
{

View File

@@ -1,7 +1,9 @@
using ReC.Domain.Constants;
using System.ComponentModel.DataAnnotations.Schema;
namespace ReC.Domain.Entities;
namespace ReC.Domain.Views;
[Table("VWREC_PROFILE", Schema = "dbo")]
public record ProfileView
{
public long Id { get; init; }

View File

@@ -1,7 +1,8 @@
using ReC.Domain.Constants;
using ReC.Domain.Entities;
using System.ComponentModel.DataAnnotations.Schema;
namespace ReC.Domain.Entities;
namespace ReC.Domain.Views;
/// <summary>
/// Represents the VWREC_ACTION view from the database.

View File

@@ -1,14 +1,12 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace ReC.Domain.Entities;
namespace ReC.Domain.Views;
[Table("VWREC_RESULT", Schema = "dbo")]
public class ResultView
{
public long Id { get; set; }
[ForeignKey("Id")]
public OutRes? Root { get; set; }
public long? ActionId { get; set; }
public RecActionView? Action { get; set; }

View File

@@ -1,8 +1,10 @@
using DigitalData.Core.Infrastructure;
using FluentValidation;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using ReC.Application.Common.Interfaces;
using ReC.Domain.Entities;
using ReC.Application.Common.Validations;
using ReC.Domain.Views;
namespace ReC.Infrastructure;
@@ -23,6 +25,8 @@ public static class DependencyInjection
services.AddDbRepository(opt => opt.RegisterFromAssembly<TRecDbContext>(typeof(RecActionView).Assembly));
services.AddValidatorsFromAssembly(typeof(AuthScopedValidator).Assembly);
return services;
}

View File

@@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.5.2" />
<PackageReference Include="DigitalData.Core.Infrastructure" Version="2.6.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0" />
</ItemGroup>

View File

@@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using ReC.Application.Common.Interfaces;
using ReC.Domain.Entities;
using ReC.Domain.Views;
namespace ReC.Infrastructure;