Generator Changes at 11/12/2025 1:32:03 AM +03:30

This commit is contained in:
masoodafar-web
2025-11-12 02:24:02 +03:30
parent 826ae4589f
commit b27c765731
290 changed files with 30811 additions and 21316 deletions

View File

@@ -0,0 +1,7 @@
namespace CMSMicroservice.Application.ProductImagesCQ.Queries.GetProductImages;
public record GetProductImagesQuery : IRequest<GetProductImagesResponseDto>
{
//
public long Id { get; init; }
}

View File

@@ -0,0 +1,22 @@
namespace CMSMicroservice.Application.ProductImagesCQ.Queries.GetProductImages;
public class GetProductImagesQueryHandler : IRequestHandler<GetProductImagesQuery, GetProductImagesResponseDto>
{
private readonly IApplicationDbContext _context;
public GetProductImagesQueryHandler(IApplicationDbContext context)
{
_context = context;
}
public async Task<GetProductImagesResponseDto> Handle(GetProductImagesQuery request,
CancellationToken cancellationToken)
{
var response = await _context.ProductImagess
.AsNoTracking()
.Where(x => x.Id == request.Id)
.ProjectToType<GetProductImagesResponseDto>()
.FirstOrDefaultAsync(cancellationToken);
return response ?? throw new NotFoundException(nameof(ProductImages), request.Id);
}
}

View File

@@ -0,0 +1,16 @@
namespace CMSMicroservice.Application.ProductImagesCQ.Queries.GetProductImages;
public class GetProductImagesQueryValidator : AbstractValidator<GetProductImagesQuery>
{
public GetProductImagesQueryValidator()
{
RuleFor(model => model.Id)
.NotNull();
}
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
{
var result = await ValidateAsync(ValidationContext<GetProductImagesQuery>.CreateWithOptions((GetProductImagesQuery)model, x => x.IncludeProperties(propertyName)));
if (result.IsValid)
return Array.Empty<string>();
return result.Errors.Select(e => e.ErrorMessage);
};
}

View File

@@ -0,0 +1,13 @@
namespace CMSMicroservice.Application.ProductImagesCQ.Queries.GetProductImages;
public class GetProductImagesResponseDto
{
//
public long Id { get; set; }
//
public string Title { get; set; }
//
public string ImagePath { get; set; }
//
public string ImageThumbnailPath { get; set; }
}