update
This commit is contained in:
@@ -13,7 +13,7 @@ public class GetAllProductsByFilterQueryHandler : IRequestHandler<GetAllProducts
|
||||
|
||||
public async Task<GetAllProductsByFilterResponseDto> Handle(GetAllProductsByFilterQuery request, CancellationToken cancellationToken)
|
||||
{
|
||||
await _context.Package.GetAllPackageByFilterAsync(request.Adapt<GetAllPackageByFilterRequest>(), cancellationToken: cancellationToken);
|
||||
return new GetAllProductsByFilterResponseDto();
|
||||
var result= await _context.Package.GetAllPackageByFilterAsync(request.Adapt<GetAllPackageByFilterRequest>(), cancellationToken: cancellationToken);
|
||||
return result.Adapt<GetAllProductsByFilterResponseDto>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using CMSMicroservice.Protobuf.Protos.Products;
|
||||
|
||||
namespace FrontOffice.BFF.Application.ProductsCQ.Queries.GetProducts;
|
||||
public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, GetProductsResponseDto>
|
||||
{
|
||||
@@ -11,12 +13,8 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, GetProd
|
||||
public async Task<GetProductsResponseDto> Handle(GetProductsQuery request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var response = await _context.Productss
|
||||
.AsNoTracking()
|
||||
.Where(x => x.Id == request.Id)
|
||||
.ProjectToType<GetProductsResponseDto>()
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
var response = await _context.Product.GetProductsAsync(request.Adapt<GetProductsRequest>(), cancellationToken: cancellationToken);
|
||||
|
||||
return response ?? throw new NotFoundException(nameof(Products), request.Id);
|
||||
return response ==null? throw new NotFoundException(nameof(ProductsContract.ProductsContractClient), request.Id):response.Adapt<GetProductsResponseDto>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using FrontOffice.BFF.Protobuf.Protos.Products;
|
||||
using CMSMicroservice.Protobuf.Protos.Products;
|
||||
using FrontOffice.BFF.WebApi.Common.Services;
|
||||
using FrontOffice.BFF.Application.ProductsCQ.Queries.GetProducts;
|
||||
using FrontOffice.BFF.Application.ProductsCQ.Queries.GetAllProductsByFilter;
|
||||
|
||||
Reference in New Issue
Block a user