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.
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.Core.Exceptions;
|
||||
using MediatR;
|
||||
using ReC.Domain.Entities;
|
||||
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; }
|
||||
|
||||
public bool Active { get; init; } = true;
|
||||
|
||||
public long? EndpointId { get; set; }
|
||||
|
||||
public string? EndpointUri { get; init; }
|
||||
|
||||
public string Type { get; init; } = null!;
|
||||
|
||||
public string? HeaderQuery { get; init; }
|
||||
|
||||
public string BodyQuery { get; init; } = null!;
|
||||
|
||||
public byte Sequence { get; set; } = 1;
|
||||
|
||||
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)
|
||||
{
|
||||
if(request.EndpointId is null)
|
||||
if(request.EndpointUri is string endpointUri)
|
||||
{
|
||||
var endpoint = await sender.Send(new ObtainEndpointCommand { Uri = endpointUri }, cancel);
|
||||
request.EndpointId = endpoint.Id;
|
||||
}
|
||||
else
|
||||
throw new BadRequestException("Either EndpointId or EndpointUri must be provided.");
|
||||
|
||||
await repo.CreateAsync(request, cancel);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using DigitalData.Core.Abstraction.Application.Repository;
|
||||
using DigitalData.Core.Exceptions;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
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)
|
||||
{
|
||||
// TODO: update DeleteAsync (in Core) to return number of deleted records
|
||||
if (!await repo.Where(act => act.ProfileId == request.ProfileId).AnyAsync(cancel))
|
||||
throw new NotFoundException();
|
||||
|
||||
await repo.DeleteAsync(act => act.ProfileId == request.ProfileId, cancel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user