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:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user