Remove ObtainEndpointCommand and its handler

Deleted the ObtainEndpointCommand, its handler, and related using directives. This command was previously used to obtain or create Endpoint entities by URI, but has been removed in favor of using a related procedure or view as indicated by its Obsolete attribute.
This commit is contained in:
2026-01-16 10:36:10 +01:00
parent 37200617ea
commit 5a30b0ece4

View File

@@ -1,29 +0,0 @@
using AutoMapper;
using DigitalData.Core.Abstraction.Application.Repository;
using MediatR;
using Microsoft.EntityFrameworkCore;
using ReC.Application.Common.Dto;
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)
{
var endpoint = await repo.Where(e => e.Uri == request.Uri).FirstOrDefaultAsync(cancel);
if (endpoint is not null)
return mapper.Map<EndpointDto>(endpoint);
endpoint = await repo.CreateAsync(request, cancel);
return mapper.Map<EndpointDto>(endpoint);
}
}