Add project files.

This commit is contained in:
Sergio Matias Urquin
2025-04-29 18:44:41 -06:00
parent c4ec91852f
commit b2635193dc
133 changed files with 4100 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
using Core.Blueprint.Service.Domain.Dtos;
using Core.Blueprint.Service.UseCases.GetSampleImage.Ports;
using Lib.Architecture.BuildingBlocks;
using Microsoft.AspNetCore.Mvc;
namespace Core.Blueprint.Service.UseCases.GetSampleImage.Adapter
{
public class GetSampleImagePort : BasePresenter, IGetSampleImagePort
{
public void Success(SampleImageUrlDto output)
{
ViewModel = new OkObjectResult(output);
}
}
}

View File

@@ -0,0 +1,43 @@
using Core.Blueprint.Service.Domain.Dtos;
using Core.Blueprint.Service.External.Clients.SampleImageClient;
using Core.Blueprint.Service.UseCases.GetSampleImage.Input;
using Core.Blueprint.Service.UseCases.GetSampleImage.Ports;
using FluentValidation;
using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Service.UseCases.GetSampleImage
{
public class GetSampleImageHandler(IGetSampleImagePort port, IValidator<GetSampleImageRequest> validator, ISampleImageClientService clientService) : IComponentHandler<GetSampleImageRequest>
{
private readonly IGetSampleImagePort _port = port;
private readonly IValidator<GetSampleImageRequest> _validator = validator;
private readonly ISampleImageClientService _clientService = clientService;
public async ValueTask ExecuteAsync(GetSampleImageRequest command, CancellationToken cancellationToken = default)
{
try
{
if (!command.IsValid(_validator))
{
_port.ValidationErrors(command.Notifications);
return;
}
var result = await _clientService.GetFirstImageUrl();
if (result == null)
{
_port.NoContentSuccess();
return;
}
_port.Success(result);
}
catch(Exception ex)
{
_port.BusinessError(ex.Message);
}
}
}
}

View File

@@ -0,0 +1,12 @@
using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Service.UseCases.GetSampleImage.Input
{
public class GetSampleImageRequest : Notificator, ICommand
{
public bool Validate()
{
return true;
}
}
}

View File

@@ -0,0 +1,10 @@
using Core.Blueprint.Service.Domain.Dtos;
using Core.Blueprint.Service.Domain.Entities;
using Lib.Architecture.BuildingBlocks;
namespace Core.Blueprint.Service.UseCases.GetSampleImage.Ports
{
public interface IGetSampleImagePort : IBasePort, ICommandSuccessPort<SampleImageUrlDto>, INoContentPort, IBusinessErrorPort, ITimeoutPort, IValidationErrorPort
{
}
}

View File

@@ -0,0 +1,15 @@
using Core.Blueprint.Service.UseCases.GetSampleImage.Input;
using FluentValidation;
using System.Diagnostics.CodeAnalysis;
namespace Core.Blueprint.Service.UseCases.GetSampleImage.Validator
{
[ExcludeFromCodeCoverage]
public class GetSampleImageValidator : AbstractValidator<GetSampleImageRequest>
{
public GetSampleImageValidator()
{
}
}
}